Repository navigation
fix(bin): let scout brief write its own empty-inventory attestation - #7875
Conversation
Allow scouts to run only their generated complete --none command for an empty inventory, without granting metadata or backlog edit authority. Keep non-empty inventories and refused attestations with firstmate. Fork carry for kunchenguid#7862 pending upstream validation.
[Low impact] The PR appears safe to merge. Reviews (3) · Last reviewed commit: "no-mistakes(document): point lifecycle d..." · Reviewed by Greptile |
|
Speaking as Kun's firstmate: thank you @tiago-peixoto, this closes the gap from #7862 the way the issue asked. I read the tip contract-class: restore. The scout brief already told the scout to pass this completion gate on the default path, and rule 2 forbade the write the gate needs. This makes the two agree without widening anything else. The only red is |
|
Speaking as Kun's firstmate: quick CI note, nothing needed from you. The fresh run I started last pass ( contract-class stays restore. Once a current-base run is green and the PR is CLEAN, I'll merge. |
|
Speaking as Kun's firstmate: this is merged. Thank you @tiago-peixoto — really appreciate you taking the time on this. |
Intent
Fixes #7862.
Open the upstream pull request for #7862, "Scout brief forbids the write that its completion gate requires", now that Kun's side has labelled it ready-for-pr.
The problem: rule 2 of the scout brief generated by
bin/fm-brief.sh --scoutsays the only files the scout may write outside its worktree are the report and the status file.The same brief's definition of done tells the scout to pass the
captain-hold-lifecyclecompletion gate, which isbin/fm-captain-hold.sh complete <origin> (--none | <task-id>...).completewrites the completion attestation into the origin task's metadata in the home, which rule 2 does not allow.An obedient scout therefore costs the supervising firstmate an extra round before teardown, and a scout that writes it anyway learns that the write boundary is negotiable.
Expected: the scout brief's write boundary and its completion step agree.
Every read-only scout can finish and be torn down without an extra supervisor round, and without being told it may write anything beyond what the completion gate needs.
Quality criteria from the issue and Kun's side's triage:
--noneis still refused while the origin has an open keyed decision.fm-captain-hold.sh complete, rather than widening the scout's write rights in general.tests/fm-brief.test.shtest asserts that the scout brief's write boundary names that gate, so the two cannot drift apart again.How to verify: scaffold a scout brief with
bin/fm-brief.sh <id> <repo> --scout, read rule 2 and the definition of done side by side, and confirm they name one consistent path for the attestation.A scout with an empty captain-decision inventory then reaches a teardown that
verifyaccepts.What Changed
bin/fm-brief.sh --scoutrule 2 now names one extra outside-worktree write, the task's empty-inventory attestation throughfm-captain-hold.sh complete --none, and the Definition of done gives the scout that exact command for its own task id andFM_HOME, while telling it to defer a non-empty inventory to firstmate and to stop on a refusal instead of bypassing the gate..agents/skills/captain-hold-lifecycle/SKILL.mdanddocs/captain-hold-lifecycle.mdnow assign caller authority explicitly: firstmate runscompletefor held inventories, and a scout may attest only its own empty inventory through the brief-scoped command.tests/fm-brief.test.shaddstest_scout_completion_write_exception_is_task_scoped, which scaffolds scout briefs for two task ids and asserts that rule 2 names the completion gate, that the command is scoped to the scout's own task and home, and that no broader metadata or backlog write is granted.Risk Assessment
✅ Low: The change edits only generated brief prose, skill and doc text, and one brief-content test; the completion gate logic in fm-captain-hold.sh is untouched, the generated command (FM_HOME, script path, task id, --none) traces correctly to a
completethat writes decisions_reviewed=1 and a teardownverifythat accepts it, and--noneis still refused while a keyed decision is open.Testing
Minted a marked lab home with bin/fm-lab-home.sh and a markdown tasks-axi backend, scaffolded scout, ship and secondmate briefs with the real bin/fm-brief.sh, then ran the scout brief's own completion command verbatim through the real bin/fm-captain-hold.sh, followed by verify and bin/fm-teardown.sh, for an empty inventory (accepted end to end) and for an open keyed decision (refused at complete, verify and teardown with metadata intact). Confirmed the exception appears only in the scout brief and names only
complete --none. Ran the new regression test against an extracted copy of the base commit (fails with "scout outside-write rule did not name its exact completion gate") and the full targeted tests/fm-brief.test.sh on the change (all pass). Lab home and base extraction were removed; worktree is clean. All scenarios passed.fm-captain-hold.sh complete <id> --nonefor this task and homeEvidence: Scout brief: rule 2 and Definition of done side by side
Source: Scout brief: rule 2 and Definition of done side by side
2. Stay inside this worktree; outside it, write only the report and status file below, except for the task's empty-inventory attestation throughfm-captain-hold.sh complete --none, exactly as specified under Definition of done. ... Only when the reviewed inventory is empty, runFM_HOME='$LAB' bash '$ROOT/bin/fm-captain-hold.sh' complete 'scout-empty' --none. This exception permits only that command, not direct metadata edits, another task, or any backlog write. If any captain call remains, ask firstmate to register the inventory and attest completion before you report done. If the command refuses, report the refusal to firstmate and stop rather than bypassing the completion gate.Evidence: Empty inventory: brief command, verify, and scout teardown all accept
Source: Empty inventory: brief command, verify, and scout teardown all accept
$ FM_HOME='$LAB' bash '$ROOT/bin/fm-captain-hold.sh' complete 'scout-empty' --none complete: scout-empty captain-call inventory reviewed exit=0 (meta after) decisions_reviewed=1 / decision_keys= $ fm-captain-hold.sh verify scout-empty verified: scout-empty captain-call inventory $ fm-teardown.sh scout-empty teardown scout-empty complete ... Backlog: scout-empty is closed exit=0Evidence: Open keyed decision: --none refused, verify and teardown refuse
Source: Open keyed decision: --none refused, verify and teardown refuse
$ FM_HOME='$LAB' bash '$ROOT/bin/fm-captain-hold.sh' complete 'scout-open' --none fm-captain-hold: origin scout-open still has open captain decisions in its status stream; hold a captain task for what remains, or answer them, before attesting --none exit=1 $ grep decisions_reviewed state/scout-open.meta -> 0 $ fm-teardown.sh scout-open REFUSED: scout task scout-open has not passed the captain-call completion gate. exit=1Evidence: Exception scope across scout, ship, and secondmate briefs
Source: Exception scope across scout, ship, and secondmate briefs
Evidence: New brief test fails on the base commit
Source: New brief test fails on the base commit
not ok - scout outside-write rule did not name its exact completion gateEvidence: tests/fm-brief.test.sh on the change
Source: tests/fm-brief.test.sh on the change
Evidence: Live driver script
Source: Live driver script
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
bin/fm-brief.sh:734- The new scout exception authorizes onlyfm-captain-hold.sh complete <id> --none(bin/fm-brief.sh:706 and :734-736). The intent names the extra write path as "the completion attestation throughfm-captain-hold.sh complete" and expects "every read-only scout" to be torn down without an extra supervisor round. Concrete sequence: the scout appendsneeds-decision [key=x], firstmate holds a captain task with--origin <scout-id>instead of answering, and the scout then has a non-empty inventory. Under this brief the scout must stop and ask firstmate to runcomplete <id> <task-id>(one more round), andcomplete --noneis refused because the keyed decision is still open (bin/fm-captain-hold.sh:1931). The narrowing looks deliberate and defensible: the non-empty path writescaptain-held [key=...]transfer lines through fm_wake_status_append_self_announced, which assumes the caller is the supervising session, so a scout running it would suppress firstmate's own wake. The empty-inventory verify criterion in the intent is satisfied. Confirm that the--none-only scope is the accepted reading of "name exactly one extra write path" rather than widening it tocomplete <id> <task-id>...; no code change is recommended without that decision.bin/fm-promote.sh:309- bin/fm-promote.sh:309 still says the promotion contract "replaces the scout rule limiting outside-worktree writes to the report and status file". After this change rule 2 also carries thecomplete --noneattestation exception. The promoted ship contract's own boundary ("Outside the worktree, write only that task material and the status and steering-inbox records authorized below") supersedes the scout exception, and ship teardown never callsverify, so behavior is correct; only the description of the replaced rule is slightly out of date. tests/fm-task-delivery.test.sh:362 asserts that exact sentence, so any rewording must update both.✅ **Test** - passed
✅ No issues found.
fm-captain-hold.sh complete <id> --nonefor this task and homedrive-scout-attestation.sh(evidence dir): lab home viabin/fm-lab-home.sh create, thenFM_HOME=$LAB bin/fm-brief.sh scout-empty sample --scoutand side-by-side extraction of rule 2 and the Definition of doneVerbatim brief commandFM_HOME='$LAB' bash '$ROOT/bin/fm-captain-hold.sh' complete 'scout-empty' --noneon a seeded scout task with an empty inventory, thenfm-captain-hold.sh verify scout-emptyandbin/fm-teardown.sh scout-emptySame brief command onscout-openwhose status stream holdsneeds-decision [key=route], thenverifyandbin/fm-teardown.sh scout-open(all refused, meta preserved)bin/fm-brief.sh ship-x sample --mode no-mistakesandbin/fm-brief.sh sm-x --secondmate sample: grep counts of the attestation exception and of fm-captain-hold.sh subcommands across scout/ship/secondmate briefsgit archive 7da4c362 | tar -xinto a temp dir + the change'stests/fm-brief.test.sh: new test fails pre-fixbash tests/fm-brief.test.shon the change: 43 ok, exit 0✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.