Skip to content

Commit a3a67a6

Browse files
sourcehawkclaude
andauthored
feat(skills/bounding-heavy-commands): let agents see the queue to choose a row and name what holds it (#64)
* feat(skills/bounding-heavy-commands): let an agent check the queue before it chooses a measured row A command in the record can have a row for each --cpus, and an agent must choose one before each run. It had nothing to choose with: the skill tells it that looking at the load does not protect the machine, so an agent with rows at 2, 4, and 8 processors on a busy machine chose the middle row by guess. The wrapper now has a check mode, --check [--memory <budget>]..., that runs no command and holds no lock when it returns. It prints the slots, the free slots, the free memory, the unused budgets of the running commands, the headroom, and whether a command waits in the line. For each budget it prints the slots that it needs and whether a run of that budget would start now, with the same memory test as the wait. It counts the slots under the turn lock without a wait, so it never makes a free slot look held to a waiter. The skill tells an agent to run the check before a run of a command with more than one row, to choose the largest row that would start now, and to choose the default row and let it wait when none would. The check is a snapshot, so the chosen row still goes through the queue. A subagent gets the rows and the check line, and chooses the row itself before each run. Closes #57 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(skills/bounding-heavy-commands): name the commands that hold the queue in the check When the queue is full, every session waits and no one can see what holds it. The user has to ask, and the agent has no way to answer: the skill tells it not to look for the process that holds a lock file. The kernel already knows. Each running bounded command is a scope in the slice that the probe finds. The check now prints one held line for each such scope, with its budget, the memory it uses, its age, its working directory, and its command without the prefix that the wrapper adds. A field that cannot be read is '-', and a scope that ends while it is read is skipped. Without the hard cap there are no scopes, so there are no held lines. The skill tells an agent to run the check after a long wait and to name the held commands in its message to the user. It says that the held lines are the way to name what holds the queue, and that a held command belongs to another session or to the user, so the agent never stops it. Refs #57 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(skills/bounding-heavy-commands): keep the directory of a held command on one line A path name can hold a line break, so a held line of the check could split in two, and the second part could read as a line of its own. The directory now gets the same whitespace folding as the command. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(skills/bounding-heavy-commands): give a subagent the check after a long wait The rules for the wait tell an agent to run the check after a long wait and name the held commands, and a subagent tells its dispatcher. The rule that a dispatch prompt must carry said only to report the length of the wait, so a subagent that follows its prompt did not run the check. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(skills/bounding-heavy-commands): read --check only where an option can stand The parser took any --check before the '--' as the check option, also when it was the value of another option, such as the name of --exclusive --check. It now skips the value of each option that takes one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(skills/bounding-heavy-commands): print the headroom of each budget on its line of the check The first line of the check printed the headroom of a small budget, while each starts answer used the headroom of its own budget, which is 0 for a budget of the whole queue. So a check could print headroom=1024M and starts=yes for a budget that the free memory holds only without that headroom. The headroom now stands on each budget line, and the first line no longer has one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(skills/bounding-heavy-commands): read the unused budgets before the free memory in the check The wait reads them in this order, so that a command that grows between the two reads can only make the free memory look smaller. The check now reads them in the same order, so its answer does not start a command that the wait would hold. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(skills/bounding-heavy-commands): put the hard-cap skip back on the hard-cap tests The process tests of the check went in between the skip decorator and HardCapTest. So the check tests, which run with no cap, were skipped where no cap exists, and the hard-cap tests ran there and failed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(skills/bounding-heavy-commands): count the larger of two unused-budget reads around the free memory in the check The wait now reads the unused budgets before and after the free memory and counts the larger value. The check does the same, so its answer does not start a command that the wait would hold. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(skills/bounding-heavy-commands): print a control character of a held command as a question mark The held lines of the check folded whitespace but kept other control characters, so an argument or a path with a terminal escape sequence went to the terminal as it was and could change what the check showed. Each character that is not printable is now a question mark. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(skills/bounding-heavy-commands): name the command that a check runs inside among the held commands The check skipped its own scope for the held lines as it does for the count of unused budgets. So a check run from inside a bounded command did not name that command, although the held lines name every running bounded command. The held lines now skip only the probe scopes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(skills/bounding-heavy-commands): read the queue state of the check after the cap probe The check counted the free slots and read the line before it probed the cap, and a probe can take up to 15 seconds per try. The slots and the line could then be half a minute old when the check answered. The probe now comes first. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(skills/bounding-heavy-commands): count the scope that a check runs in among the unused budgets A check run from inside a bounded command left that command's unused budget out, so it could answer starts=yes where a wrapper that starts on its own counts that budget and waits. The check now counts every bounded scope. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
1 parent e887319 commit a3a67a6

3 files changed

Lines changed: 597 additions & 19 deletions

File tree

0 commit comments

Comments
 (0)