Repository navigation
fix(bin): give the no-mistakes handoff its own status verb - #8
Merged
Merged
Conversation
…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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Intent
Investigate and fix the done confusion, and say where it came from.
Context: in no-mistakes ship tasks, workers append
doneright 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 worddonefor 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 usedoneonly for finished, and bin/fm-brief.sh callsdone:the gate that ends a stage. So a singledoneline 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
donecame frombed9bc27(delivery modes), which told a no-mistakes worker to reportdoneafter a local commit and again after the PR was green.ea3ac2e4(AFK idle fix) classified everydoneas 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 twodoneevents by note text to gate only the finished report, andfdd36879(Gerrit support) carried the same handoff into Gerrit.What Changed
validation-ready:status verb for the no-mistakes (and Gerrit) pre-validation handoff, replacing the overloaded pre-validationdone:while still recognizing a legacy pre-validationdone:from workers briefed before the new verb existed, via a newfm_dod_is_validation_handoffhelper inbin/fm-dod-lib.sh.bin/fm-classify-lib.shrecognizesvalidation-readyas a terminal/captain-relevant verb,bin/fm-crew-state.shmaps it toparkedand emits a "ready for validation" status,bin/fm-brief.shtells no-mistakes-mode workers to usevalidation-readyinstead ofdonefor the handoff, andbin/fm-inactive-reconcile.shexcludes validation handoffs (including the legacydone:form) from the ledger-first terminal-outcome path.docs/configuration.md,.agents/skills/firstmate-codexapp/SKILL.md, and.agents/skills/ship-landing/SKILL.mdto 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-fixturemode=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 (notdone:), names 'Firstmate starts the validation run' as who starts validation, and keeps the finished event as a distinctdone: PR ... checks green/published for reviewline; no legacydone: {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 newvalidation-ready:handoff and the legacy pre-fixdone:handoff are accepted without requiring the commit to be pushed, a finisheddone: PR ... checks greenwith an unpushed commit is still correctly refused by the named-head gate (adversarial check), andvalidation-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.validation-ready [at=<epoch>]: {summary}for handoff, line 143 usesdone [at=<epoch>]: PR {url} checks greenfor finished; Sta…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.shall completed with rc=0 and zeronot oklines, exercisi…Evidence: Rendered no-mistakes and Gerrit worker briefs (live script output)
Source: Rendered no-mistakes and Gerrit worker briefs (live script output)
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
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
✅ **Review** - passed
✅ No issues found.
validation-ready [at=<epoch>]: {summary}for handoff, line 143 usesdone [at=<epoch>]: PR {url} checks greenfor finished; Sta…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.shall completed with rc=0 and zeronot oklines, exercisi…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.