You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 07c1dbc
Browse filesBrowse the repository at this point in the historyBrowse files
fix(skills/bounding-heavy-commands): stop smaller commands from overtaking a waiting command
The wrapper kept no order among waiting commands. A command that needs many slots started only when all of them were free at the same moment, so a steady stream of smaller commands could keep it waiting for as long as the stream went on. A first measurement, which needs every slot, was the worst case, while the skill told agents that the queue puts commands in sequence.
Waiters now take a blocking flock on an empty line.lock before they try for slots, and keep it until they hold their slots. Only the waiter at the head of the line tries; the others block in the kernel, which also releases the line lock of a waiter that dies. A waiter behind others logs that it waits behind other commands in the line.
Two cases would stop the whole line, so the head does not keep it there. A waiter checks its exclusive names before it enters the line and leaves the line when a name is taken, so a server that holds a name does not block the commands of other names. The head also leaves the line when no slot comes free for 300 seconds, so a server that holds a slot cannot block its own client behind a command that needs that slot. reserve.lock and the all-or-nothing try stay, so an older copy of the wrapper still shares the slots safely.
Closes#54
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
5. Record the suggested budget that the wrapper prints, but only from a run in which the command did its full work. It is the peak plus a margin, and the margin is larger where the measurement is approximate. A run that stopped early gives a peak that is too small: a suite that stops at its first failure, a command that failed at its start, a run that a signal or the hard cap stopped. Do not record the budget of such a run, and save no record for the command yet. Run the command with `--measure` again each time that you run it, until one run does its full work. A measurement with no `--memory` takes the whole queue, because the peak of the command is not known: it waits until no other bounded command runs, and no other starts while it runs. When it waits, tell the user that a first measurement waits for the other bounded commands to end. If the hard cap stopped a measurement with `--memory`, measure again with two times that budget. If it stopped a measurement with no `--memory`, the command needs more memory than the queue has: tell the user, with the budget that the wrapper printed.
95
+
5. Record the suggested budget that the wrapper prints, but only from a run in which the command did its full work. It is the peak plus a margin, and the margin is larger where the measurement is approximate. A run that stopped early gives a peak that is too small: a suite that stops at its first failure, a command that failed at its start, a run that a signal or the hard cap stopped. Do not record the budget of such a run, and save no record for the command yet. Run the command with `--measure` again each time that you run it, until one run does its full work. A measurement with no `--memory` takes the whole queue, because the peak of the command is not known: it waits until no other bounded command runs, the commands that arrive after it wait behind it, and no other starts while it runs. When it waits, tell the user that a first measurement waits for the other bounded commands to end. If the hard cap stopped a measurement with `--memory`, measure again with two times that budget. If it stopped a measurement with no `--memory`, the command needs more memory than the queue has: tell the user, with the budget that the wrapper printed.
96
96
6. Save the record.
97
97
98
98
The measured run is a real run of the command. Its result counts, also when the run stopped early, so do not run the command a second time to get the result.
99
99
100
100
## Rules for the wait
101
101
102
-
A long wait means that the machine is full. It is never a fault to repair: the queue has no state that can go wrong between runs, and an agent that repairs it breaks it. Unless an instruction says otherwise (see the next section), the only correct moves are to keep the run in the queue and to tell the user that the machine is full and the command is queued. A subagent tells its dispatcher in its report.
102
+
A long wait means that the machine is full. It is never a fault to repair: the queue has no state that can go wrong between runs, and an agent that repairs it breaks it. Waiting commands take turns in a line. A command that needs many slots is not overtaken by smaller commands that arrive after it. So a small command can wait behind a large one, also when a slot is free. Unless an instruction says otherwise (see the next section), the only correct moves are to keep the run in the queue and to tell the user that the machine is full and the command is queued. A subagent tells its dispatcher in its report.
103
103
104
104
-**Run a bounded command in the background, with no short timeout around it.** It can wait in the queue for minutes before it starts. Where the harness requires a timeout, use the longest one that it permits. When that timeout ends a run, start the run again through the wrapper, and say in your report that the timeout ended the run and that the code did not fail. A timeout that you calculate from the run time of the command does not count the wait. A timeout that fires during the wait kills a command that never ran, and the result reads like a failure of the code.
105
105
-**Plan the time as if the commands run one after the other.** Two bounded commands that start together are safe, because the queue puts them in sequence when the machine cannot hold both. So a parallel start does not always save time, and a promise to the user that depends on it is a guess.
0 commit comments