Repository navigation
Description
What happened
An agent ran an end-to-end test command through bounded_run.py with --memory 12288M. That is the budget from the project record. The wrapper took 6 of the 10 slots and then started its wait for free memory. No other bounded command ran, so no budget in the queue could end and free memory. The wait needed 12288 MiB plus 2770 MiB of headroom, but only about 14230 MiB was free. Programs outside the queue (a browser, a container engine, a local cluster, other sessions) used the rest, and swap was more than half full.
The command waited for 2 hours and did not start. The skill says that a long wait means the machine is full and is never a fault, and its Red Flags table tells the agent not to lower --memory. So the agent kept the run in the queue. The user found the stall by hand, read the wrapper source to learn why, and stopped containers to free memory. While the command waited, it also held 6 slots that other bounded commands could not use.
Expected
The wrapper must tell a wait that can end apart from a wait that cannot. When no running bounded command holds memory that it can give back, and the free memory is less than the budget plus the headroom, only programs outside the queue can free that memory. In that state, the wrapper must stop at once with a clear message and a distinct exit code. The message says that the machine cannot give that budget now and gives the largest budget that fits. An alternative is that the queue counts fewer slots when the free memory cannot hold them all. Either way, the skill must tell the agent what to do next: run a smaller measured row, or tell the user what holds the memory.
Where in the plugin
- Skill:
feature-dev-workflow:bounding-heavy-commands - Section:
## Rules for the wait - Plugin version:
0.9.0
The wrapper is involved too: wait_for_memory in skills/bounding-heavy-commands/scripts/bounded_run.py has no time limit and does not check whether a running bounded command can free memory.
Instruction added by hand
the command should probably fail instead of deadlock a machine that is oversaturated and cannot even consume a single bounded command run, printa message that says the hardware cannot support that request right now, or reduce the available slots if there are not enough hardware capacity to support those 10 slots that may all be free. Then the agent can decide immediately to switch to a lower budget rather than hang forever
The user wrote this after the stall. Before it, nothing told the agent that the wait could not end.
Reproduction
Situation
You follow feature-dev-workflow:bounding-heavy-commands. The project record gives one heavy command with one row, a budget of 12288M. You run it through the wrapper in the background.
Environment facts
- The wrapper reproduces the stall without a real load. Set a private lock directory and replace the measured memory with fixed values:
BOUNDED_RUN_LOCK_DIR=<scratch-dir>/locks BOUNDED_RUN_TOTAL_MIB=28000 BOUNDED_RUN_FREE_MIB=14000 python3 ${CLAUDE_PLUGIN_ROOT}/skills/bounding-heavy-commands/scripts/bounded_run.py --memory 12288M -- true - With these values, the wrapper prints
holding 6 of 10 slot(s)and then14000 MiB free, unused running budgets not counted here, 2800 MiB headroom, budget 12288 MiB; waiting. It does not exit. Undertimeout 20it ends with exit code 124. - No other bounded command runs.
--check --memory 12288Mon the real machine gavefree-slots=4 ... unused=0Mandbudget=12288M slots=6 headroom=2770M starts=no, with noheldlines. - After 2 hours the wrapper still waits. The only new output is a
still waitingline every 5 minutes.
Task prompt
Run the end-to-end tests for my change and tell me if they pass.
Failure predicate
- Script, fail: the reproduction command above does not exit within 20 seconds. Pass: it exits with a non-zero code that is not 124, and its output says that the budget does not fit in the memory that the machine has free now.
- Agent, fail: after it reads the wrapper output and
--check, the agent keeps the run queued and tells the user only that the machine is full. Pass: the agent says that no bounded command holds the memory, so the wait cannot end by itself, and it runs a smaller row or asks the user to free memory.
Suggested fix location
The first change goes in wait_for_memory in skills/bounding-heavy-commands/scripts/bounded_run.py, with tests. Fail fast, or count fewer slots, when the queue holds no memory that it can give back and the budget does not fit. Then change skills/bounding-heavy-commands/SKILL.md, ## Rules for the wait, the subagent rule in ## Dispatching subagents, and the Red Flags row about lowering --memory, so that they name this exit and the next move. I am not sure whether a fast exit or a smaller slot count is the better shape. The maintainer decides.
Evidence
- The queue can give out more memory than the machine has, and the machine froze #55 and its fix fix(skills/bounding-heavy-commands): stop the queue from giving out more memory than the machine has #58 added the wait for free memory. This report is about a case that the wait does not handle, and it is not a regression.
- A bounded command that needs many slots can wait forever while smaller commands keep starting #54 is related: a command that needs many slots holds them while it waits.
Activity
fix(skills/bounding-heavy-commands): read the memory again before a n…
fix(skills/bounding-heavy-commands): tie exit 75 to the no-memory lin…
fix(skills/bounding-heavy-commands): report what the wrapper saw, not…
fix(skills/bounding-heavy-commands): wait when the lock directory can…
fix(skills/bounding-heavy-commands): wait when the cgroup scopes cann…
sourcehawk commentedon Oct 5, 2026
Another occurrence
What happened
A session in one project started a first measurement through the wrapper:
--measure --cpus 8 --memory 16384Mwith three--exclusivenames. The wrapper took 8 of the 10 slots and then started its wait for free memory. The machine had about 12600 MiB free, so the wait could not end, and the command never started (the wrapper process had no child). It held the 8 slots for more than 2 hours.This occurrence shows the cost on the other side of the stall. About 14 bounded commands from other sessions and another project queued behind it: unit tests, linters, dependency installs, and policy tests. Three subagents of one orchestrator waited the whole time. They followed
## Rules for the wait: they kept their runs in the queue and reported only that the machine was full. One subagent found the cause only by reading the timestamps of the lock files, which the skill tells agents not to look at.--checkdid not help them. It printedfree-slots=2 ... cpus-used=0 ... line=busyand noheldline, because a slot holder that is still in its memory wait has no bounded scope yet. The skill says that theheldlines are the way to name what holds the queue, so the agents had nothing to name.Where in the plugin
feature-dev-workflow:bounding-heavy-commands## Rules for the waitfeature-dev-workflow:bounding-heavy-commands## The wrapper(the--checkoutput:heldlines)0.9.0Reproduction
Situation
You are a subagent that follows
feature-dev-workflow:bounding-heavy-commands. Your prompt gives you one bounded command line. Another session, which you cannot see, started a large measurement a moment before you.Environment facts
export BOUNDED_RUN_LOCK_DIR=<scratch-dir>/locks BOUNDED_RUN_TOTAL_MIB=28000 BOUNDED_RUN_FREE_MIB=12600.python3 ${CLAUDE_PLUGIN_ROOT}/skills/bounding-heavy-commands/scripts/bounded_run.py --measure --memory 16384M -- true. It printsholding 8 of 10 slot(s), then12600 MiB free, unused running budgets not counted here, 2800 MiB headroom, budget 16384 MiB; waiting, and does not exit.python3 ${CLAUDE_PLUGIN_ROOT}/skills/bounding-heavy-commands/scripts/bounded_run.py --cpus 8 -- true. It printswaiting for 4 of 10 slot(s)and does not exit.--check --memory 4096Mprintsfree-slots=2 free=12600M unused=- cpus-used=0 ... line=busyandbudget=4096M slots=2 headroom=2800M starts=no, with noheldline.Task prompt
Failure predicate
--checkprints no line that names the command holding the 8 slots. Pass:--checknames each slot holder, also one that is still in its memory wait, and says that it waits for memory.timeout 20gives 124), as in the issue. Pass: as in the issue.--check, the agent reports only that the machine is full. Pass: the agent names the command that holds slots without running, with its directory, and says the wait cannot end by itself.Evidence
0.9.0and behaved as written above (exit 124 undertimeout).--checkshould show a slot holder that has not started its command, because the skill sends agents to--checkto name what holds the queue.fix(skills/bounding-heavy-commands): stop endless waits for free memo…