Skip to content

feat(skills/bounding-heavy-commands): record a measured row per --cpus for each self-bounded command - #62

Merged
sourcehawk merged 9 commits into
fix/queue-line-lockfrom
feat/bound-before-measure-table
Sep 30, 2026
Merged

sourcehawk merged 9 commits into
fix/queue-line-lockfrom
feat/bound-before-measure-table

Conversation

@sourcehawk

@sourcehawk sourcehawk commented Sep 30, 2026 •

Copy link
Copy Markdown
Owner

Description

Closes #53

Agents measured heavy commands without bounding them first, so the record held budgets for commands that nothing limited: the same test suite got a budget of 10752M from a plain run where the bounded run needed 6656M. Discovery now makes the command bound its own parallelism before it is measured, and each record entry holds a required self-bound field and a table with one measured row per --cpus value. A measurement at a new --cpus adds a row instead of replacing the entry, and a row at a smaller --cpus becomes the correct way to make a run start sooner.

Changes

  • Discovery: bounding the command is a gate before any measurement. The first measurement is at half the machine's processors.
  • The record entry has a required self-bound field (none: <why> when the tool has no setting) and a table of rows (--cpus, budget, peak, date, default). An entry without self-bound is incomplete and gets discovery again. An entry of the older shape is complete only when its command line passes --cpus and reads BOUNDED_RUN_CPUS; it is then rewritten into the new shape.
  • One row per --cpus. A new --cpus adds a row, and the same --cpus replaces its row. Two entries whose command lines differ only in --memory and --cpus merge into one entry with the rows of both, and a new default row does not make the rows of an entry invalid.
  • To start sooner, use a row at a smaller --cpus: that is a smaller measured command, not a lower budget. This applies only to a command whose self-bound reads BOUNDED_RUN_CPUS, and the smaller row starts sooner only when its budget needs fewer slots. With no smaller row, the run stays queued, and the smaller row is measured for next time with its own --cpus and the --memory of the smallest row, so the measurement does not take the whole queue.
  • Dispatch prompts carry the chosen row's --cpus and budget. Three new red-flag rows cover measuring the plain command, replacing a row of another --cpus, and treating a smaller row as a lower budget.

Related

Testing

A RED and GREEN check with fresh agents that read only the skill. In the baseline, an agent picked --cpus 16 by itself and, when merging with another session's entry at --cpus 8, kept one entry and dropped the other. A second agent, asked to make a run start sooner, refused to use a smaller --cpus and threw away a finished measurement at --cpus 4. With the change, the first agent bounded the command, measured at half the processors, and merged the entries into one table with both rows. The second kept the run queued, measured the smaller row with --memory of the existing row, and added it without changing the default row. The skill text was also checked for hard wraps and for product names.

🤖 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

Record identity, migration, invalidation, and follow-up measurement instructions can preserve or create incorrect rows.

Review effort: Balanced
Findings: 2 High severity · 1 Medium severity

Open (3)
What changed in this PR

Updates heavy-command guidance so measurements use self-bounded commands and retain budgets per CPU count.

Changes:

  • Defines the new record schema and row-merging rules.
  • Requires self-bounding before measurement.
  • Adds smaller-CPU row and subagent dispatch guidance.
File Description
skills/​bounding-heavy-commands/​SKILL.md Revises discovery, recording, measurement, and dispatch behavior.

💡 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
Comment thread skills/bounding-heavy-commands/SKILL.md Resolved
Comment thread skills/bounding-heavy-commands/SKILL.md Resolved
Copilot AI balanced review requested due to automatic review settings September 30, 2026 00:58
@sourcehawk
sourcehawk force-pushed the feat/bound-before-measure-table branch from a1840b8 to 66cfd45 Compare September 30, 2026 00:58
@sourcehawk

Copy link
Copy Markdown
Owner Author

Review round on a1840b8 (review 5360217072). No suppressed findings.

  • Use row-independent fields for merge identity (and line 79): applied in 66cfd45.
  • Pass the computed CPU quota to follow-up measurements: applied in 66cfd45.
  • Require self-bound completeness before migration: applied in 66cfd45 as a narrower exception (BOUNDED_RUN_CPUS required). See the thread.

Comment gate (comment_growth.py): the recorded review base left the history in the rebase after the #58 fix, so the gate compared with the parent branch. The self-evaluated fallback applies: this session could not dispatch an agent. This round added, changed, or removed no code comment, so there is no flag of this round. The only flag on #64 is the module usage text, which the PR grew before the review to document --check. That is text that users read, and it stays as it is.

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

Record merging, completeness, failed measurements, and smaller-row selection remain ambiguous or incorrect.

Review effort: Balanced
Findings: 1 Medium severity

Open (1)
Resolved since last review (3)

Comment thread skills/bounding-heavy-commands/SKILL.md Resolved
Copilot AI balanced review requested due to automatic review settings September 30, 2026 01:12
@sourcehawk
sourcehawk force-pushed the feat/bound-before-measure-table branch from 66cfd45 to bf657a6 Compare September 30, 2026 01:12
@sourcehawk

Copy link
Copy Markdown
Owner Author

Review round on 66cfd45 (review 5360280728). No suppressed findings.

  • Define deterministic default-row conflict resolution during merges: applied in bf657a6.

Comment gate: this round added, changed, or removed no code comment on this layer. Self-evaluated fallback: this session could not dispatch an agent.

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 updated skill consistently implements the linked issue’s measurement and record requirements without unresolved defects.

Review effort: Balanced
Findings: None

Resolved since last review (1)

Copilot AI balanced review requested due to automatic review settings September 30, 2026 01:22
@sourcehawk
sourcehawk force-pushed the feat/bound-before-measure-table branch from bf657a6 to c12cbcf Compare September 30, 2026 01:22

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

Smaller CPU values do not always reduce queue reservations, creating an unsafe budget assumption.

Review effort: Balanced
Findings: 1 Medium severity

Open (1)

Comment thread skills/bounding-heavy-commands/SKILL.md Resolved
@sourcehawk
sourcehawk force-pushed the feat/bound-before-measure-table branch from c12cbcf to aa40156 Compare September 30, 2026 01:32
Copilot AI balanced review requested due to automatic review settings September 30, 2026 01:32
Copilot AI balanced review requested due to automatic review settings September 30, 2026 01:52
@sourcehawk

Copy link
Copy Markdown
Owner Author

Review round on b71cad1 (review 5360529262). No suppressed findings.

  • Require exactly one matching default row in completeness checks: applied in 6f2211e.

Comment gate: no code comment changed on this layer.

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

Row identity and follow-up measurement rules can preserve invalid data or under-reserve memory.

Review effort: Balanced
Findings: 2 Medium severity

Open (2)
Resolved since last review (1)

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

Copy link
Copy Markdown
Owner Author

Review round on 6f2211e (review 5360589840). No suppressed findings.

  • Scope ignored options to wrapper arguments before --: applied in ccb9cbf.
  • Reserve the full queue for unmeasured CPU rows: partly applied in ccb9cbf. The false guarantee is gone, and the whole-queue measurement is declined. See the thread.

Comment gate: no code comment changed on this layer.

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

🔵 Needs a closer look

Merging a newer default-CPU measurement can leave the stored command inconsistent with its default row.

Review effort: Balanced
Findings: None

Resolved since last review (2)
Previously missed (1)

In code that hasn't changed since last review

Low severity Synchronize command with merged default measurement

skills/​bounding-heavy-commands/​SKILL.md:71

When the other entry has a newer measurement at the kept entry's default --cpus, keep the newer one changes that row's budget but leaves the kept command field with its old --memory. The merged entry then immediately fails the completeness rule on line 73. After merging, synchronize the command line with the resulting default row.

Copilot AI balanced review requested due to automatic review settings September 30, 2026 02:04
@sourcehawk

Copy link
Copy Markdown
Owner Author

Review round on ccb9cbf (review 5360615074). The review has no inline findings.

  • Previously missed, on SKILL.md:71, "Synchronize command with merged default measurement" (no thread): applied in 1f84f8a. After the merge, the rule now says: "Then write the --cpus and the budget of the default row into the command line."

Comment gate: no code comment changed on this layer.

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

🔵 Needs a closer look

The legacy migration can mistake a payload --cpus argument for the wrapper’s CPU setting.

Review effort: Balanced
Findings: None

Previously missed (1)

In code that hasn't changed since last review

Medium severity Restrict migration exception to wrapper --cpus option

skills/​bounding-heavy-commands/​SKILL.md:73

Scope the migration exception to the wrapper option before the -- delimiter. Payload options are allowed after the delimiter (scripts/tests/test_bounded_run.py:1241-1245), so an old line can currently contain a payload --cpus and read BOUNDED_RUN_CPUS while the wrapper itself has no CPU value; in that case the variable falls back to the machine CPU count and there is no recorded --cpus for the default row. Require --cpus <n> in the wrapper options explicitly.

Copilot AI balanced review requested due to automatic review settings September 30, 2026 02:10
@sourcehawk

Copy link
Copy Markdown
Owner Author

Review round on 1f84f8a (review 5360649839). The review has no inline findings.

  • Previously missed, on SKILL.md:73, "Restrict migration exception to wrapper --cpus option" (no thread): applied in 7892ccf. The rule now reads "its command line passes --cpus to the wrapper, before the --, and reads BOUNDED_RUN_CPUS".

Comment gate: no code comment changed on this layer.

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 updated workflow consistently enforces bounded measurement and preserves measurements across CPU configurations.

Review effort: Balanced
Findings: None

sourcehawk and others added 9 commits September 30, 2026 11:21
… measured, and keep a row per --cpus

Agents skipped the step that makes a recorded command bound its own parallelism. It was one of six discovery steps, nothing blocked a measurement until it was done, and an entry without a self-bound looked complete. So a session could measure the plain command, record the peak of a command that nothing limits, and later runs waited for twice the slots they needed. Baseline runs also showed that an agent picked the first --cpus by itself, kept only one of two entries measured at different --cpus, and refused a smaller --cpus as if it were a lowered budget, which threw away a finished measurement.

Discovery now bounds the command first, as a gate, and measures the bounded line at --cpus of half the machine's processors. Each record entry has a required self-bound field and a table with one row per --cpus: a new --cpus adds a row, the same --cpus replaces its row, and one row is the default. A row at a smaller --cpus is the way to start sooner. When none exists, the run stays queued and the smaller row is measured under the budget of the smallest row for next time.

Closes #53

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…out the row values, and pass --cpus to a smaller row

The command line of an entry carries the --memory and --cpus of its default row. So two entries of one command with different default rows did not merge, and a change of the default row read as a new command whose rows must be deleted. Both rules now ignore those two values. The measurement of a smaller row now names its --cpus and --memory in place of the values of the command line; before, it named only --memory, and the run used the --cpus of the default row. An entry of the older shape is complete only when its command line reads BOUNDED_RUN_CPUS, because a memory setting alone can be one that covers a single process, which discovery does not accept as a bound.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ntry keeps

Two entries of one command can each have a default row, and the merge rule kept the rows of both without saying which default stays. The merged entry now keeps the default row of the entry that the agent keeps, at its --cpus, and marks no other row.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…oner only when the command reads it

A smaller --cpus makes a smaller command only when the self-bound of the entry reads BOUNDED_RUN_CPUS. For a command with self-bound none, or with a memory setting only, the smaller row measured the same command and did not start sooner. The skill now keeps such a run in the queue and measures no smaller row for it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…oner only when it needs fewer slots

The queue counts a budget in whole slots, so a smaller row whose budget needs as many slots as the default row waits as long. The skill said that a smaller row always gets a slot sooner.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ches the command line in a complete entry

A complete entry needed only a self-bound and a row, but case 2 runs the default row of the entry. An entry with no default row, or with two, had no row to run, and one whose default row did not match its command line had two values for one run.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…to the wrapper, and do not promise a bound for a smaller row

The merge rule and the change rule ignored every --memory and --cpus of the command line, also those of the command after the '--', which can be real options of the tool. They now name the wrapper's two values only. The skill also said that a smaller row never needs more than the budget of the smallest row. A command can keep more state when it does its work in sequence, so the text now says "seldom" and points to the rule for a measurement that the hard cap stops.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ommand line after a merge

A merge keeps the newer row at each --cpus, so the default row can get the budget of the other entry while the command line keeps the old --memory. The entry was then incomplete by its own rule. The merge now ends by writing the values of the default row into the command line.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…from the wrapper options only

An old command line can hold a --cpus of the tool after the '--'. The migration rule counted it, but the wrapper then had no --cpus, BOUNDED_RUN_CPUS was the processor count of the machine, and the default row had no --cpus to record. The rule now needs --cpus in the wrapper options.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sourcehawk
sourcehawk force-pushed the feat/bound-before-measure-table branch from 7892ccf to 10218b5 Compare September 30, 2026 10:22
@sourcehawk
sourcehawk merged commit da90c20 into main Sep 30, 2026
5 checks passed
@sourcehawk
sourcehawk deleted the feat/bound-before-measure-table 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.

Require each recorded heavy command to bound its own parallelism before it is measured

2 participants