Skip to content

fix(bin): supersede stale scout delivery text in brief.md on promotion - #4491

Merged
kunchenguid merged 3 commits into
kunchenguid:mainfrom
pablontiv:fm/fix-4486-promote-stale-brief
Sep 15, 2026
Merged

kunchenguid merged 3 commits into
kunchenguid:mainfrom
pablontiv:fm/fix-4486-promote-stale-brief

Conversation

@pablontiv

@pablontiv pablontiv commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

Intent

Captains's intent: dispatch now. Fix GitHub issue #4486 in this fork and open a PR through the normal contribution flow, with exact issue linkage (the PR must close #4486). This is a distinct, reproducible promote/relaunch safety gap: promoted ship work must not retain stale scout "Never push" instructions.

Issue #4486 substance: bin/fm-promote.sh writes ship-instructions.md and flips the task's kind to ship, but never rewrites data/<id>/brief.md (bin/fm-promote.sh:137, SCOUT_BRIEF="$DATA/$ID/brief.md"). A promoted scout, on its next relaunch, still receives the original scout-mode launch brief containing stale scout delivery text such as "This is a SCOUT task ... Never push." PR #4481 (issue #4279) recently fixed a related but distinct problem - a crewmate's ROLE IDENTITY being superseded by a conflicting project AGENTS.md - but that fix does not neutralize DELIVERY-MODE instructions, so the stale "Never push" text from a leftover scout brief survives untouched even after that fix.

What Changed

  • bin/fm-promote.sh now rewrites data/<id>/brief.md in addition to ship-instructions.md: it stages the original scout brief, appends the same superseding delivery contract (ship identity, "Never push"-superseding notice, mode-specific ship safety rule, ask-user block, and Definition of done) plus the shared Firstmate spec steps, and atomically swaps it into place, with cleanup/rollback of the staged original on any failure.
  • Extracted the mode-specific "ship safety rule" (RULE1 in bin/fm-brief.sh) into a shared fm_ship_rule_one() helper in bin/fm-dod-lib.sh, so both an ordinary ship brief and a promotion's brief/instructions render the identical rule text per delivery mode (no-mistakes, direct-PR, local-only).
  • Updated docs/architecture.md and docs/scripts.md to describe fm-dod-lib.sh/fm-promote.sh as also owning the promoted task's brief.md contract, and added tests/fm-control-relaunch.test.sh::test_promoted_scout_relaunch_receives_the_current_delivery_contract covering all three delivery modes to verify a relaunch after promotion no longer surfaces the stale scout "Never push" text.

Closes #4486

Risk Assessment

✅ Low: The change is well-scoped: it factors the ship push/merge rule into a shared fm_ship_rule_one (eliminating prior duplication), and extends fm-promote.sh to atomically rewrite data//brief.md with a superseding delivery contract under the existing per-task lock, with correct rollback-on-failure via the promote_cleanup trap; the new end-to-end test executes fm-promote.sh and fm-spawn.sh --relaunch for real and asserts on the generated launch-brief.md content, reproducing the exact issue #4486 scenario and matching the required intent.

Testing

Ran the actual repo test suite's live regression test for this fix end-to-end against the real bin/fm-promote.sh and bin/fm-spawn.sh scripts (real scout promotion + real relaunch, stubbed only at the session/agent-provider boundary): it passes at the target commit for all three delivery modes and, when isolated and run against the pre-fix base commit, reproduces the exact reported bug (stale scout brief survives relaunch). No code or test changes were needed; worktree left clean.

  • Live validation: ✅ go - 3 of 3 scenarios driven live against the product
Scenario Result Live Evidence
Promoted scout's brief.md gets the superseding delivery contract, and a later relaunch reads it (no-mistakes, direct-PR, local-only) ✅ pass live tests/fm-control-relaunch.test.sh::test_promoted_scout_relaunch_receives_the_current_delivery_contract run via ./bin/fm-test-run.sh tests/fm-control-relaunch.test.sh at c2bfc3d — for all 3 modes it…
Regression check: same scenario fails on the pre-fix code (issue #4486 reproduced) ✅ pass live Cloned the bare repo to an isolated temp dir, checked out base commit da5e658, copied only the new test file in, and ran it: it failed with 'not ok - no-mistakes: the…
Promotion still refuses cleanly and rolls back brief.md on partial failure (adversarial: interrupted promotion must not corrupt or duplicate the scout brief) ✅ pass live Covered live by the same full-suite run: test_promote_requires_and_records_the_delivery_contract and test_promote_refuses_a_symlinked_task_record (unchanged pre-existing tests) passed at c2bfc3d,…
Evidence: Full fm-control-relaunch.test.sh run at target commit c2bfc3d (all pass, incl. new regression test)
ok - fm-promote/fm-spawn --relaunch: the current ship contract supersedes stale scout delivery text
...
FM_TEST_END ... exit=0 duration_ms=110305
FM_TEST_SUMMARY total=1 failed=0 skipped_gate=0
Evidence: Same test run against base commit da5e658 (pre-fix) in an isolated temp clone: fails exactly on the reported gap
not ok - no-mistakes: the replacement launch did not receive the promoted task identity
FM_TEST_END ... exit=1 duration_ms=53952
FM_TEST_SUMMARY total=1 failed=1

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

✅ **Review** - passed

✅ No issues found.

✅ **Test** - passed

✅ No issues found.

  • Live validation: ✅ go - 3 of 3 scenarios driven live against the product
Scenario Result Live Evidence
Promoted scout's brief.md gets the superseding delivery contract, and a later relaunch reads it (no-mistakes, direct-PR, local-only) ✅ pass live tests/fm-control-relaunch.test.sh::test_promoted_scout_relaunch_receives_the_current_delivery_contract run via ./bin/fm-test-run.sh tests/fm-control-relaunch.test.sh at c2bfc3d — for all 3 modes it…
Regression check: same scenario fails on the pre-fix code (issue #4486 reproduced) ✅ pass live Cloned the bare repo to an isolated temp dir, checked out base commit da5e658, copied only the new test file in, and ran it: it failed with 'not ok - no-mistakes: the…
Promotion still refuses cleanly and rolls back brief.md on partial failure (adversarial: interrupted promotion must not corrupt or duplicate the scout brief) ✅ pass live Covered live by the same full-suite run: test_promote_requires_and_records_the_delivery_contract and test_promote_refuses_a_symlinked_task_record (unchanged pre-existing tests) passed at c2bfc3d,…
  • ./bin/fm-test-run.sh tests/fm-control-relaunch.test.sh at target commit c2bfc3d58f10424efb29e364914060c4ab98409e (56 tests, all pass)
  • Same test file run against base commit da5e658562128ce94d2ea374fb018004b859bfdf in an isolated git clone of the bare repo at /tmp (deleted afterward) — reproduces the reported failure pre-fix
  • git status --short in the worktree before and after testing to confirm no residue was left
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

@pablontiv
pablontiv force-pushed the fm/fix-4486-promote-stale-brief branch from aae2735 to c2bfc3d Compare September 15, 2026 04:30
@pablontiv pablontiv changed the title fix(bin): rewrite scout brief.md on promotion so relaunch never reads stale delivery rules fix(bin): supersede stale scout delivery text in brief.md on promotion Sep 15, 2026
@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: triage complete — this is a restore that supersedes stale scout delivery text in brief.md on promotion (Closes #4486). Attestation MATCH on c2bfc3d58f10424efb29e364914060c4ab98409e, CI and no-mistakes green, MERGEABLE/CLEAN, safe review. Auto-merging now.

@kunchenguid
kunchenguid merged commit aa92177 into kunchenguid:main Sep 15, 2026
15 checks passed
@kunchenguid

Copy link
Copy Markdown
Owner

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