Skip to content

feat(skills/bounding-heavy-commands): give commands a default CPU quota and show processors in use in the check - #73

Merged
sourcehawk merged 2 commits into
fix/one-ctrl-c-stops-a-joined-linefrom
feat/default-cpu-quota
Sep 30, 2026
Merged

sourcehawk merged 2 commits into
fix/one-ctrl-c-stops-a-joined-linefrom
feat/default-cpu-quota

Conversation

@sourcehawk

@sourcehawk sourcehawk commented Sep 30, 2026 •

Copy link
Copy Markdown
Owner

Description

Towards #72

A bounded command run without --cpus had no CPU quota, and nothing showed how many processors the running bounded commands had asked for together. On a 16-processor laptop, --check from this PR read cpus=16 cpus-used=20 while a dozen agent sessions ran tests. A command without --cpus now runs under a default quota of half the machine's processors, and --check reports the processors in use, so an agent can prefer a row that fits. The queue still does not make a command wait for processors. That part of #72 stays open until batches of real builds show that it saves time.

Changes

  • A run without --cpus gets half the machine's processors (at least 1) as its CPUQuota under the cap, and as BOUNDED_RUN_CPUS everywhere. Before, BOUNDED_RUN_CPUS was all processors and there was no quota.
  • The --check state line gains cpus=<machine> cpus-used=<n|->: the sum of the quotas of the running bounded scopes, read from cpu.max, where max counts as all processors. Each held line gains cpus=<n|->.
  • Skill: the --cpus row states the default. The check format describes the new fields. The row-choice paragraph says to prefer the largest row that fits within cpus - cpus-used when two rows would both start.
  • Skill: the rule that each dispatch prompt carries gives a subagent the same fit check, so a subagent also prefers the largest row that would start and fits in cpus.

Related

Testing

TDD. New tests with fake cpu.max trees cover the rounded-up sum, max, skipped probe and other scopes, a scope that ends while it is read, and an unreadable quota. The check tests cover the new state and held fields. The run tests cover the default on 16, 7, and 1 processors and an explicit --cpus, the cap prefix with CPUQuota=800% by default, and a real wrapper process that gives the command half the processors. The full suite (332 tests) passes through the queue.

🤖 Generated with Claude Code

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 mandatory subagent dispatch rule does not include the new CPU-aware row-selection behavior.

Review effort: Balanced
Findings: 1 Low severity

Open (1)
What changed in this PR

Adds default CPU quotas and CPU usage visibility to bounded commands.

Changes:

  • Defaults runs to half the machine’s processors.
  • Reports CPU capacity and usage in --check.
  • Adds CPU-aware row-selection guidance and tests.
File Description
skills/​bounding-heavy-commands/​SKILL.md Documents CPU defaults, reporting, and row selection.
skills/​bounding-heavy-commands/​scripts/​bounded_run.py Implements quotas and CPU usage reporting.
skills/​bounding-heavy-commands/​scripts/​tests/​test_bounded_run.py Tests CPU defaults, quotas, and check output.

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

Comment thread skills/bounding-heavy-commands/SKILL.md Resolved
Copilot AI balanced review requested due to automatic review settings September 30, 2026 09:37
@sourcehawk

Copy link
Copy Markdown
Owner Author

Review round on 3a0fc92 (review 5364344709). No suppressed findings.

  • Propagate CPU-aware row selection to mandatory dispatch text: applied in c22540a.

Comment gate: no code comment changed.

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 matches the stated scope and has thorough cross-platform test coverage.

Review effort: Balanced
Findings: None

Resolved since last review (1)

sourcehawk and others added 2 commits September 30, 2026 11:22
…ta and show processors in the check

A bounded command without --cpus ran with no CPU quota and with BOUNDED_RUN_CPUS at every processor of the machine, so the commands of the queue together could ask for more processors than the machine has, and nothing showed how many were taken.

A run without --cpus now gets half the machine's processors, rounded down and at least 1: in BOUNDED_RUN_CPUS, and as its CPUQuota where the hard cap is available. This matches the --cpus of a command's first measurement. --measure-rows gives each row its own --cpus, so it is unchanged.

--check now prints cpus=<machine processors> and cpus-used=<sum of the quotas of the running bounded scopes, from cpu.max> on its state line, and cpus=<n> on each held line, so that an agent can choose a row that fits the free processors. The skill says to prefer such a row when two rows would start.

The admission of a command by processors stays open.

Towards #72

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… it chooses a row

The skill now prefers the largest row that would start and fits in the free processors, but the rule that each dispatch prompt carries still said to use the largest row with starts=yes. A subagent knows only the rule in its prompt, so it kept choosing a row that slows every running command. The dispatch rule now has the same fit check.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sourcehawk
sourcehawk force-pushed the feat/default-cpu-quota branch from c22540a to 4131ec2 Compare September 30, 2026 10:22
@sourcehawk
sourcehawk merged commit f026d43 into main Sep 30, 2026
5 checks passed
@sourcehawk
sourcehawk deleted the feat/default-cpu-quota branch September 30, 2026 10:23
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.

2 participants