fix(bin): fall through unknown busy verdicts to terminal status-log verbs in fm-crew-state - #7
Merged
Merged
Conversation
When the busy-verdict source returns unknown, prefer a durable terminal status-log verb (done/failed/blocked/needs-decision/paused) over a dead-end unknown so supervisors still see answered questions. Live busy and idle verdicts keep winning; nonterminal working logs stay unknown.
…atus-log fallthrough
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
Close audit gap 2 in bin/fm-crew-state.sh: when the busy-verdict source returns unknown, fall through to the terminal status verbs instead of reporting a dead-end unknown.
Current behavior: fm-crew-state.sh consults the busy source (bin/fm-busy-lib.sh) and, when the verdict is unknown (unverified harness, unreadable pane, no busy source), it can report unknown even when the task's own status log already carries a terminal verb (done:, failed:, blocked:, needs-decision:) that answers the supervisor's actual question.
Fix: when and only when the busy verdict is unknown, let the classifier fall through to the durable status log's latest terminal verb and report that state with its source attributed as status-log (the existing done/failed reporting already has this shape). A live busy/idle verdict must keep winning over the status log; this fallthrough is strictly for the unknown case. Keep the source attribution honest in the output line so a supervisor can tell a run-step read from a status-log inference.
Extend the colocated tests (tests/fm-crew-state*.test.sh) with: unknown busy + terminal status -> terminal state reported from status-log source; unknown busy + only nonterminal status -> unknown preserved; live busy verdict + stale terminal status -> live verdict wins.
Acceptance: unknown busy-verdict falls through to terminal status verbs with honest source attribution, live verdicts still win, regression tests cover the three cases above, no-mistakes pipeline green with a PR on origin (Bloh09/firstmate) against main.
What Changed
bin/fm-crew-state.shnow handles an unknown busy verdict by falling through to the status log's latest terminal verb (done/failed/blocked/needs-decision/paused) and reporting that state withsource: status-log, instead of emitting a dead-end unknown. A nonterminal log line (working) still reports unknown with the pane source, and a live busy verdict still wins over any status log.tests/fm-crew-state.test.shadds three regression tests covering unknown busy + terminal log (terminal state from status-log), unknown busy + nonterminal log (unknown preserved), and live busy + stale terminal log (live verdict wins); the existing footer-text test now uses a nonterminal log line so it keeps asserting the no-promotion rule.docs/architecture.mddocuments the terminal-only fallthrough as the single path that reports a finished-style state on an unknown verdict, with the answer attributed to the status log rather than the unavailable busy read.Risk Assessment
✅ Low: The change is a small, well-bounded state-classifier adjustment that precisely implements the stated intent - live verdicts still win, only the unknown-busy dead end gains a terminal-verb fallthrough with honest source attribution - and it ships behavioral regression tests covering all three required cases plus updated docs, with no consumer-facing format change.
Testing
Ran the full colocated fm-crew-state suite on the target commit (all 52 tests pass, including the three new fallthrough cases), proved the new regression test fails against the base-commit script, and captured a before/after CLI transcript demonstrating all three acceptance behaviors end-to-end: unknown busy + done log now reports done from status-log, nonterminal logs keep unknown with pane source, and a live busy record still outranks a stale terminal log. No visual artifact applies since the end-user surface is the CLI output line, which the transcript shows directly.
Evidence: Before/after CLI transcript: unknown-busy fallthrough behavior
## BEFORE (base a2ba0ef) $ fm-crew-state.sh feat-evidence state: unknown · source: pane · harness state unavailable (unknown missing) ## AFTER (target 6f2f4e4) $ fm-crew-state.sh feat-evidence state: done · source: status-log · PR https://example.test/pr/42 checks green ## AFTER - nonterminal log keeps unknown state: unknown · source: pane · harness state unavailable (unknown missing) ## AFTER - live busy record beats stale done: log state: working · source: pane · harness busy (claude-hook)Evidence: Regression proof: new test fails on base commit
not ok - unknown busy + done log -> done (missing: 'state: done') --- output --- state: unknown · source: pane · harness state unavailable (unknown missing)Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
bin/fm-crew-state.sh:579- The terminal fallthrough set (bin/fm-crew-state.sh:578-580) includespausedin addition to the intent's enumerated terminal verbs (done/failed/blocked/needs-decision). This is a documented, deliberate superset -pausedis a declared external wait and belongs to the same wake-worthy verb family per the status-log taxonomy in the script header - and nothing in the intent forbids it, but the author should confirm the extension since the intent enumerated exactly four verbs.bin/fm-crew-state.sh:587- Minor redundancy:BUSY_FALLTHROUGH=allat bin/fm-crew-state.sh:552 is unconditionally assigned, so the re-assignment in theidle)case arm (line 557) and the${BUSY_FALLTHROUGH:-all}default in the final guard (line 587) are dead defensive duplicates. Harmless; could be simplified to one assignment plus a plain$BUSY_FALLTHROUGHreference.✅ **Test** - passed
✅ No issues found.
bash tests/fm-crew-state.test.shon target commit 6f2f4e4 - all 52 tests pass, including the three new g2 cases (test_unknown_busy_falls_through_to_terminal_status_log,test_unknown_busy_preserves_unknown_for_nonterminal_status_log,test_live_busy_wins_over_stale_terminal_status_log)Regression proof: re-ran the suite with the base-commit (a2ba0ef) version ofbin/fm-crew-state.shswapped in - the new test fails withnot ok - unknown busy + done log -> done, outputstate: unknown · source: pane; script restored to target afterward, worktree cleanManual end-to-end CLI check: staged a crew scenario (real git worktree on branch, meta, fake tmux pane painting 'esc to interrupt' with no semantic busy record) and ran base vs targetfm-crew-state.sh- base reports dead-end unknown, target reportsstate: done · source: status-logManual end-to-end CLI check: nonterminalworking:status log under unknown busy staysstate: unknown · source: paneManual end-to-end CLI check: armed and applied a live busy record via realbin/fm-busy-event.shwith a staledone:log - target reportsstate: working · source: paneVerifiedneeds-decision:maps toparkedinmap_log_state, so the terminal fallthrough set covers all four intent verbs✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.