Skip to content

fix(bin): report declared pauses instead of unknown for parked crew seats - #6191

Open
RooseveltAdvisors wants to merge 3 commits into
kunchenguid:mainfrom
RooseveltAdvisors:fm/fm-parked-seat-stale-loop
Open

RooseveltAdvisors wants to merge 3 commits into
kunchenguid:mainfrom
RooseveltAdvisors:fm/fm-parked-seat-stale-loop

Conversation

@RooseveltAdvisors

Copy link
Copy Markdown
Contributor

Intent

A seat that is intentionally stopped while it holds unlanded work cannot be read as parked, so supervision never sees its pause and keeps treating it as unexplained silence. Reproduced this tick on two long-parked tasks: bin/fm-crew-state.sh answers state: unknown - source: run-step - selected run code identity unverified for a task whose worktree still holds two unlanded modified files with its seat gone, and state: unknown - source: none - worktree gone for another - even though BOTH status logs carry a declared pause. A declared wait that the supervisor cannot read is not a declared wait.

What Changed

  • bin/fm-crew-state.sh: emit now checks the current status-log line before it prints any unknown verdict. If that line is a pause, the output becomes state: paused · source: status-log, followed by the pause note and then the original unknown detail. Unknown verdicts with the remote-endpoint source are exempt. A pause that a later status event has superseded no longer counts, so the verdict stays unknown.
  • This lets supervision read a declared wait for a seat that was stopped on purpose while it still holds unlanded work. That covers a gone endpoint, a torn-down worktree, and a run whose code identity can't be verified.
  • tests/fm-crew-state.test.sh: five regression tests cover these cases:
    • a dead window with a current pause reads paused
    • a torn-down worktree with a current pause reads paused
    • an unverified run identity with a current pause reads paused
    • a dead window with no pause stays unknown
    • a dead window whose pause was superseded stays unknown

🤖 Generated with Claude Code

Risk Assessment

✅ Low: The change is limited to one emit choke point: a current declared pause turns every non-remote unknown verdict into paused and keeps the original evidence in the detail. It reuses status_current_line, so a pause that was superseded or is not current cannot hide real silence. The only machine consumer (crew_absorb_class) parses just the state and source, and new behavior-level tests cover the dead-window, torn-down-worktree, run-step, superseded-pause and no-pause cases.

Testing

I ran the targeted fm-crew-state behaviour suite and it passes on the target commit. Its new regressions fail on the base script, which proves they catch the reported bug. I also captured a before/after CLI transcript of the two scenarios from the intent. On the base commit it gives the exact reported lines: unknown · run-step · selected run code identity unverified and unknown · none · worktree gone. On the fix both read paused · status-log · <pause reason> · <original evidence>. No UI surface is involved; temporary harness files were removed and the worktree is clean.

Evidence: Before/after fm-crew-state transcript for the two parked-seat scenarios from the intent

Source: Before/after fm-crew-state transcript for the two parked-seat scenarios from the intent

BEFORE: state: unknown · source: run-step · selected run code identity unverified; run ids: 01RUN BEFORE: state: unknown · source: none · worktree gone (torn down?) AFTER: state: paused · source: status-log · holding for upstream release before landing · selected run code identity unverified; run ids: 01RUN AFTER: state: paused · source: status-log · waiting on captain decision · worktree gone (torn down?)

=== BEFORE (base c35b9a69) ===
## case 1: seat gone, worktree holds 2 unlanded files, run identity unverified
$ cat state/parked-a.status
paused: holding for upstream release before landing
$ git -C wt status --short
?? a.txt
?? b.txt
$ fm-crew-state.sh parked-a
state: unknown · source: run-step · selected run code identity unverified; run ids: 01RUN

## case 2: worktree gone, declared pause
$ cat state/parked-b.status
paused: waiting on captain decision
$ fm-crew-state.sh parked-b
state: unknown · source: none · worktree gone (torn down?)

=== AFTER (e4e40fb3) ===
## case 1: seat gone, worktree holds 2 unlanded files, run identity unverified
$ cat state/parked-a.status
paused: holding for upstream release before landing
$ git -C wt status --short
?? a.txt
?? b.txt
$ fm-crew-state.sh parked-a
state: paused · source: status-log · holding for upstream release before landing · selected run code identity unverified; run ids: 01RUN

## case 2: worktree gone, declared pause
$ cat state/parked-b.status
paused: waiting on captain decision
$ fm-crew-state.sh parked-b
state: paused · source: status-log · waiting on captain decision · worktree gone (torn down?)

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

🔧 **Review** - 2 issues found → auto-fixed ✅
  • ⚠️ bin/fm-crew-state.sh:229 - When emit turns an unknown verdict into paused, it replaces the original detail with the pause note, so the evidence behind the unknown disappears. For example, a dead tmux window with paused: holding for X now reports state: paused · source: status-log · holding for X, and 'backend target gone: fm:...' / 'worktree gone (torn down?)' / 'selected run code identity unverified; run ids: ...' are all dropped. A supervisor or the captain reading the line cannot tell that the seat is gone or the worktree is missing, which the intent's parked-seat case needs to know (for example, whether to relaunch or tear down after the wait clears). crew_absorb_class only parses state and source, so appending the original detail after the pause note (e.g. detail="$(status_line_note "$current")${detail:+${SEP}$detail}") keeps the evidence and changes no consumer.
  • ℹ️ tests/fm-crew-state.test.sh:3032 - The new tests cover the endpoint-gone and worktree-gone cases, but not the run-step case the intent reproduced ('state: unknown - source: run-step - selected run code identity unverified' with a declared pause). emit handles all sources centrally, so the behaviour follows, but a regression test on one run-step unknown path with a current pause would pin the reported failure directly.

🔧 Fix: Keep unknown evidence in paused output; add run-step test
✅ Re-checked - no issues remain.

✅ **Test** - passed

✅ No issues found.

  • bash tests/fm-crew-state.test.sh at target e4e40fb3: every case passes, including the 5 new ones (dead window with pause, dead window without pause, torn-down worktree with pause, superseded pause, run-step 'selected run code identity unverified' with pause)
  • Fail-before check: swapped in git show c35b9a69:bin/fm-crew-state.sh and ran the same suite; it failed at test_dead_window_declared_pause_reads_paused with state: unknown · source: none · backend target gone. Restored with git checkout -- bin/fm-crew-state.sh
  • Manual before/after CLI transcript using the suite's hermetic fakes (fake tmux with the window gone, fake no-mistakes run record whose identity cannot be verified, a real git worktree holding 2 unlanded files, and a missing-worktree case), each with a paused: status log, run through bin/fm-crew-state.sh on the base and target commits
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

@greptile-apps

greptile-apps Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 4/5

[Medium risk] Changes how crew state reports parked seats with pauses.

The PR appears safe to merge, though a regression test should pin the remote-endpoint exception.

Reviews (1) · Last reviewed commit: "no-mistakes(document): Clarify crew-stat..."

# holds unlanded work - endpoint gone, no attributable run - is a crew on a
# DECLARED wait, not unexplained silence. A current paused: declaration in the
# status log outranks every unknown verdict (emit's declared-pause read owns
# the rule for every source except remote-endpoint). Both directions pin the

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Remote exception lacks a test. The new tests cover several cases where unknown becomes paused, but none checks the remote-endpoint exception. A test with a current paused: log and an unreachable or dead remote endpoint would catch a future regression that hides a remote connectivity failure as a declared wait.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

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