Skip to content

fix(bin): give the no-mistakes handoff its own status verb - #8

Merged
ellshep merged 4 commits into
mainfrom
fm/fm-done-handoff-word
Oct 14, 2026
Merged

ellshep merged 4 commits into
mainfrom
fm/fm-done-handoff-word

Conversation

@ellshep

@ellshep ellshep commented Oct 14, 2026 •

Copy link
Copy Markdown
Owner

Intent

Investigate and fix the done confusion, and say where it came from.

Context: in no-mistakes ship tasks, workers append done right after their local commit and then stop, and the supervisor has repeatedly treated that as a stalled worker and nudged it on. Upstream issue kunchenguid#7251 describes the cause: the Definition of done rendered by bin/fm-dod-lib.sh for the no-mistakes mode (and its Gerrit variant) uses the status word done for two different events - first "committed, nothing pushed, waiting for firstmate to say run /no-mistakes" (the handoff), then later "PR open and checks green" (finished). Other modes use done only for finished, and bin/fm-brief.sh calls done: the gate that ends a stage. So a single done line cannot be read as handoff vs finished without inspecting its note text, which fm_dod_should_gate_ship_done does today.

Expected: one status word has one meaning; a reader of a single status line can tell "ready for validation" from "finished"; the handoff sentence names who starts the validation run. How to verify (from the issue): in the rendered no-mistakes instructions the pre-validation event and the finished event are not the same status word or are otherwise unambiguous from the line alone; the handoff sentence names who starts the validation run; the gate that accepts a finished ship report still refuses a report whose latest commit was not pushed by the run; existing tests for the rendered instructions and status classification pass, with a case for the handoff event.

Where it came from

The two meanings of done came from bed9bc27 (delivery modes), which told a no-mistakes worker to report done after a local commit and again after the PR was green. ea3ac2e4 (AFK idle fix) classified every done as a supervisor-relevant terminal status, making the handoff look finished to the watcher. c7fdef92 (promoted worker rules) moved the wording into the shared Definition of done renderer. a8a2959c (named-head gate) distinguished the two done events by note text to gate only the finished report, and fdd36879 (Gerrit support) carried the same handoff into Gerrit.

What Changed

  • Introduce a validation-ready: status verb for the no-mistakes (and Gerrit) pre-validation handoff, replacing the overloaded pre-validation done: while still recognizing a legacy pre-validation done: from workers briefed before the new verb existed, via a new fm_dod_is_validation_handoff helper in bin/fm-dod-lib.sh.
  • Wire the new verb through status classification and crew-state reads: bin/fm-classify-lib.sh recognizes validation-ready as a terminal/captain-relevant verb, bin/fm-crew-state.sh maps it to parked and emits a "ready for validation" status, bin/fm-brief.sh tells no-mistakes-mode workers to use validation-ready instead of done for the handoff, and bin/fm-inactive-reconcile.sh excludes validation handoffs (including the legacy done: form) from the ledger-first terminal-outcome path.
  • Update docs/configuration.md, .agents/skills/firstmate-codexapp/SKILL.md, and .agents/skills/ship-landing/SKILL.md to document the new verb, and extend the corresponding test suites with coverage for the handoff event.

Risk Assessment

✅ Low: The change introduces a new status verb (validation-ready) and a shared fm_dod_is_validation_handoff predicate that every consumer (fm-brief.sh rendering, fm-classify-lib.sh verb recognition, fm-crew-state.sh current-state resolution, fm-inactive-reconcile.sh ledger-first delivery) now routes through consistently; both the Gerrit and non-Gerrit no-mistakes DoD text were updated in lockstep, legacy pre-validation done: lines are still recognized as handoffs for already-briefed workers, the CI-ready/published-change gating path is untouched, and the test suite was updated (including meta-fixture mode= additions needed because of the existing empty-mode-defaults-to-no-mistakes convention) to cover both the new verb and the legacy fallback.

Testing

Drove the real bin/fm-brief.sh against disposable FM_HOME directories for both plain no-mistakes and Gerrit modes and confirmed the rendered worker brief now tells workers to append validation-ready: {summary} as the handoff (not done:), names 'Firstmate starts the validation run' as who starts validation, and keeps the finished event as a distinct done: PR ... checks green/published for review line; no legacy done: {summary} handoff text remains in either rendering. Separately sourced bin/fm-dod-lib.sh and bin/fm-classify-lib.sh and called the real gate/classifier functions against a disposable unpushed git worktree: both the new validation-ready: handoff and the legacy pre-fix done: handoff are accepted without requiring the commit to be pushed, a finished done: PR ... checks green with an unpushed commit is still correctly refused by the named-head gate (adversarial check), and validation-ready: is classified as both a terminal verb and captain-relevant so it reaches/wakes the supervisor rather than being read as a stalled worker. Ran the full targeted automated test suites for every file this change touches that completes in reasonable time (fm-dod-lib, fm-brief, fm-crew-state, fm-inactive-reconcile) — all passed with zero failures, executing the real scripts against real git repos and fixture status files, not mocks. fm-task-delivery.test.sh and fm-watch-triage.test.sh were running in a background batch job that was later confirmed stopped at its background time limit before those two finished; the specific behaviors they add coverage for (Gerrit brief wording, validation-ready classify primitives) were independently confirmed via the manual live drives above, so this does not change the verdict, but their full-suite pass was not directly observed in this run.

  • Live validation: ⚠️ inconclusive - 8 of 9 scenarios driven live against the product
Scenario Result Live Evidence
No-mistakes ship brief renders a distinct handoff status word (validation-ready) separate from finished (done) ✅ pass live Live FM_HOME run of bin/fm-brief.sh; rendered brief line 109/111 uses validation-ready [at=<epoch>]: {summary} for handoff, line 143 uses done [at=<epoch>]: PR {url} checks green for finished; Sta…
Gerrit no-mistakes variant also renders the distinct handoff word, no legacy done: handoff text ✅ pass live Live FM_HOME run of bin/fm-brief.sh --forge gerrit; rendered brief shows validation-ready: handoff and done: PR ... published for review as finished; grep for legacy 'done [at=<epoch>]: {summary}' fou…
Handoff sentence names who starts the validation run ✅ pass live Rendered brief text: 'Firstmate starts the validation run by instructing you to run /no-mistakes to validate and ship a PR.'
Legacy pre-fix done: handoff (from workers briefed before this fix) is still recognized as a non-gated handoff ✅ pass live fm_dod_accept_ship_done ship no-mistakes <unpushed worktree> <repo> 'done: implementation complete' returned success despite the commit existing only in the disposable worktree. See dod-gate-manual-dr…
New validation-ready: handoff is recognized as a non-gated handoff ✅ pass live fm_dod_accept_ship_done ship no-mistakes <unpushed worktree> <repo> 'validation-ready: implementation complete' returned success despite the commit being unpushed. See dod-gate-manual-drive.txt
Adversarial: the gate still refuses a finished done: report (checks green) whose latest commit was not pushed ✅ pass live fm_dod_accept_ship_done ship no-mistakes <unpushed worktree> <repo> 'done: PR https://example.test/o/r/pull/1 checks green' failed with 'named head ... unreachable outside the worker copy'. See dod-ga…
validation-ready: wakes the supervisor (terminal verb, captain-relevant) rather than being silently ignored or read as a stalled worker ✅ pass live status_is_terminal_verb and status_is_captain_relevant both returned success for 'validation-ready [at=123]: implementation committed' when sourced directly from bin/fm-classify-lib.sh. See dod-gate-m…
Existing targeted automated tests for rendered instructions and status classification pass, including a handoff-event case ✅ pass live bash tests/fm-dod-lib.test.sh, bash tests/fm-brief.test.sh, bash tests/fm-crew-state.test.sh, bash tests/fm-inactive-reconcile.test.sh all completed with rc=0 and zero not ok lines, exercisi…
fm-task-delivery.test.sh and fm-watch-triage.test.sh full automated suites (Gerrit brief delivery contract test, classify primitives test) complete and pass ⏸️ untested no Both suites were launched in a background batch job that was confirmed stopped at its background time limit before fm-task-delivery and fm-watch-triage finished (fm-dod-lib, fm-brief, fm-crew-state, f…
Evidence: Rendered no-mistakes and Gerrit worker briefs (live script output)

Source: Rendered no-mistakes and Gerrit worker briefs (live script output)

# Live evidence: rendered no-mistakes ship brief (bin/fm-brief.sh), disposable FM_HOME
# Command: FM_HOME=/tmp/fm-live-dod/home ./bin/fm-brief.sh live-handoff-demo some-proj --mode no-mistakes

=== States line ===
   States: working, needs-decision, blocked, paused, validation-ready, done, failed.

=== Handoff text ===
When the implementation is committed, append `validation-ready [at=<epoch>]: {summary}` to the status file and stop.
Firstmate starts the validation run by instructing you to run /no-mistakes to validate and ship a PR.
That `validation-ready:` line is the handoff to firstmate; the pipeline owns the push.

=== Finished text (distinct status word, same as before) ===
Then append `done [at=<epoch>]: PR {url} checks green` and stop. You are finished.

# Gerrit variant (FM_HOME=/tmp/fm-live-dod/home-gerrit, --forge gerrit):
When the implementation is committed, append `validation-ready [at=<epoch>]: {summary}` to the status file and stop.
That `validation-ready:` line is the handoff; it is not a request to publish.
Then append `done [at=<epoch>]: PR {change url} published for review` to the status file and stop. You are finished.
No legacy `done [at=<epoch>]: {summary}` handoff line present in either rendering.
Evidence: Manual live drive of DoD gate and classify primitives against disposable git worktree

Source: Manual live drive of DoD gate and classify primitives against disposable git worktree

# Live evidence: manual drive of bin/fm-dod-lib.sh / bin/fm-classify-lib.sh against a disposable git worktree
# (not pushed to any remote), issue https://github.com/kunchenguid/firstmate/issues/7251

--- Scenario: legacy 'done:' handoff recognized as validation handoff, not gated ---
PASS: legacy done: handoff accepted without push

--- Scenario: new 'validation-ready:' handoff recognized, not gated ---
PASS: validation-ready: handoff accepted without push

--- Adversarial: finished 'done: PR ... checks green' with unpushed commit must still be GATED (refused) ---
named head b7e5ac39b3f45f053f696e4feb9afa3d04261ad6 is unreachable outside the worker copy
PASS: finished unpushed report correctly refused

--- status_is_terminal_verb('validation-ready [at=123]: implementation committed') -> 0 (wakes supervisor)
--- status_is_captain_relevant('validation-ready [at=123]: implementation committed') -> 0 (reaches firstmate)
--- FM_CLASSIFY_CAPTAIN_RE_DEFAULT = validation-ready:|done:|needs-decision:|blocked:|failed:|PR ready|checks green|ready in branch|merged
- Outcome: ⚠️ 1 warning across 1 run (17m21s)

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

✅ **Review** - passed

✅ No issues found.

⚠️ **Test** - 1 warning
  • ⚠️ live validation verdict: inconclusive (8 of 9 scenarios were driven live against the product); untested: fm-task-delivery.test.sh and fm-watch-triage.test.sh full automated suites (Gerrit brief delivery contract test, classify primitives test) complete and pass
  • Live validation: ⚠️ inconclusive - 8 of 9 scenarios driven live against the product
Scenario Result Live Evidence
No-mistakes ship brief renders a distinct handoff status word (validation-ready) separate from finished (done) ✅ pass live Live FM_HOME run of bin/fm-brief.sh; rendered brief line 109/111 uses validation-ready [at=&lt;epoch&gt;]: {summary} for handoff, line 143 uses done [at=&lt;epoch&gt;]: PR {url} checks green for finished; Sta…
Gerrit no-mistakes variant also renders the distinct handoff word, no legacy done: handoff text ✅ pass live Live FM_HOME run of bin/fm-brief.sh --forge gerrit; rendered brief shows validation-ready: handoff and done: PR ... published for review as finished; grep for legacy 'done [at=<epoch>]: {summary}' fou…
Handoff sentence names who starts the validation run ✅ pass live Rendered brief text: 'Firstmate starts the validation run by instructing you to run /no-mistakes to validate and ship a PR.'
Legacy pre-fix done: handoff (from workers briefed before this fix) is still recognized as a non-gated handoff ✅ pass live fm_dod_accept_ship_done ship no-mistakes <unpushed worktree> <repo> 'done: implementation complete' returned success despite the commit existing only in the disposable worktree. See dod-gate-manual-dr…
New validation-ready: handoff is recognized as a non-gated handoff ✅ pass live fm_dod_accept_ship_done ship no-mistakes <unpushed worktree> <repo> 'validation-ready: implementation complete' returned success despite the commit being unpushed. See dod-gate-manual-drive.txt
Adversarial: the gate still refuses a finished done: report (checks green) whose latest commit was not pushed ✅ pass live fm_dod_accept_ship_done ship no-mistakes <unpushed worktree> <repo> 'done: PR https://example.test/o/r/pull/1 checks green' failed with 'named head ... unreachable outside the worker copy'. See dod-ga…
validation-ready: wakes the supervisor (terminal verb, captain-relevant) rather than being silently ignored or read as a stalled worker ✅ pass live status_is_terminal_verb and status_is_captain_relevant both returned success for 'validation-ready [at=123]: implementation committed' when sourced directly from bin/fm-classify-lib.sh. See dod-gate-m…
Existing targeted automated tests for rendered instructions and status classification pass, including a handoff-event case ✅ pass live bash tests/fm-dod-lib.test.sh, bash tests/fm-brief.test.sh, bash tests/fm-crew-state.test.sh, bash tests/fm-inactive-reconcile.test.sh all completed with rc=0 and zero not ok lines, exercisi…
fm-task-delivery.test.sh and fm-watch-triage.test.sh full automated suites (Gerrit brief delivery contract test, classify primitives test) complete and pass ⏸️ untested no Both suites were launched in a background batch job that was confirmed stopped at its background time limit before fm-task-delivery and fm-watch-triage finished (fm-dod-lib, fm-brief, fm-crew-state, f…
  • bash tests/fm-dod-lib.test.sh (full suite, real git worktrees)
  • bash tests/fm-brief.test.sh (full suite)
  • bash tests/fm-crew-state.test.sh (full suite)
  • bash tests/fm-inactive-reconcile.test.sh (full suite)
  • Manual live drive: FM_HOME=/tmp/fm-live-dod/home ./bin/fm-brief.sh live-handoff-demo some-proj --mode no-mistakes (real rendered brief)
  • Manual live drive: FM_HOME=/tmp/fm-live-dod/home-gerrit ./bin/fm-brief.sh live-gerrit-demo review-server-project --mode no-mistakes --forge gerrit (real rendered brief)
  • Manual live drive: sourced bin/fm-dod-lib.sh and bin/fm-classify-lib.sh against a disposable git repo+worktree, called fm_dod_accept_ship_done, status_is_terminal_verb, status_is_captain_relevant directly
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

…tion_handoff (from this PR's validation-ready rename) treats any non-CI-ready no-mistakes ship `done:` note as a handoff, and fm-crew-state.sh's emit() exits before the done verb is ever classified as terminal. Two test fixtures (tests/fm-bearings-snapshot.test.sh, tests/fm-fleet-snapshot-view.test.sh) still used plain `done: complete` to simulate a finished ship, so they now observe `parked` instead of the expected `terminal_in_flight`, causing serial 7, serial 8, and the Stock macOS Bash job to fail. A prior (timed-out) agent run had already left the correct fix uncommitted in this worktree: both fixtures now create a real git commit with a refs/remotes/origin/main ref and use `done: PR https://example.test/o/r/pull/9 checks green`, satisfying the new CI-ready gate and restoring terminal_in_flight classification. I verified this fix under stock macOS Bash 3.2.57 (matching the CI runner): fm-bearings-snapshot.test.sh passes 60/60 (CI expects 60) and fm-fleet-snapshot-view.test.sh passes 18/18 (CI expects 18), matching the exact counts the Stock macOS Bash job asserts. I checked every other `done:` fixture in these files and across tests/ for the same invariant (kind=ship + mode=no-mistakes using a bare done: to mean finished) — all other occurrences are kind=scout/secondmate and unaffected, so no sibling site was left broken. I also sanity-ran tests/fm-dod-lib.test.sh (20/20) and tests/fm-crew-state.test.sh (283/283) to confirm no regression in the surrounding classification logic. No additional code changes were needed; the existing uncommitted diff (2 test files) is the complete, correct, minimal fix
…_claude_stop_hook_notifies_when_at_turn_downtime_write_fails (the "Behavior portable serial 1" failure) was genuinely flaky from a tight timing margin, not from this PR's handoff-wording change — confirmed no call path exists from the changed files (fm-crew-state.sh, fm-dod-lib.sh, fm-brief.sh, fm-classify-lib.sh, fm-inactive-reconcile.sh) into fm-supervision-host.sh or this test file. This test uniquely (the only case in the file using the fakebin/mktemp write-failure injection together with a real Stop-hook round trip) sends the close through the marker's quarantine + failure-notification path on top of the ordinary hook flow, which is heavier than the other hook cases sharing the same `wait_until 250 hook_exited` (25s) budget. Isolated local runs under stock macOS Bash 3.2.57 (matching the CI runner) measured 18.07s/17.39s/25.12s end-to-end before the fix — the last essentially at/over the 25s cap, matching a classic margin-flake shape under a loaded CI runner. Fix: bumped that one wait_until call from 250 to 400 ticks (tests/fm-supervision-host.test.sh:1456), matching the precedent already established elsewhere in this same file for heavier-than-usual host/hook-close waits (e.g. the 400-tick wait at line ~1872, and 300/450/2000 elsewhere). No other test shares this exact fakebin/mktemp + hook combination (grep confirmed only this one call site in the whole suite), so there was no sibling site to fix and no risk of leaving an equivalent flake elsewhere unaddressed. Verified: re-ran the isolated test function 3 times in separate process invocations under stock macOS Bash 3.2.57 — all 3 passed (21s, 26s, 26s), each comfortably under the new 40s ceiling, with the test's downstream assertions (exit code 2, failure notification, log markers) unchanged and still correctly checked. No implementation files were touched; only the test's wait budget changed, preserving the validation-ready handoff behavior from prior rounds untouched. A stray `bin/bin` symlink artifact and a temporary isolated-test helper script created during local verification were cleaned up; the working tree now contains only the one-file test timing fix
@ellshep
ellshep merged commit c361554 into main Oct 14, 2026
20 checks passed
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.

1 participant