Skip to content

fix(bin): let scout brief write its own empty-inventory attestation - #7875

Merged
kunchenguid merged 3 commits into
kunchenguid:mainfrom
tiago-peixoto:fm/upstream-7862
Oct 28, 2026
Merged

kunchenguid merged 3 commits into
kunchenguid:mainfrom
tiago-peixoto:fm/upstream-7862

Conversation

@tiago-peixoto

Copy link
Copy Markdown
Contributor

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 --scout says 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-lifecycle completion gate, which is bin/fm-captain-hold.sh complete <origin> (--none | <task-id>...).
complete writes 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:

  • The completion gate stays as strict as today: --none is still refused while the origin has an open keyed decision.
  • No scout gains permission to write any other metadata or backlog record. Name exactly one extra write path, the completion attestation through fm-captain-hold.sh complete, rather than widening the scout's write rights in general.
  • A tests/fm-brief.test.sh test 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 verify accepts.

What Changed

  • bin/fm-brief.sh --scout rule 2 now names one extra outside-worktree write, the task's empty-inventory attestation through fm-captain-hold.sh complete --none, and the Definition of done gives the scout that exact command for its own task id and FM_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.md and docs/captain-hold-lifecycle.md now assign caller authority explicitly: firstmate runs complete for held inventories, and a scout may attest only its own empty inventory through the brief-scoped command.
  • tests/fm-brief.test.sh adds test_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 complete that writes decisions_reviewed=1 and a teardown verify that accepts it, and --none is 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.

  • Live validation: ✅ go - 5 of 5 scenarios driven live against the product
Scenario Result Live Evidence
Scaffold a scout brief and read rule 2 beside the Definition of done: both name the single attestation path fm-captain-hold.sh complete &lt;id&gt; --none for this task and home ✅ pass live ~/.no-mistakes/evidence/01M5ZQQC4YV0S05NH2P34PW476/scenario1-brief-rule2-vs-dod.txt
A scout with an empty captain-decision inventory runs the brief's completion command verbatim: complete succeeds, writes decisions_reviewed=1 and an empty decision_keys to the task metadata, verify ac… ✅ pass live ~/.no-mistakes/evidence/01M5ZQQC4YV0S05NH2P34PW476/scenario2-empty-inventory-complete-verify-teardown.txt
Adversarial: a scout whose status stream still has an open keyed decision runs the same brief command: complete --none is refused with the open-decisions message, no attestation is written, verify fai… ✅ pass live ~/.no-mistakes/evidence/01M5ZQQC4YV0S05NH2P34PW476/scenario3-open-decision-refused.txt
Adversarial: the write exception is scout-only and names exactly one command; ship and secondmate briefs carry no attestation exception, and the scout brief offers no hold/answer/reconcile/bind subcom… ✅ pass live ~/.no-mistakes/evidence/01M5ZQQC4YV0S05NH2P34PW476/scenario4-exception-scope.txt
Regression guard: the new tests/fm-brief.test.sh test fails against the base commit's brief generator and passes on the change, so rule 2 and the gate cannot drift apart silently ✅ pass live ~/.no-mistakes/evidence/01M5ZQQC4YV0S05NH2P34PW476/scenario5-regression-before-fix.txt and scenario5-fm-brief-test-after-fix.txt
Evidence: 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 through fm-captain-hold.sh complete --none, exactly as specified under Definition of done. ... Only when the reviewed inventory is empty, run FM_HOME=&#39;$LAB&#39; bash &#39;$ROOT/bin/fm-captain-hold.sh&#39; complete &#39;scout-empty&#39; --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.

## Rule 2 (write boundary), from $LAB/data/scout-empty/brief.md
23:2. Stay inside this worktree; outside it, write only the report and status file below, except for the task's empty-inventory attestation through `fm-captain-hold.sh complete --none`, exactly as specified under Definition of done.

## Definition of done excerpt (completion step), from $LAB/data/scout-empty/brief.md
85:Before reporting done, read and follow `~/.no-mistakes/worktrees/5284051b2355/01M5ZQQC4YV0S05NH2P34PW476/.agents/skills/captain-hold-lifecycle/SKILL.md` and pass its shared completion gate for the report and any visual review.
86:Only when the reviewed inventory is empty, run `FM_HOME='$LAB' bash '~/.no-mistakes/worktrees/5284051b2355/01M5ZQQC4YV0S05NH2P34PW476/bin/fm-captain-hold.sh' complete 'scout-empty' --none`.
87:This exception permits only that command, not direct metadata edits, another task, or any backlog write.
88:If any captain call remains, ask firstmate to register the inventory and attest completion before you report done.
89:If the command refuses, report the refusal to firstmate and stop rather than bypassing the completion gate.

## Command the brief hands the scout (verbatim)
FM_HOME='$LAB' bash '~/.no-mistakes/worktrees/5284051b2355/01M5ZQQC4YV0S05NH2P34PW476/bin/fm-captain-hold.sh' complete 'scout-empty' --none
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=0

$ cat state/scout-empty.meta   (before)
window=firstmate:fm-scout-empty
worktree=$LAB/projects/missing-scout-empty
project=$LAB/projects/sample
harness=codex
kind=scout
mode=scout
spawn_gen=fixture-scout-empty

$ FM_HOME='$LAB' bash '$ROOT/bin/fm-captain-hold.sh' complete 'scout-empty' --none
complete: scout-empty captain-call inventory reviewed
exit=0

$ cat state/scout-empty.meta   (after)
window=firstmate:fm-scout-empty
worktree=$LAB/projects/missing-scout-empty
project=$LAB/projects/sample
harness=codex
kind=scout
mode=scout
spawn_gen=fixture-scout-empty
decisions_reviewed=1
decision_keys=

$ fm-captain-hold.sh verify scout-empty
verified: scout-empty captain-call inventory
exit=0

$ fm-teardown.sh scout-empty   (scout teardown gate)
fm-gate-refuse: gate agent lifecycle permitted only against lab home $LAB
●━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
●  WATCHER DOWN - SUPERVISION IS OFF
●  1 task(s) in flight, but no watcher has a fresh beacon (last beat: never, grace 300s).
●  Trust the emitted supervision protocol for this harness; do not use shell & for watcher repair.
●  This is a supervision warning only; the guarded operation WILL still run.
●  watcher supervision needs Stop-owned automatic recovery; inspect the hook registration and startup status before ending the turn.
●━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
teardown scout-empty complete (window firstmate:fm-scout-empty, worktree $LAB/projects/missing-scout-empty)
Backlog: scout-empty is closed in $LAB/data/backlog.md. Run bin/fm-tasks-axi.sh ready for dependency-cleared candidates, check date gates, and dispatch only work whose blockers are gone and date is due.
exit=0

$ backlog row after teardown:
5:- [x] scout-empty - Investigate scout-empty data/scout-empty/report.md (repo: sample) (kind: scout) (reported 2026-10-27)
Evidence: 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=1

$ cat state/scout-open.status
working [at=1]: report drafted
needs-decision [key=route]: choose route north or route south

$ 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-captain-hold.sh verify scout-open
fm-captain-hold: origin scout-open has no completed captain-call inventory
exit=1

$ fm-teardown.sh scout-open
fm-gate-refuse: gate agent lifecycle permitted only against lab home $LAB
WARNING: watcher still down (same stale episode; last beat: never, grace 300s) - full banner already printed this episode.
fm-captain-hold: origin scout-open has no completed captain-call inventory
REFUSED: scout task scout-open has not passed the captain-call completion gate.
Inventory its report and any visual review through bin/fm-captain-hold.sh before teardown.
exit=1

$ ls state/scout-open.meta (must survive the refused teardown)
$LAB/state/scout-open.meta
Evidence: Exception scope across scout, ship, and secondmate briefs

Source: Exception scope across scout, ship, and secondmate briefs

scout-empty  attestation-exception lines: 1   complete-command lines: 2   other fm-captain-hold.sh subcommands offered: 0
ship-x       attestation-exception lines: 0   complete-command lines: 0   other fm-captain-hold.sh subcommands offered: 0
sm-x         attestation-exception lines: 0   complete-command lines: 0   other fm-captain-hold.sh subcommands offered: 0

scout brief: every fm-captain-hold.sh invocation it offers:
fm-captain-hold.sh complete --none
fm-captain-hold.sh' complete 'scout-empty' --none

ship brief rule 2:
23:2. Run `no-mistakes doctor`; if it reports the repo is not initialized here, run `no-mistakes init`.
27:2. Keep project edits inside this worktree; keep proof and scratch output outside it, under `/tmp/fm-lab.7jBlNV/data/ship-x/` or a temporary directory.
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 gate

## new test against BASE commit 7da4c362 (pre-fix bin/fm-brief.sh)
29:not ok - scout outside-write rule did not name its exact completion gate
exit=0

(note: "exit=0" above is the grep filter exit status; the "not ok" line is the test harness failing on the pre-fix brief)
Evidence: tests/fm-brief.test.sh on the change

Source: tests/fm-brief.test.sh on the change

ok - fm-brief: scaffolds leave the worker role scope to the launch boundary and keep the secondmate contract
ok - fm-brief.sh: bash -n succeeds
/tmp/fm-brief.kyiAKN/heredoc-in-substitution.sh:2
ok - fm-brief.sh: no heredoc is nested inside a command substitution (Bash 3.2 parse-safe)
ok - fm-brief.sh: --help renders the complete header
ok - fm-brief.sh: no-mistakes/direct-PR/local-only briefs generate cleanly
ok - fm-brief.sh: --forge forgejo names tea in Rule 3, the direct-PR DOD, and the draft read-back, marks the delivery contract, and the closed set refuses everything else
ok - fm-brief.sh: --forge external renders the no-push rule, the review contract, and the adapter, and refuses every impossible shape
ok - fm-brief.sh: ship --mode is required and closed-set validated
ok - fm-brief.sh: the explicit ship mode wins over the registered posture
ok - fm-brief.sh: --yolo and scout/secondmate --mode are refused, never silently dropped
ok - fm-brief.sh: faster paths use configured authority without stacked review
ok - fm-brief.sh: no-mistakes DOD keeps its apostrophe prose and bans --yes outright
ok - fm-brief.sh: no-mistakes DOD detects a green PR from the drive call, not a status poll
ok - fm-brief.sh: PR-based done requires a non-draft PR; a deliberate draft declares a wait
ok - fm-brief.sh: no-mistakes ask-user findings use one event plus a verbatim snapshot
ok - fm-brief.sh: ship project-memory wording bounds edits to corrections of wrong information
ok - fm-brief.sh: --herdr-lab emits the complete hard safety contract
ok - fm-brief.sh: --herdr-lab uses its quoted Firstmate-owned helper path
ok - fm-brief.sh: ship and scout scaffolds make omitted Herdr intent fail-visible
ok - fm-brief.sh: the documented {TASK} and {FIRSTMATE_SPEC} fills cannot corrupt the Herdr safety gate
ok - fm-brief.sh: Herdr lab contract covers scouts and rejects secondmate misuse
ok - fm-brief.sh: --no-projects scaffolds a project-less charter and guards misuse
ok - fm-brief.sh: marked requests avoid generic acknowledgements and preserve material reporting
ok - fm-brief.sh: relative directory inputs ignore CDPATH, render stable absolute charter paths, or fail loudly
ok - fm-brief.sh: custom pause verb renders in every scaffold
ok - fm-brief.sh: ship and scout scaffolds declare a validation-round pause once, then hold it
ok - fm-brief.sh: investigation and visual-review completions load the shared decision policy
ok - fm-brief.sh: scouts may attest only their own empty inventory through the guarded command
ok - fm-brief: scout and secondmate code paths still scaffold well-formed briefs
ok - fm-brief.sh: scout Lavish hosting follows the bootstrap lavish-axi floor
ok - fm-brief: inbox listing is silent on empty/absent inbox and numerically ordered
ok - fm-brief: workers end the turn on a decision, wait in one bounded shell command, and never poll
ok - fm-brief: without config/wait-no-turns the brief and drive text stay as they were
ok - fm-brief: inbox guidance explains marked synthetic terminators in every scaffold
ok - fm-brief.sh: the home brief include lands last on ship and scout, verbatim, and fails closed
ok - fm-brief.sh: --base-branch records the base, targets the PR at it, and is refused where no PR carries it
ok - fm-brief.sh: --branch-prefix omitted defaults every ship mode to fm/<task-id>
ok - fm-brief.sh: a --branch-prefix override renders identically across every generated section
ok - fm-brief.sh: an empty --branch-prefix override resolves to a bare <task-id> branch
ok - fm-brief.sh: --branch-prefix is refused on scout and secondmate scaffolds
ok - fm-brief.sh: --branch-prefix value is validated against embedded spaces and a leading dash
Switched to a new branch '$(touch${IFS}/tmp/fm-brief.kyiAKN/branch-prefix-shell-safe-marker)brief-branch-safe-g3'
ok - fm-brief.sh: ref-format-valid shell metacharacters stay literal in generated branch commands
ok - fm-brief.sh: every crewmate scaffold forbids administering the shared worktree pool
Evidence: Live driver script

Source: Live driver script

#!/usr/bin/env bash
# Live driver: scout brief write boundary vs completion gate (issue #7862).
set -u
ROOT=~/.no-mistakes/worktrees/5284051b2355/01M5ZQQC4YV0S05NH2P34PW476
EV=~/.no-mistakes/evidence/01M5ZQQC4YV0S05NH2P34PW476
LAB=$(mktemp -d "${TMPDIR:-/tmp}/fm-lab.XXXXXX")
trap 'rm -rf "$LAB"' EXIT
cd "$ROOT" || exit 1

"$ROOT/bin/fm-lab-home.sh" create "$LAB" >/dev/null || { echo "lab create failed"; exit 1; }
cat > "$LAB/.tasks.toml" <<'TOML'
backend = "markdown"

[markdown]
path = "data/backlog.md"
archive = "data/done-archive.md"
done_keep = 10
TOML
printf '## In flight\n\n## Queued\n\n## Done\n' > "$LAB/data/backlog.md"
mkdir -p "$LAB/fakebin"
for t in tmux treehouse no-mistakes gh gh-axi; do printf '#!/usr/bin/env bash\nexit 0\n' > "$LAB/fakebin/$t"; chmod +x "$LAB/fakebin/$t"; done

# Every product call runs the way a scout or firstmate would: plain FM_HOME, no
# fleet-path overrides inherited from this gate session.
run() { env -u FM_ROOT_OVERRIDE -u FM_STATE_OVERRIDE -u FM_DATA_OVERRIDE -u FM_CONFIG_OVERRIDE -u FM_PROJECTS_OVERRIDE \
          PATH="$LAB/fakebin:$PATH" FM_HOME="$LAB" "$@"; }
lab_tasks() { (cd "$LAB" && tasks-axi "$@"); }

seed_task() {  # <id> <status-body>
  local id=$1
  lab_tasks add "$id" "Investigate $id" --kind scout --repo sample --start >/dev/null || { echo "tasks-axi add $id failed"; exit 1; }
  printf '%s\n' "window=firstmate:fm-$id" "worktree=$LAB/projects/missing-$id" "project=$LAB/projects/sample" \
    "harness=codex" "kind=scout" "mode=scout" "spawn_gen=fixture-$id" > "$LAB/state/$id.meta"
  printf '%s\n' "$2" > "$LAB/state/$id.status"
  printf '# Report for %s\n\nWhat I did, what I found, evidence, recommendation.\n' "$id" > "$LAB/data/$id/report.md"
}

brief_command() {  # <brief.md> -> the exact completion command the brief gives the scout
  sed -n 's/^Only when the reviewed inventory is empty, run `\(.*\)`\.$/\1/p' "$1"
}

echo "################ SCENARIO 1: scaffold scout brief; rule 2 and Definition of done side by side"
run "$ROOT/bin/fm-brief.sh" scout-empty sample --scout >/dev/null || { echo "scaffold failed"; exit 1; }
BRIEF="$LAB/data/scout-empty/brief.md"
{
  echo "## Rule 2 (write boundary), from $BRIEF"
  grep -n '^2\. ' "$BRIEF"
  echo
  echo "## Definition of done excerpt (completion step), from $BRIEF"
  grep -n 'captain-hold-lifecycle/SKILL.md\|Only when the reviewed inventory is empty\|This exception permits only\|If any captain call remains\|If the command refuses' "$BRIEF"
  echo
  echo "## Command the brief hands the scout (verbatim)"
  brief_command "$BRIEF"
} | sed "s#$LAB#\$LAB#g" | tee "$EV/scenario1-brief-rule2-vs-dod.txt"
CMD=$(brief_command "$BRIEF")
[ -n "$CMD" ] || { echo "FAIL: brief carries no completion command"; exit 1; }

echo; echo "################ SCENARIO 2: empty-inventory scout runs the brief's command verbatim, then verify and teardown accept"
seed_task scout-empty $'working [at=1]: report drafted\ndone [at=2]: nothing waits on the captain'
{
  echo "\$ cat state/scout-empty.meta   (before)"; cat "$LAB/state/scout-empty.meta"
  echo; echo "\$ $CMD"
  run bash -c "$CMD"; echo "exit=$?"
  echo; echo "\$ cat state/scout-empty.meta   (after)"; cat "$LAB/state/scout-empty.meta"
  echo; echo "\$ fm-captain-hold.sh verify scout-empty"
  run bash "$ROOT/bin/fm-captain-hold.sh" verify scout-empty; echo "exit=$?"
  echo; echo "\$ fm-teardown.sh scout-empty   (scout teardown gate)"
  run "$ROOT/bin/fm-teardown.sh" scout-empty 2>&1; echo "exit=$?"
  echo; echo "\$ backlog row after teardown:"; grep -n 'scout-empty' "$LAB/data/backlog.md"
} 2>&1 | sed "s#$LAB#\$LAB#g; s#$ROOT#\$ROOT#g" | tee "$EV/scenario2-empty-inventory-complete-verify-teardown.txt"

echo; echo "################ SCENARIO 3 (adversarial): open keyed decision; the same brief command is refused, verify and teardown refuse"
run "$ROOT/bin/fm-brief.sh" scout-open sample --scout >/dev/null || { echo "scaffold failed"; exit 1; }
CMD_OPEN=$(brief_command "$LAB/data/scout-open/brief.md")
seed_task scout-open $'working [at=1]: report drafted\nneeds-decision [key=route]: choose route north or route south'
{
  echo "\$ cat state/scout-open.status"; cat "$LAB/state/scout-open.status"
  echo; echo "\$ $CMD_OPEN"
  run bash -c "$CMD_OPEN"; echo "exit=$?"
  echo; echo "\$ grep decisions_reviewed state/scout-open.meta"; grep -c 'decisions_reviewed' "$LAB/state/scout-open.meta"
  echo; echo "\$ fm-captain-hold.sh verify scout-open"
  run bash "$ROOT/bin/fm-captain-hold.sh" verify scout-open; echo "exit=$?"
  echo; echo "\$ fm-teardown.sh scout-open"
  run "$ROOT/bin/fm-teardown.sh" scout-open 2>&1; echo "exit=$?"
  echo; echo "\$ ls state/scout-open.meta (must survive the refused teardown)"; ls "$LAB/state/scout-open.meta"
} 2>&1 | sed "s#$LAB#\$LAB#g; s#$ROOT#\$ROOT#g" | tee "$EV/scenario3-open-decision-refused.txt"

echo; echo "################ SCENARIO 4 (adversarial): the exception is scout-only and names one command"
run "$ROOT/bin/fm-brief.sh" ship-x sample --mode no-mistakes >/dev/null || { echo "ship scaffold failed"; exit 1; }
FM_SECONDMATE_CHARTER='Supervise sample.' run "$ROOT/bin/fm-brief.sh" sm-x --secondmate sample >/dev/null || { echo "secondmate scaffold failed"; exit 1; }
{
  for b in scout-empty ship-x sm-x; do
    f="$LAB/data/$b/brief.md"
    printf '%-12s attestation-exception lines: %s   complete-command lines: %s   other fm-captain-hold.sh subcommands offered: %s\n' \
      "$b" "$(grep -c 'empty-inventory attestation' "$f")" "$(grep -c 'fm-captain-hold.sh.* complete ' "$f")" \
      "$(grep -o 'fm-captain-hold.sh[^`]* \(hold\|answer\|reconcile\|bind\|unbind\)' "$f" | wc -l)"
  done
  echo; echo "scout brief: every fm-captain-hold.sh invocation it offers:"; grep -o 'fm-captain-hold.sh[^`]*' "$LAB/data/scout-empty/brief.md" | sed "s#$LAB#\$LAB#g"
  echo; echo "ship brief rule 2:"; grep -n '^2\. ' "$LAB/data/ship-x/brief.md"
} 2>&1 | tee "$EV/scenario4-exception-scope.txt"

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

⚠️ **Review** - 2 infos
  • ℹ️ bin/fm-brief.sh:734 - The new scout exception authorizes only fm-captain-hold.sh complete &lt;id&gt; --none (bin/fm-brief.sh:706 and :734-736). The intent names the extra write path as "the completion attestation through fm-captain-hold.sh complete" and expects "every read-only scout" to be torn down without an extra supervisor round. Concrete sequence: the scout appends needs-decision [key=x], firstmate holds a captain task with --origin &lt;scout-id&gt; instead of answering, and the scout then has a non-empty inventory. Under this brief the scout must stop and ask firstmate to run complete &lt;id&gt; &lt;task-id&gt; (one more round), and complete --none is refused because the keyed decision is still open (bin/fm-captain-hold.sh:1931). The narrowing looks deliberate and defensible: the non-empty path writes captain-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 to complete &lt;id&gt; &lt;task-id&gt;...; 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 the complete --none attestation 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 calls verify, 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.

  • Live validation: ✅ go - 5 of 5 scenarios driven live against the product
Scenario Result Live Evidence
Scaffold a scout brief and read rule 2 beside the Definition of done: both name the single attestation path fm-captain-hold.sh complete &lt;id&gt; --none for this task and home ✅ pass live ~/.no-mistakes/evidence/01M5ZQQC4YV0S05NH2P34PW476/scenario1-brief-rule2-vs-dod.txt
A scout with an empty captain-decision inventory runs the brief's completion command verbatim: complete succeeds, writes decisions_reviewed=1 and an empty decision_keys to the task metadata, verify ac… ✅ pass live ~/.no-mistakes/evidence/01M5ZQQC4YV0S05NH2P34PW476/scenario2-empty-inventory-complete-verify-teardown.txt
Adversarial: a scout whose status stream still has an open keyed decision runs the same brief command: complete --none is refused with the open-decisions message, no attestation is written, verify fai… ✅ pass live ~/.no-mistakes/evidence/01M5ZQQC4YV0S05NH2P34PW476/scenario3-open-decision-refused.txt
Adversarial: the write exception is scout-only and names exactly one command; ship and secondmate briefs carry no attestation exception, and the scout brief offers no hold/answer/reconcile/bind subcom… ✅ pass live ~/.no-mistakes/evidence/01M5ZQQC4YV0S05NH2P34PW476/scenario4-exception-scope.txt
Regression guard: the new tests/fm-brief.test.sh test fails against the base commit's brief generator and passes on the change, so rule 2 and the gate cannot drift apart silently ✅ pass live ~/.no-mistakes/evidence/01M5ZQQC4YV0S05NH2P34PW476/scenario5-regression-before-fix.txt and scenario5-fm-brief-test-after-fix.txt
  • drive-scout-attestation.sh (evidence dir): lab home via bin/fm-lab-home.sh create, then FM_HOME=$LAB bin/fm-brief.sh scout-empty sample --scout and side-by-side extraction of rule 2 and the Definition of done
  • Verbatim brief command FM_HOME=&#39;$LAB&#39; bash &#39;$ROOT/bin/fm-captain-hold.sh&#39; complete &#39;scout-empty&#39; --none on a seeded scout task with an empty inventory, then fm-captain-hold.sh verify scout-empty and bin/fm-teardown.sh scout-empty
  • Same brief command on scout-open whose status stream holds needs-decision [key=route], then verify and bin/fm-teardown.sh scout-open (all refused, meta preserved)
  • bin/fm-brief.sh ship-x sample --mode no-mistakes and bin/fm-brief.sh sm-x --secondmate sample: grep counts of the attestation exception and of fm-captain-hold.sh subcommands across scout/ship/secondmate briefs
  • git archive 7da4c362 | tar -x into a temp dir + the change's tests/fm-brief.test.sh: new test fails pre-fix
  • bash tests/fm-brief.test.sh on the change: 43 ok, exit 0
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

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.
@greptile-apps

greptile-apps Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Low impact] The PR appears safe to merge.

Reviews (3) · Last reviewed commit: "no-mistakes(document): point lifecycle d..." · Reviewed by Greptile

@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: thank you @tiago-peixoto, this closes the gap from #7862 the way the issue asked. I read the tip 21dbfb98 against main. Rule 2 of the scout brief now names exactly one extra outside-worktree write: the task's own fm-captain-hold.sh complete <id> --none. The Definition of done gives that exact command, scoped to the scout's task id and FM_HOME. A non-empty inventory or a refusal goes back to firstmate. The skill and lifecycle doc assign caller authority to match, and tests/fm-brief.test.sh pins it. fm-captain-hold.sh itself is untouched, so --none is still refused while a keyed decision is open. Your 5/5 live scenarios, including the open-decision refusal and the scout-only scope check, cover what I'd want to see. The no-mistakes attestation binds this head.

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 Behavior portable serial 1 in run 40598755948. That run tested a merge base from before main's 2ba4c455 shard fix, and it failed in the known inherited supervision-host class, so it isn't caused by your change. It needs a fresh run against current main. That's on our side, not yours, so please don't rebase or push for it. Once a current run is green and the PR is CLEAN, I'll merge.

@kunchenguid kunchenguid reopened this Oct 28, 2026
@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: quick CI note, nothing needed from you.

The fresh run I started last pass (40620354780) was still tested against an older merge base (7da4c362, from before main's 2ba4c455 fix), and its only red is the same inherited Behavior portable serial 1 supervision-host case ("the host did not hand the wake to main"). Your change doesn't cause it. GitHub's merge ref now points at current main, so I'm closing and reopening this PR once more to get a run on the current base. Your head and the no-mistakes attestation stay as they are. Please don't rebase or push for this. It's on our side.

contract-class stays restore. Once a current-base run is green and the PR is CLEAN, I'll merge.

@kunchenguid kunchenguid reopened this Oct 28, 2026
@kunchenguid
kunchenguid merged commit 046fe8a into kunchenguid:main Oct 28, 2026
57 of 59 checks passed
@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: this is merged. Thank you @tiago-peixoto — really appreciate you taking the time on this.

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.

Scout brief forbids the write that its completion gate requires

2 participants