Repository navigation
feat(bin): add fm-control park verb so stopped seats stop re-flagging stale - #7119
Open
RooseveltAdvisors wants to merge 3 commits into
Open
RooseveltAdvisors wants to merge 3 commits into
RooseveltAdvisors wants to merge 3 commits into
Conversation
Add fm-control.sh park <task-id> --until <UTC time> --reason <text>. It records that a ship or scout whose agent is already stopped is intentionally parked, by appending one supervisor paused declaration with an until time to the task status log. The record, endpoint, worktree and unlanded work are untouched, so teardown keeps refusing unlanded work. The watcher already absorbs a stopped seat with a declared pause and rechecks it on the long pause cadence, surfacing it again once the stated time passes, so no watcher change is needed. fm-crew-state now reports paused instead of unknown for a stopped seat whose declared pause names a time still ahead.
Owner
|
Speaking as Kun's firstmate: thanks @RooseveltAdvisors. I compared head Contract-class: opt-in. VISION.md
CI: Require no-mistakes SUCCESS (attestation MATCH). Behavior portable serial 4 failed on unrelated Status: waiting-ci. When green this is auto-merge eligible (opt-in). |
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
Add a supported way to record a task as intentionally parked with a stopped seat so supervision stops flagging it stale forever while unlanded work stays untouched (bead fm-parked-seat-stale-loop). Situation: a ship task has unlanded commits, its agent is deliberately stopped, and no work is planned until a later dispatch. The three existing tools each fail for the correct reason and must not be bent: a worker-appended paused line needs a live worker, fm-control.sh exit preserves the endpoint by design, and fm-teardown.sh refuses unlanded work, and that refusal must not change. Requirements stated on the bead: the park must be settable WITHOUT a live agent (the supervisor sets it), it must suppress the per-cycle stale noise without removing the endpoint record or touching unlanded work, and it must carry an expiry or recheck so a parked seat that later needs attention is never silent forever. Hard constraint: do not change bin/fm-watch.sh. Design chosen: a new fm-control.sh verb, park, with required --until and --reason. It refuses unless the backend classifier reads the agent dead or missing (a live worker declares its own wait), refuses secondmates (idle by design), and appends one stamped supervisor 'paused: ... until ' declaration to the task status log, verifying the shared classifier reads it back. It changes nothing else. Suppression then rides the watcher's EXISTING declared-wait cadence for a dead agent (absorbed, rechecked on the long pause cadence, resurfaced once the until time passes), which existing watcher tests already cover, so no watcher edit. fm-crew-state reports paused (source status-log, detail 'seat stopped') instead of unknown for a dead or missing tmux/herdr endpoint whose declared pause names an until time still ahead. After that time it falls back to the unchanged death verdicts, so the stale-claim sweep can reclaim it again. The word parked is deliberately not used as a crew-state state because crew-state already uses parked for a no-mistakes gate. Docs: docs/agent-control.md verb table row plus a one-line trigger in the stuck-crewmate-recovery skill.
What Changed
parkverb tobin/fm-control.sh, used aspark --until <YYYY-MM-DDTHH:MM[:SS]Z> --reason <text>. Both flags are required, and the--untiltime must be in the future. The verb refuses secondmates. It also refuses any seat whose backend classifier does not read the agent asdeadormissing. When it succeeds, it appends one stamped supervisorpaused: ... until <time>line to the task status log. It then confirms that the shared classifier reads that line back as the declared wait with the same recheck time. Nothing else changes: the record, endpoint, worktree and unlanded work stay as they were.bin/fm-watch.shis not modified.bin/fm-crew-state.shnow reportspausedinstead ofunknownfor a parked seat. The status source isstatus-logand the detail isseat stopped. This applies only to a dead or missing tmux/herdr endpoint whose declared pause has anuntiltime that has not passed yet. Once that time passes, the existing death verdicts apply again.parkrow in thedocs/agent-control.mdverb table, a one-line trigger in the stuck-crewmate-recovery skill, and a note indocs/architecture.md. Added tests intests/fm-control.test.shandtests/fm-crew-state.test.sh.🤖 Generated with Claude Code
Risk Assessment
✅ Low: The change is small and additive. It adds an append-only verb that refuses live agents and secondmates and checks --until up front, plus a crew-state branch that only applies to dead or missing tmux/herdr endpoints. fm-watch.sh is untouched and teardown's refusal to remove unlanded work is unchanged. The only defect found is a rare mismatch in how the postcondition reads back the time.
Testing
I drove the real fm-control.sh park, fm-crew-state.sh and fm-teardown.sh scripts against two disposable labs: one with a private tmux server running real shell and claude panes, and one guarded non-default Herdr session. Both labs were torn down afterwards. The round-1 failure is fixed: a parked seat whose shell pane is still readable now reports paused on both backends. All other intent scenarios passed live. These were the park write with no side effects, the refusals, expiry fallback to the old verdict, the missing-endpoint paused report, and teardown still refusing unlanded work. This is a CLI change with no UI, so the evidence is CLI transcripts. The check that bin/fm-watch.sh was not modified is a static diff check, so it is marked untested rather than live.
paused · status-log · seat stoppedfor a parked tmux seat whose shell pane is still open (the round-1 failure)git diff 20dcbf91 HEAD -- bin/fm-watch.sh) with no runtime surface to drive.Evidence: tmux lab transcript (park, crew-state, refusals, teardown)
Source: tmux lab transcript (park, crew-state, refusals, teardown)
Evidence: Herdr lab transcript (park + crew-state on readable shell pane)
Source: Herdr lab transcript (park + crew-state on readable shell pane)
Evidence: Key crew-state lines after park (tmux, readable shell pane)
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
bin/fm-control.sh:1233- The park postcondition can fail after the line is already written when --reason contains its ownuntil <time>token in a different precision from --until. Example:--reason "vendor says until 2026-12-01T00:00Z" --until 2026-11-01T00:00:00Z. status_paused_until (bin/fm-classify-lib.sh:430) runs the minute-format sed expression first, so it returns the time from the reason text instead of the --until time. The read-back check at bin/fm-control.sh:1238 then dies, but the line has already been appended at :1233. That leaves a declaration whose effective recheck time is the one in the reason. The fix is to refuse a --reason that contains anuntil <time>token during argument validation (bin/fm-control.sh:~329), before anything is appended.🔧 **Test** - 3 issues found → auto-fixed ✅
bin/fm-crew-state.sh:1306- The new paused branch sits insideif ! pane_readable, so it only runs when the pane cannot be read. A stopped seat whose shell pane is still open is readable. That pane is whatexitleaves behind, and it is thedeadstate thatparkitself requires. It goes to the busy-verdict path and emitsunknown · pane · harness state unavailable. Live: parked tmux pane (classifier=dead) gaveunknown, and parked Herdr pane (classifier=dead) gaveunknown. This breaks the intent's requirement that a dead or missing tmux/herdr endpoint with a future until time reportspaused · status-log · seat stopped. The unit test only covers the missing-endpoint path, using FM_FAKE_TMUX_MISSING. Fix: apply the same dead/missing + future-until check when the pane is readable but the busy verdict is notbusy, and add a test for a readable shell-only pane.bin/fm-crew-state.sh:323- This is not caused by this change, but it hides the park branch on this host. With tmux 3.7b,tmux display-message -p -t <missing-session>:<win>exits 0 with empty fields, and a missing window in a live session resolves to another pane. Sopane_readablesucceeds for a missing tmux endpoint (classifier=missing), and crew-state never reaches the missing/dead branch, including the new paused report. Live tmux runs with the session killed still printedunknown · pane. Consider probing withlist-panes -t(which errors correctly) or with the window inventory.parked t1 until=... agent=dead backend=tmux, status log has onepaused [at=...]: parked by the supervisor with the seat stopped - held for a later dispatch until ...line(no status log written)sleeppane classifiedambiguouswas refused withrefusing to park a seat that is not proven stoppedREFUSED: worktree ... has work not on any remote and not landed, worktree and HEAD intactparked t1 ... agent=dead backend=herdrstate: paused · source: status-log · ... · seat stopped. On tmux 3.7b the same case staysunknown · panebecausedisplay-messagesucceeds on mis…state: unknown · source: pane · harness state unavailable (unknown missing)state: unknown · source: none · backend target gone: ...Lab home viabin/fm-lab-home.sh create+ private tmux socket (fm-lab-home.sh tmux-dir); real git project/worktree with an unlanded commit; ship meta pointing at a real tmux window runningbash --norc(stopped agent), a secondmate meta, and aclaude-argv0 live panebin/fm-control.sh t1 parkwith missing --until, past --until, malformed --until, missing --reason,exit --until, and a secondmate: each refused, no status log writtenbin/fm-control.sh t1 park --until <now+2h> --reason ...on a dead tmux pane, then checked status log, meta, worktree HEAD and tmux windowsbin/fm-teardown.sh t1after parking: REFUSED unlanded work, worktree and HEAD intactbin/fm-crew-state.sh t1on tmux: dead pane parked, endpoint session killed (classifier=missing), expired park, re-park of a missing endpointHerdr labbin/fm-herdr-lab.sh provision fm-lab-park-hd-*with the e2e session shim; real shell-only pane plus full herdr_* meta;fm-control.sh park(agent=dead) andfm-crew-state.shfor dead, missing (pane closed) and expired; lab torn downbash tests/fm-control.test.sh(park tests ok) andbash tests/fm-crew-state.test.sh(all 285 ok, including the parked-seat test)🔧 Fix applied.
✅ Re-checked - no issues remain.
paused · status-log · seat stoppedfor a parked tmux seat whose shell pane is still open (the round-1 failure)git diff 20dcbf91 HEAD -- bin/fm-watch.sh) with no runtime surface to drive.bin/fm-crew-state.sh t1before and afterbin/fm-control.sh t1 park --until 2099-01-01T00:00Z --reason ...on a real private tmux server (tmux -L fm-lab, lab FM_HOME frombin/fm-lab-home.sh create). The pane was a plain zsh shell, read as classifier dead.Checked meta checksum, worktree HEAD, unlanded file and tmux window after the park: all unchanged.Expired park line (until 2000-01-01) → crew-state, tmuxKilled the tmux window (missing endpoint) with a future park → crew-statefm-control.sh parkrefusals: a real runningclaudepane, a secondmate, a past --until, missing --until, malformed --until, missing --reason, and--untilon theexitverb. Also checked that no status log was written.bin/fm-teardown.sh t1after the park, on a worktree holding an unlanded commitGuarded Herdr lab (bin/fm-herdr-lab.sh name/provision/run/teardown, herdr 0.9.3), plain shell pane w1:p1 with agent=null: crew-state before the park, park, crew-state after, then an expired park. Lab teardown confirmed with rc=0.git diff 20dcbf91 HEAD -- bin/fm-watch.shis empty (watcher not edited)✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.