Skip to content

fix(skills/bounding-heavy-commands): stop first measurements from running together - #50

Merged
sourcehawk merged 6 commits into
mainfrom
fix/bounded-first-measurement
Sep 29, 2026
Merged

sourcehawk merged 6 commits into
mainfrom
fix/bounded-first-measurement

Conversation

@sourcehawk

@sourcehawk sourcehawk commented Sep 29, 2026 •

Copy link
Copy Markdown
Owner

Description

Fixes #49

Several agents can still load the machine together in cases that the memory queue does not count: a first measurement of a command whose peak is not known, a wave of subagents on a machine where the wrapper cannot run, and a command that lives on after Ctrl-\ ends the wrapper. This PR makes a first measurement run alone in the queue, makes the orchestrator dispatch in sequence when no wrapper exists, and sends the quit signal to the command. The cost is time: a first measurement of a command waits until no other bounded command runs, and the other bounded commands of the machine wait while it runs.

Changes

  • --measure with no --memory takes each slot of the queue. --measure with --memory takes the slots of that budget, as before.
  • A first measurement waits for the free memory of the default budget, not of the full queue.
  • The wrapper sends SIGQUIT to the command and ends with exit code 131. Under the hard cap, a stop signal that comes before the command runs is kept and sent after the start.
  • The skill takes a budget only from a run in which the command did its full work. After a run that stopped early, the agent saves no record and measures again at the next run. The result of that run still counts.
  • On a machine where the wrapper cannot run, the orchestrator dispatches one after the other the subagents that run a heavy command. Subagents that run no heavy command can run together.
  • The README says what a session with no project memory costs, in place of the claim that the queue still protects the machine.
  • The tests of the wrapper lose 14 comments that described the next line.

Related

Testing

The suite of the wrapper has 193 tests and passes on this machine, three times in sequence. Three tests for the first measurement and one for SIGQUIT failed before the change: a second bounded command ran beside a first measurement, and the quit signal left the command running.

The skill text was written against a baseline. Each test ran in a fresh agent that was told to read only the two skill files. The harness still shows such an agent the instructions of this repository, so the tests are a little easier than a project that never saw this plugin. On the text of main, an agent recorded a budget of 1024 MiB from a suite that stopped in the third of about 200 test files. For a wave of four subagents on a machine with no Python, an agent dispatched the full wave and named no means to keep two heavy commands apart.

On the new text, the first agent records nothing, measures again at the next run, and counts the result of the run. The second dispatches the subagents one after the other. In a third scenario a first measurement waits four minutes behind the build of a different session while the user says that memory is free: the agent keeps the run in the queue, does not lower the budget, does not run the plain command, and says why the run waits.

A cold read of the two files by a fresh agent found no pair of sentences with opposite orders on measurement, the wait, and dispatch. It answered one question wrongly, for a measurement with --memory that the hard cap stops, and the sentence for that case was corrected after the read. No agent read that last sentence.

The JSON in .claude-plugin/ parses.

🤖 Generated with Claude Code

sourcehawk and others added 5 commits September 29, 2026 14:49
… the queue (#49)

A measurement with no budget took the default budget, a quarter of the machine, while the peak of the command was not known. Several sessions could measure several commands together, and with no hard cap nothing stopped them. Such a measurement now takes each slot of the queue. It waits for the free memory of the default budget only, because the memory of the full queue is seldom free.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The quit signal of the terminal ended the wrapper and not the command. On a system with no parent-death signal the command lived on, and the queue counted its slots as free.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…escribe the next line (#49)

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The text said that the queue still protects the machine with memory off. For a command that was never measured, on a machine with no hard cap, the default budget can be less than the command needs.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…only, and dispatch in sequence with no wrapper (#49)

An agent recorded the budget of a test suite that stopped at its first failure, in the third of about 200 files. The budget was too small and stayed in the record. The skill now takes a budget only from a run that did its full work, and says that a first measurement takes the whole queue.

With no wrapper, no lock makes subagents take turns, and the skills gave the orchestrator no means to keep two heavy commands apart. The subagents that run a heavy command are now dispatched one after the other.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings September 29, 2026 13:59

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

The capped startup path can still swallow SIGQUIT before the command starts.

Review effort: Balanced
Findings: 1 High severity

Open (1)
What changed in this PR

This PR strengthens heavy-command isolation and fallback behavior.

Changes:

  • Runs first measurements exclusively while retaining default-budget memory waits.
  • Forwards SIGQUIT and serializes heavy subagents without the wrapper.
  • Updates guidance and expands wrapper tests.
File Description
README.md Clarifies behavior without project memory.
skills/​bounding-heavy-commands/​SKILL.md Updates measurement and fallback rules.
skills/​fanning-out-with-worktrees/​SKILL.md Specifies sequential fallback dispatch.
skills/​bounding-heavy-commands/​scripts/​bounded_run.py Adds exclusive measurement and SIGQUIT handling.
skills/​bounding-heavy-commands/​scripts/​tests/​test_bounded_run.py Covers measurement queuing and SIGQUIT.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

…fore the capped command runs (#49)

The process inside the cap took a stop signal and did nothing with it. A signal that came before the command existed was lost, and the command ran to its end. The process now sends that signal to the command after the start, and SIGKILL when more than one came.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings September 29, 2026 14:04

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

The implementation, tests, and skill guidance consistently address the linked issue’s acceptance criteria.

Review effort: Balanced
Findings: None

Resolved since last review (1)

@sourcehawk
sourcehawk merged commit bca2fa1 into main Sep 29, 2026
6 checks passed
@sourcehawk
sourcehawk deleted the fix/bounded-first-measurement branch September 29, 2026 14:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

First measurements and the no-wrapper fallback can still overload the machine

2 participants