Skip to content

feat(work-ledger): let resource_status size the wave, not a fixed goal cap of 6 - #36312

Merged
KiroCrewCaptain merged 1 commit into
mainfrom
feat/goal-concurrency-default-store-bound
Nov 14, 2026
Merged

KiroCrewCaptain merged 1 commit into
mainfrom
feat/goal-concurrency-default-store-bound

Conversation

@iamwhatever

@iamwhatever iamwhatever commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: A goal conductor, Ultra Mode or Bot, sizes each dispatch wave by host resources (resource_status), not by a fixed cap of 6 open items.

Every goal board is capped at 6 open items (DEFAULT_GOAL_CONCURRENCY_CAP in src/kiro_crew/work_ledger_records.py). The 6 was never measured and does not follow the host. The refusal text tells the conductor to "ask the user" to raise it, while the conductor prompts say "never ask to raise it". The Bot conductor's rules never mention resource_status at all.

Why it matters

A fixed 6 holds back a healthy host and does nothing for a starved one. The owner asked to stop micro-managing with a number and rely on resource probing.

Not a goal

What changed (motivation → approach → change)

Fixed number below the store bound → drop the default to the store's own bound and let a prompt rule read the host → change:

  • work_ledger_records.py: DEFAULT_GOAL_CONCURRENCY_CAP = MAX_ITEMS_PER_CONDUCTOR (32). With no user bound, the store's open bound refuses first (item_cap_exceeded); a user-set concurrency_cap=N still refuses goal_concurrency_cap_reached.
  • Refusal text (work_ledger_writes.py) and the concurrency_cap schema description (mcp_work.py): wait for a seat, do not ask to raise it.
  • New shared rule resource_wave in _LEDGER_CONDUCTOR_RULES (agent_parts/spec_prompts.py), rendered into the root charter and into the Bot's conductor.patrol piece (crewmate_prompts.json): call resource_status before a wave; ample dispatches every ready item, tight or unknown dispatches one and queues the rest, critical dispatches none.
  • patrol_ends (agent_parts/spec_prompts.py): the patrol ends only when every ledger item is terminal and nothing is queued, so a goal with queued work keeps its loop armed. The same clause goes into the shared patrol_final_report rule and the gateway's default PATROL_MESSAGE (conductor_patrol.py); the previous patrol text stays in SHIPPED_PATROL_MESSAGES, so loops already armed with it still pass the fire-time check (test_the_patrol_stays_open_while_work_is_queued_and_old_loops_still_pass). test/fixtures/crewmate_prompts/ledger.golden.txt refreshed with scripts/crewmate_prompt_preview.py --fixture ledger --write.
  • "At most 6 open" prose replaced with "resource_status decides the wave; a bound the user set is concurrency_cap" in spend_bounded, the Concurrency cap bullet of builtin_skills/goal-conductor/SKILL.md, and docs/work-ledger.md.

Decision record: docs/request-for-change/rfc-work-ledger-concurrency-cap.md §7 (status partial), merged to main in #36304.

The Bot conductor can call resource_status: it is in _CONDUCTOR_CORE_GRANTS (agent_parts/spec_grants.py), and test_the_root_conductors_surface_is_on_the_crewmates in test_mate_conductor_parity.py holds every root-conductor grant on the crewmate's conductor too. This PR does not depend on the host_pressure record.

Backwards compatibility

Compatible: the default only rises (6 to 32, inside the existing 1..32 range) for boards with no stored cap; every stored cap, an old default 6 included, reads and refuses as before (RFC §7.2, no migration).

Removes nothing: the field, its validation, the refusal code and the 409 mapping all stay; only the default value and prompt wording change.

Tests

Proof: not provable -- other: default constant plus prompt text; the updated tests pin the new default

  • test_work_ledger_caps.py: test_with_no_user_bound_the_goal_cap_is_the_stores_open_bound (32 open, the 33rd refused item_cap_exceeded); test_a_user_set_concurrency_cap_refuses_past_it_and_says_wait (user cap 6 refuses, message says "wait for a seat" and not "ask the user"). Tests that relied on the old default now set a user cap of 6. test_a_stored_cap_is_kept_across_goals_and_never_migrated pins RFC §7.2: a stored 6 reads as 6, and a set cap (6 and 2) survives a reword and a new goal.
  • test_agent_refactor_spec_bytes.py: conductor and ledger-conductor spec digests re-pinned from CI's printed digests (prompt text changed).
  • test_conductor_agent.py: the charter and skill carry "resource_status decides the wave" and no "at most 6".
  • test_mate_conductor_parity.py: the new shared rule resource_wave maps to its goal-conductor SKILL anchors in ULTRA_SKILL_ANCHORS; the existing test proves it reaches the Bot conductor.
  • test_agent_refactor_contracts.py: _CONDUCTOR_SYSTEM_PROMPT digest updated for the new text.

Locally (flock, -n 2): the work-ledger, conductor, crewmate, mcp_work and parity test files, 787 + 150 + 68 passed.

Manual verification

N/A — unit coverage sufficient: a constant and prompt text; the parity test renders the Bot conductor text.

Known limit (RFC §7.2): an upgraded board that already stored the old default 6 keeps 6 until a goal write names a cap (work_ledger_record action=goal concurrency_cap=<N>) or the board is replaced; nothing on its header tells that 6 apart from a user who chose 6, so no read migrates it. New boards start at 32.

Related Issues

Part of #36301

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

@iamwhatever
iamwhatever requested review from a team and KiroCrewCaptain as code owners November 13, 2026 02:21
@iamwhatever
iamwhatever requested a review from buluoray November 13, 2026 02:21
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Nov 13, 2026
@github-actions

github-actions Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ⏭️ skipped

Revision 241423efcad768c64170774c46c4b12b9b83042e touches no user-facing surface (no changes under website/ or committed screenshots), so the UX review was skipped. Does not block merge.

@github-actions

github-actions Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

Design-level review of 241423efcad768c64170774c46c4b12b9b83042e — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

Design-Verdict: PASS

Nothing blocks. The change follows the owner's decision in RFC §7.2, and raising the default from 6 to 32 is easy to undo.

Notes

  • For now, only the prompt holds back a goal's fan-out. A conductor that skips resource_status can open 32 items at once, until the code-level gate from the pressure RFC (docs(rfc): drop the fixed goal concurrency default; host pressure wakes the conductor #36304) lands. That RFC's §7.3 names this gap, so linking the follow-up PR here would make the order explicit.
  • Boards that already stored the old default of 6 keep it, and nothing tells them apart from a user who chose 6. The conductor sees a cap of 6 and is now told "never ask to raise it", so those boards stay throttled with no visible way out. The refusal text could name the board-replacement escape the description gives.

[DESIGN-REVIEWED] 241423e

Description read

[DESCRIPTION-READ] 7998407a62cb4621e6e09dc2798ea86043c7ac67aebcdd939181f871d5f34035

That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of 241423efcad768c64170774c46c4b12b9b83042e — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

First-Principles-Verdict: PASS

Nothing blocks: the default change is the shape §7.2 of the base RFC rfc-work-ledger-concurrency-cap.md (status partial, §7 not yet built) records, and the pressure signal §7.3 requires first is already on base.

What this change ships

Inventory (7 items) — 7 justified

Intent: let a goal conductor size each dispatch wave from host resources instead of a fixed six-open-item cap. ADDITION.

  1. With no cap set by the user, a goal can hold up to 32 open items instead of 6 — justified
  2. The cap-reached refusal says "wait for a seat" instead of "ask the user to raise it" — justified
  3. The concurrency_cap tool description now reads as a bound the user sets, default 32 — justified
  4. Ultra Mode and Bot conductors call resource_status before a wave: ample dispatches all, tight or unknown dispatches one, critical dispatches none — justified
  5. The patrol stops only once nothing is queued, in the charter, the Bot prompt and the gateway default patrol — justified
  6. Loops armed with the old patrol text still pass the fire-time check — justified
  7. The "at most 6 open" wording is gone from the skill, user docs and the spend rule — justified

[FIRST-PRINCIPLES-REVIEWED] 241423e

Description read

[DESCRIPTION-READ] f2c8f24a38749a55d298ee2c3f2d325ce285aa4ef0d623ac21ac21aff2ead6e3

That sha256 names the PR description this verdict read. Recompute it with .github/scripts/pr-description-capture.sh; if it differs, the description changed after this verdict was formed and any finding drawn from the description is unproven.

@github-actions

github-actions Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed 241423efcad768c64170774c46c4b12b9b83042e — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 241423e

Verdict parsed from the review's SHA-scoped output markers for commit 241423efcad768c64170774c46c4b12b9b83042e.

False positive or not applicable? A repository writer can comment:
/ai-review override fable 241423efcad768c64170774c46c4b12b9b83042e false-positive: <reason, 20 to 500 characters>

@github-actions

github-actions Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of 241423efcad768c64170774c46c4b12b9b83042e and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 241423e

False positive or not applicable? A repository writer can comment:
/ai-review override gpt 241423efcad768c64170774c46c4b12b9b83042e false-positive: <reason, 20 to 500 characters>

@iamwhatever
iamwhatever force-pushed the feat/goal-concurrency-default-store-bound branch 3 times, most recently from fac851a to 3f583fc Compare November 13, 2026 05:31
@KiroCrewCaptain

KiroCrewCaptain commented Nov 13, 2026 •

Copy link
Copy Markdown
Collaborator

Code change approver recommendation: A person should decide

Why: the decider raised 2 possible problems and estimates a 55% chance that this change introduces a defect; a person should check them.

The code change is sound: the default goal concurrency cap rises to the store's bound of 32, user-set caps and stored values are kept, the refusal text is fixed, and the host-pressure code the RFC depends on has already shipped. But the new resource_wave rule queues work outside the ledger on tight/unknown hosts. The 'nothing is queued' stop clause added to keep the patrol armed is missing from the goal-conductor skill's Stop conditions (SKILL.md:631, :870), which both the Ultra Mode and Bot conductors are told to follow. The round-close reset also records only open items, so the queue can be lost. The same stop-rule class the earlier review flagged is fixed on only some of its sites, so the PR's goal holds only on some paths. Requesting changes.

Things to check (possible problems the decider raised; at this confidence many turn out to be fine):

  • The PR's stated change is that the patrol ends only when every ledger item is terminal AND nothing is queued, because the new resource_wave rule (tight/unknown: dispatch one, queue the rest) keeps queued work outside the ledger. The clause was added to patrol_ends, patrol_final_report and PATROL_MES (src/kiro_crew/builtin_skills/goal-conductor/SKILL.md, medium)
  • The queue the new resource_wave rule creates exists only in the conductor's chat. The round-close reset the charter and skill require records only open items in next, so queued items are not carried across the reset unless the conductor happens to keep them in the goal Plan. The prompt never says (src/kiro_crew/agent_parts/spec_prompts.py, low)

An automated recommendation, not a review: a maintainer still decides. It approves on its own only when the estimated chance of a defect is at most 12% and the change has at most 400 changed lines. Decider v3c (217fe607) · commit 68f0227bba · 239 changed lines. If this recommendation is wrong, reply here: replies are how the approver is evaluated.

@iamwhatever
iamwhatever force-pushed the feat/goal-concurrency-default-store-bound branch from 3f583fc to cac35d6 Compare November 13, 2026 05:50
@iamwhatever

Copy link
Copy Markdown
Contributor Author

Disposition (target=opus, gpt): fixed in cac35d6.

Finding class: an old stored default of 6 was indistinguishable from a cap the user set, so any value-based reset either kept the old 6 (Opus, 58c951b), erased a user cap on new_goal (GPT, fac851a), or erased a user-set 6 (Opus, 3f583fc).
Fix: the value-based reset is removed. ConductorRecord gains concurrency_cap_set, written True only by a goal write that passes concurrency_cap. A header without the flag reads its cap as DEFAULT_GOAL_CONCURRENCY_CAP; a set cap (6 included) is kept across rewords and new goals. The cache rebuild in work_ledger.py carries the flag.
Test: test_an_old_stored_default_reads_as_the_default_and_a_set_cap_is_kept (old 6 without the flag reads as default; set caps 6 and 2 survive a reword and a new goal).

  • self-added: yes
  • mechanism: concurrency_cap_set header flag replaces the round-1 value-based reset

@iamwhatever
iamwhatever force-pushed the feat/goal-concurrency-default-store-bound branch from cac35d6 to 7e753fe Compare November 13, 2026 06:26
@iamwhatever

Copy link
Copy Markdown
Contributor Author

Disposition (target=opus, gpt; head cac35d6 findings at work_ledger_records.py:333): fixed in 7e753fe, with one case put to the maintainer.

Fixed: a header from before the concurrency_cap_set flag now keeps any valid stored cap other than 6 and marks it set (from_dict). A legacy cap of 3 or 2 is no longer replaced by 32. Test: test_an_old_stored_default_reads_as_the_default_and_a_set_cap_is_kept asserts from_dict({concurrency_cap: 3}) == (3, set).
Left as the PR's goal: a legacy header holding exactly 6 reads as the new default. Every header before this PR stored the cap and the old default was 6, so a legacy 6 is almost always that default; nothing on the header separates it from a user who chose 6. Keeping it as 6 would leave every upgraded board capped at 6, which is the behaviour this PR removes (issue #36301).

  • needs-a-decision: maintainer, confirm that a legacy unmarked 6 reads as the default (recorded as a known limit in the PR body), or rule that it stays 6.
  • self-added: yes
  • mechanism: legacy-header migration in ConductorRecord.from_dict

@iamwhatever

Copy link
Copy Markdown
Contributor Author

Disposition (target=gpt; work_ledger_records.py:333, legacy unmarked cap of 6): rebutted, by ruling.

Ruling (conductor, on the repository owner's direction in #36301: stop micro-managing with a fixed number): an unmarked legacy header that stores exactly 6 reads as the default, 32.
Why not a defect: every header before this PR stored the cap, and the old default was 6. On an unmarked header a stored 6 cannot be told apart from that default. Keeping it as 6 would leave every upgraded board capped at 6, which is the behaviour this PR exists to remove.
Every other valid legacy cap (for example 2 or 3) is kept and marked set (fixed in 7e753fe; test_an_old_stored_default_reads_as_the_default_and_a_set_cap_is_kept).
Recovery for a user who really wanted 6: work_ledger_record action=goal concurrency_cap=6 sets it again and marks it set, so it then survives rewords and new goals. Recorded as a known limit in the PR body.

  • self-added: yes
  • mechanism: legacy-header migration in ConductorRecord.from_dict

@iamwhatever

Copy link
Copy Markdown
Contributor Author

Disposition target=gpt span=c8fd8056d86e (head 7e753fe, work_ledger_records.py:328): rebutted by ruling, same class as issuecomment-6845926570.

An unmarked legacy header storing exactly 6 reads as the default 32, by the conductor's ruling on the owner's direction in #36301 (stop micro-managing with a fixed number).
Every header before this PR stored the cap and the old default was 6, so an unmarked 6 cannot be told apart from that default; keeping it would leave every upgraded board capped at 6, the behaviour this PR removes.
Every other valid legacy cap is kept and marked set. Recovery for a user who wanted 6: work_ledger_record action=goal concurrency_cap=6, recorded as a known limit in the PR body.

  • self-added: yes

@iamwhatever
iamwhatever force-pushed the feat/goal-concurrency-default-store-bound branch from 7e753fe to fb93fa4 Compare November 13, 2026 07:09
@iamwhatever

Copy link
Copy Markdown
Contributor Author

Disposition target=first-principles span=b427d211bd59: fixed (decision record now on main).

The block asked for an accepted RFC for the product-shape change (goal concurrency default 6 -> 32, refusal says wait for a seat instead of ask the user).
That decision is now on main: docs/request-for-change/rfc-work-ledger-concurrency-cap.md §7 (Amendment 2026-11-13: no fixed default; resources decide the wave), merged in #36304, RFC status partial. This PR builds §7.
Head fb93fa4 is rebased onto main after #36304 merged, so the review reads the RFC from the base.

@iamwhatever
iamwhatever force-pushed the feat/goal-concurrency-default-store-bound branch 2 times, most recently from 6c0a83c to fb628ee Compare November 13, 2026 07:56
@iamwhatever

Copy link
Copy Markdown
Contributor Author

Dispositions for head fb628ee (RFC §7.2 compatibility):

target=first-principles span=b427d211bd59 -- fixed.

The block said the concurrency_cap_set flag and the legacy-6 reinterpretation reverse RFC §7.2 (a board that stored 6 keeps 6; no migration).
fb628ee removes both: no flag, no from_dict migration, no reset on new_goal. ConductorRecord reads the stored cap exactly as on base. Only DEFAULT_GOAL_CONCURRENCY_CAP changes, so new boards start at 32.
Test: test_a_stored_cap_is_kept_across_goals_and_never_migrated (stored 6 reads 6; set caps 6 and 2 survive a reword and a new goal). Known limit in the body: old boards keep 6 until a goal write names a cap.

target=gpt span=c8fd8056d86e -- fixed.

The finding asked to preserve legacy caps, 6 included, across upgrades. With the migration removed every stored cap is read unchanged, so no explicit bound is discarded.

target=fable (Opus, §7.3 ordering) -- accepted, by merge order.

This PR lands after the host_pressure PR (RFC §7.3, item it_2467a769); the PR body says so. The owner merges in that order, and this PR is rebased once that PR is on main.

  • self-added: yes
  • mechanism: removed (flag and legacy migration from earlier rounds)

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Nov 13, 2026
@github-actions github-actions Bot added merge conflict Branch has merge conflicts with its base — author must resolve before merge and removed readiness: action required A blocking check or review needs attention labels Nov 13, 2026
@github-actions github-actions Bot added the readiness: passed Eligible automated validation passed for the current revision label Nov 13, 2026
@iamwhatever
iamwhatever force-pushed the feat/goal-concurrency-default-store-bound branch from fb628ee to 923e2e9 Compare November 14, 2026 08:23
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: passed Eligible automated validation passed for the current revision merge conflict Branch has merge conflicts with its base — author must resolve before merge labels Nov 14, 2026
@iamwhatever
iamwhatever force-pushed the feat/goal-concurrency-default-store-bound branch from 923e2e9 to 68f0227 Compare November 14, 2026 09:06
@iamwhatever

Copy link
Copy Markdown
Contributor Author

Disposition target=fable (Opus, head 923e2e9, spec_prompts.py:174, queued work ends the patrol): fixed in 68f0227.

The finding: resource_wave queues items outside the ledger, but patrol_final_report (both conductors) and the gateway PATROL_MESSAGE still stopped the patrol once every ledger item was terminal; only patrol_ends had the queue clause.
Fix: patrol_final_report and PATROL_MESSAGE now stop only when every item is terminal and nothing is queued, matching patrol_ends. The previous PATROL_MESSAGE stays in SHIPPED_PATROL_MESSAGES so loops armed with it still pass the fire-time check.
Test: test_the_patrol_stays_open_while_work_is_queued_and_old_loops_still_pass. Spec digests and ledger.golden.txt re-pinned.
Note (RFC header saying 7 is not built): the RFC is a separate docs file this PR does not edit; its status line moves with the RFC owner.

  • self-added: no

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Nov 14, 2026
…l cap of 6

DEFAULT_GOAL_CONCURRENCY_CAP becomes MAX_ITEMS_PER_CONDUCTOR (32); the
concurrency_cap field stays for a bound the user sets. The refusal says to
wait for a seat instead of asking to raise it. Both conductors carry a shared
resource_wave rule, so the Bot conductor reads resource_status before a wave.
@iamwhatever
iamwhatever force-pushed the feat/goal-concurrency-default-store-bound branch from 68f0227 to 241423e Compare November 14, 2026 11:03
@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: action required A blocking check or review needs attention labels Nov 14, 2026
@KiroCrewCaptain
KiroCrewCaptain enabled auto-merge (squash) November 14, 2026 13:21

@KiroCrewCaptain KiroCrewCaptain left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This review checked head 241423e. DEFAULT_GOAL_CONCURRENCY_CAP now equals the store's open-item bound. A goal with no user cap is refused item_cap_exceeded at 33 open items. A cap the user set still refuses goal_concurrency_cap_reached. Stored caps, the old 6 included, are read unchanged with no migration, as RFC section 7.2 says, and test_a_stored_cap_is_kept_across_goals_and_never_migrated pins that. The new legacy entry in SHIPPED_PATROL_MESSAGES matches main's PATROL_MESSAGE byte for byte. The arm-time check still requires the current text exactly. The posture words in resource_wave match resource_status.
Done well: the old 6-cap tests now set an explicit USER_CAP=6, so the refusal, seat-freeing and concurrent-create tests keep their strength and do not quietly test 32.
The design is signed off under the standing maintainer sign-off for changes by team members.
Optional:

  • goal-conductor/SKILL.md:870 still ends the patrol when every ledger item is terminal, and its round-close reset (around line 691 to 705) can drop a queue that only the chat holds. #36298 has the matching lines. Consider naming the merge order in the body, or carrying the stop-condition clause here. round_close_reset in spec_prompts.py:409 could also say "or while anything is queued".
  • CONDUCTOR_MODE_SKILL_ANCHORS['patrol_final_report'] could add a "nothing is queued" anchor, so the parity test catches that SKILL drift.
  • _PATROL_MESSAGE_BEFORE_QUEUE (conductor_patrol.py:93) is built from the live constant. A frozen literal, like the older entry, would stay correct when someone later rewords the message.

@KiroCrewCaptain
KiroCrewCaptain merged commit f7a4bd5 into main Nov 14, 2026
99 of 104 checks passed
@KiroCrewCaptain
KiroCrewCaptain deleted the feat/goal-concurrency-default-store-bound branch November 14, 2026 13:22
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Nov 14, 2026
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