Skip to content

fix(skills/bounding-heavy-commands): stop a first measurement from blocking every session where the hard cap protects the machine - #66

Merged
sourcehawk merged 1 commit into
feat/queue-checkfrom
fix/first-measure-default-budget
Sep 30, 2026
Merged

sourcehawk merged 1 commit into
feat/queue-checkfrom
fix/first-measure-default-budget

Conversation

@sourcehawk

@sourcehawk sourcehawk commented Sep 30, 2026 •

Copy link
Copy Markdown
Owner

Description

Fixes #60

A first measurement (--measure with no --memory) reserved the whole queue, so while it ran, often for many minutes, no other heavy command on the machine could start, even when it used a small part of that memory. On Linux the hard cap already protects the machine from a command whose peak is not known, so a first measurement now runs with the default budget (a quarter of the machine's memory) where the cap is available, and takes the whole queue only where there is no cap. A command that needs more than the default budget is now stopped by the cap on its first measurement and is measured again at twice the budget. That costs one extra run, and the other sessions no longer wait for it.

Changes

  • With the hard cap, --measure with no --memory reserves the slots of the default budget and runs under a cap of that budget. Without the cap it still takes the whole queue.
  • --measure-rows follows the same rule for its largest row.
  • The skill's text about first measurements, discovery step 5 (what to do when the cap stops a measurement), the whole-project measurement, two red-flag rows, and one line of the README now say this.

Related

Testing

TDD. A new in-process test class checks the slots reserved, BOUNDED_RUN_MEMORY_MIB, and the cap for --measure and for the largest row of --measure-rows, each with and without the cap. The two tests with the cap failed before the change, because they got all the slots. The full suite 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

🟢 Approval recommended

The implementation matches the issue’s acceptance criteria and includes focused automated coverage.

Review effort: Balanced
Findings: None

What changed in this PR

This PR prevents capped first measurements from monopolizing the heavy-command queue.

Changes:

  • Uses the default budget when a hard cap is available.
  • Preserves whole-queue reservation without a cap.
  • Adds tests and updates user guidance.
File Description
bounded_run.py Selects reservation size after probing cap availability.
test_bounded_run.py Covers measurement behavior with and without caps.
SKILL.md Updates measurement workflow guidance.
README.md Clarifies first-measurement queue behavior.

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

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 acceptance criteria and includes focused coverage for both cap paths.

Review effort: Balanced
Findings: None

@sourcehawk
sourcehawk force-pushed the fix/first-measure-default-budget branch from 52152f7 to 6aa78c6 Compare September 30, 2026 08:57
Copilot AI balanced review requested due to automatic review settings September 30, 2026 08:57

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 acceptance criteria and includes focused coverage for both cap conditions.

Review effort: Balanced
Findings: None

Copilot AI balanced review requested due to automatic review settings September 30, 2026 09:06
@sourcehawk
sourcehawk force-pushed the fix/first-measure-default-budget branch from 6aa78c6 to f27fd12 Compare September 30, 2026 09:06

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 focused implementation matches the acceptance criteria and includes comprehensive regression coverage.

Review effort: Balanced
Findings: None

…lding the whole queue where the hard cap protects the machine

A measurement with no --memory reserved every slot of the queue, so no other heavy command on the machine could start while it ran. Where the hard cap is usable, that buys no safety: a command that passes its budget is stopped with exit code 137 and the machine does not swap. One observed first measurement held a 20 GiB queue while it used under 1 GiB.

Where the cap is usable, a first measurement, and the largest row of --measure-rows with no --memory, now reserves the slots of the default budget and runs with that budget as its cap. Where there is no cap, it still takes the whole queue. The cap probe runs before this choice, with the default budget, which is the budget of the capped run.

The skill and the README now say which case takes the whole queue, and a first measurement that the cap stopped is measured again at two times the default budget, up to the whole queue.

Fixes #60

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sourcehawk
sourcehawk force-pushed the fix/first-measure-default-budget branch from f27fd12 to e675fc2 Compare September 30, 2026 10:22
@sourcehawk
sourcehawk merged commit fce95a1 into main Sep 30, 2026
10 checks passed
@sourcehawk
sourcehawk deleted the fix/first-measure-default-budget 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.

A first measurement blocks every other session even where the hard cap already protects the machine

2 participants