Skip to content

feat(bin): add park/unpark control verbs to suppress watcher loops on stopped seats - #7045

Open
RooseveltAdvisors wants to merge 4 commits into
kunchenguid:mainfrom
RooseveltAdvisors:fm/fm-parked-seat-fix
Open

RooseveltAdvisors wants to merge 4 commits into
kunchenguid:mainfrom
RooseveltAdvisors:fm/fm-parked-seat-fix

Conversation

@RooseveltAdvisors

@RooseveltAdvisors RooseveltAdvisors commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

Intent

Add supported parked-seat record to suppress stale loop on stopped seats

What Changed

  • Added park and unpark verbs to the bin/fm-control.sh allowlist. park stops the agent if it is running. It then writes parked=1, parked_at, and an optional parked_note to the task meta under the meta lock and publishes the update atomically. It also clears the endpoint's stale, hash, paused, writing, and subsuper markers. The worktree, unlanded commits, and the endpoint record are left as they are. unpark removes the parked fields. --note/--note-file now work with park as well as relaunch.
  • Parked metas are now skipped by the fm-watch.sh probing loops (recorded_windows, secondmate wake-stall, and secondmate liveness ticks) and by the fm-bootstrap.sh secondmate liveness sweep. This stops the stale-loop behaviour and auto-relaunch on parked seats. fm-crew-state.sh now reports a parked state, plus the note if one was given. fm-spawn.sh treats the parked keys as spawn-owned, so they are dropped on relaunch and a relaunched task starts unparked.
  • Updated docs/agent-control.md, docs/architecture.md, and docs/scripts.md to cover the new verbs. Added tests/fm-parked-seat.test.sh and extended the control, relaunch, and crew-state tests.

🤖 Generated with Claude Code

Risk Assessment

⚠️ Medium: The park verb does what it says for fm-control-only workflows. But any relaunch outside fm-control keeps the parked flag, so a live agent drops out of supervision, a parked secondmate is auto-relaunched, and changing the shared target helper's default quietly changes busy classification and send routing for parked tasks.

Testing

Each live scenario ran in its own throwaway lab home with a private tmux server. They used the real fm-control park/unpark, fm-watch, fm-crew-state, fm-teardown and secondmate_liveness_tick code. One run used a real Claude CLI seat. Every live scenario produced its expected result. This includes a before-and-after control that a run without the fix would fail: unparked stopped seats raise a stale wake, parked ones do not, and unparking brings the wake back. The fm-spawn --relaunch path was not driven live, so that scenario is untested. Its focused test, which uses a stubbed tmux, passes. The four targeted test files also pass. All lab homes were removed. So were the CLAUDE.md edit and the .codegraph/ folder that an auto-index hook added to the worktree. There is no UI surface, so the evidence is CLI transcripts.

  • Live validation: ✅ go - 8 of 9 scenarios driven live against the product
Scenario Result Live Evidence
Operator parks a stopped seat with a note; the record shows parked=1, parked_at and parked_note, the stale markers are cleared, and the worktree commits are unchanged ✅ pass live park-live-drive.log S1: 'parked t1 exit_result=already-stopped ... note="waiting on upstream fix"', meta has parked keys, '(none)' markers, HEAD preserved: yes
Watcher stops raising stale wakes for a parked stopped seat but still raises them for an unparked one ✅ pass live park-live-drive.log S0 baseline 'stale: fmses:fm-t1'; S3 with t1 parked only 'stale: fmses:fm-t2' and no t1 markers; S4 with both parked the watcher blocks 12s twice with no wake and creates no marker…
Unpark restores watcher stale detection for the seat ✅ pass live park-live-drive.log S5: 'unparked t1', no parked keys left, watcher outputs 'stale: fmses:fm-t1'
fm-crew-state reports a parked seat as state parked with the note ✅ pass live park-live-drive.log S2 and park-real-claude.log: 'state: parked · source: none · seat parked with unlanded work · hold for review'
Parking a running Claude seat stops the agent but keeps the window and endpoint ✅ pass live park-real-claude.log: pane_current_command claude -> bash, 'parked c1 exit_result=stopped', window still exists: yes, markers cleared
Adversarial: teardown of a parked seat with unlanded commits is still refused ✅ pass live park-live-drive.log S7: 'REFUSED: worktree ... has work not on any remote and not landed', rc=1, worktree and HEAD intact
Adversarial: --note on a verb other than park or relaunch is refused, and an unknown verb is refused ✅ pass live park-live-drive.log S6: rc=1 '--note and --note-file apply to 'relaunch' and 'park' only'; rc=2 for 'bogus' with the allowlist that includes park/unpark
A parked secondmate with a dead endpoint is not auto-relaunched; after unpark it is eligible again ✅ pass live park-secondmate-liveness.log: the first tick binds only sm2 (unparked); after 'unparked sm1' the tick binds sm1 as well
fm-spawn --relaunch of a parked seat clears the parked record ⏸️ untested no The earlier payload did not show a live result for this scenario. Only the focused test tests/fm-control-relaunch.test.sh was run, and it uses a stubbed tmux. A live check needs a full harness launch…
Evidence: Live drive: park/watch/crew-state/unpark/teardown on stopped tmux seats

Source: Live drive: park/watch/crew-state/unpark/teardown on stopped tmux seats

=== S0 baseline: both seats unparked and stopped; real watcher run
  [watcher rc=0 (124=blocked, no wake)]
    out: stale: fmses:fm-t1
--- stale markers after baseline:
.count-fmses_fm-t1
.count-fmses_fm-t2
.hash-fmses_fm-t1
.hash-fmses_fm-t2
.stale-fmses_fm-t1

=== S1 park t1 (stopped seat) with note
parked t1 exit_result=already-stopped harness=claude backend=tmux endpoint=fmses:fm-t1 worktree=/tmp/fm-lab.kE0OMc/wt-t1 note="waiting on upstream fix"
rc=0
--- t1.meta:
window=fmses:fm-t1
endpoint_task_id=t1
worktree=/tmp/fm-lab.kE0OMc/wt-t1
project=/tmp/fm-lab.kE0OMc/proj
harness=claude
kind=ship
mode=no-mistakes
yolo=off
model=default
effort=default
backend=tmux
parked=1
parked_at=2026-10-11T06:15:47Z
parked_note=waiting on upstream fix
--- t1 markers left:
(none)
--- worktree HEAD preserved: yes

=== S2 crew-state on parked t1 and unparked t2
state: parked · source: none · seat parked with unlanded work · waiting on upstream fix

state: unknown · source: pane · harness state unavailable (unknown missing)


=== S3 real watcher with t1 parked, t2 unparked (clear t2 markers so it re-wakes)
  [watcher rc=0 (124=blocked, no wake)]
    out: check: rearm-resurface
  [watcher rc=0 (124=blocked, no wake)]
    out: stale: fmses:fm-t2
--- t1 markers after watcher runs:
(none — parked t1 never probed)

=== S4 adversarial: park only t2 -> watcher has nothing stale to report
parked t2 exit_result=already-stopped harness=claude backend=tmux endpoint=fmses:fm-t2 worktree=/tmp/fm-lab.kE0OMc/wt-t1
rc=0
  [watcher rc=0 (124=blocked, no wake)]
    out: check: rearm-resurface
  [watcher rc=124 (124=blocked, no wake)]
  [watcher rc=124 (124=blocked, no wake)]
    out: Terminated
--- probe markers for any seat:
(none — no parked seat probed)

=== S5 unpark t1 -> watcher probes it again and surfaces stale
unparked t1 harness=claude backend=tmux endpoint=fmses:fm-t1 worktree=/tmp/fm-lab.kE0OMc/wt-t1
rc=0
(no parked keys in t1.meta)
  [watcher rc=0 (124=blocked, no wake)]
    out: stale: fmses:fm-t1
  [watcher rc=0 (124=blocked, no wake)]
    out: check: rearm-resurface
state: unknown · source: pane · harness state unavailable (unknown missing)


=== S6 adversarial: --note on non-park verb refused; unknown verb refused
error: --note and --note-file apply to 'relaunch' and 'park' only
rc=1
error: 'bogus' is not a control verb
allowed verbs:
  interrupt
  exit
  relaunch
  park
  unpark
rc=2

=== S7 teardown refuses parked t2? (t2 shares worktree with unlanded commit)
REFUSED: worktree /tmp/fm-lab.kE0OMc/wt-t1 has work not on any remote and not landed.
unpushed commits:
1013023 unlanded wip
04b074b init
Push the branch, land its PR, or get the captain's explicit OK to discard, then --force.
rc=1
--- worktree still present: yes; HEAD preserved: yes
Evidence: Live drive: park a running real Claude CLI seat

Source: Live drive: park a running real Claude CLI seat

--- pane before park (tail):
 ▝▝   ▝▝   ~/.no-mistakes/worktrees/46339c0817e0/01M4MS06G9S33D5BZ6SM6RFZQW
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
❯ Try "edit herdr.sh to..."
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
  cl arcs Opus 5.5(1M)                                                                                                                                                              ◐ medium · /effort
  ⏸ manual mode on · ← 1 agent
--- pane_current_command before: claude
=== park running claude seat
parked c1 exit_result=stopped harness=claude backend=tmux endpoint=fmses:fm-c1 worktree=~/.no-mistakes/worktrees/46339c0817e0/01M4MS06G9S33D5BZ6SM6RFZQW note="hold for review"
rc=0
--- pane_current_command after: bash
--- window still exists: yes
parked=1
parked_at=2026-10-11T06:17:34Z
parked_note=hold for review
(stale markers cleared)
state: parked · source: none · seat parked with unlanded work · hold for review
Evidence: Live drive: secondmate liveness tick skips parked mates

Source: Live drive: secondmate liveness tick skips parked mates

=== tick: sm1 parked, sm2 unparked (both endpoints gone)
check: secondmate sm2 auto-relaunch paused after 0 attempts in 3600s; endpoint still missing - relaunch it manually or retire the route
  bound markers: .secondmate-relaunch-bound-sm2
=== unpark sm1 via fm-control, tick again
unparked sm1 harness=claude backend=tmux endpoint=gone:fm-sm1 worktree=/tmp/fm-lab.yqCnjc/sub-sm1
check: secondmate sm1 auto-relaunch paused after 0 attempts in 3600s; endpoint still missing - relaunch it manually or retire the route
  bound markers: .secondmate-relaunch-bound-sm1
.secondmate-relaunch-bound-sm2

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

⚠️ **Review** - 5 issues (1 error, 2 warnings, 2 infos)
  • 🚨 bin/fm-spawn.sh:5188 - A relaunch that does not go through fm-control keeps parked=1 on the task, so a live agent ends up hidden from supervision. preserve_relaunch_meta copies every key it does not own, and parked, parked_at and parked_note are not in its owned list. Only fm-control relaunch clears the flag afterwards (fm-control.sh:1163). Example: an operator runs fm-control t1 park and later resumes the seat with the documented fm-spawn.sh t1 --relaunch (docs/agent-control.md:88). The new agent is alive, but the record still says parked=1. As a result, fm-watch recorded_windows (fm-watch.sh:821) never probes it for stale or wedge, fm-crew-state reports state: parked, fm_busy_classify_meta returns unknown no-target, and fm-send refuses with 'no backend target recorded'. The secondmate liveness auto-relaunch has the same problem: fm_secondmate_liveness_relaunch calls fm-spawn the same way (fm-secondmate-liveness-lib.sh:291). It is worse there, because secondmate_liveness_tick (fm-watch.sh:1066-1080) never checks parked. The fallback to window (liveness-lib:216) reads the stopped secondmate as dead and auto-relaunches it on the next tick, which undoes the park. Fix: add parked parked_at parked_note to the owned keys in preserve_relaunch_meta, so any fresh launch clears the flag, and skip parked=1 metas in secondmate_liveness_tick and in the bootstrap sweep (fm-bootstrap.sh:754).
  • ⚠️ bin/fm-backend.sh:363 - fm_backend_target_of_meta is a shared helper, and the change makes it return an empty target for every parked task by default. Only five call sites opt back in with --include-parked. That suppression was meant for the watcher's probe loop, but it now also silently changes non-watcher callers. (1) fm-busy-lib.sh:1197 fm_busy_classify_meta returns unknown no-target. So fm-control <parked-id> exit against an agent that is alive and busy (for example one revived as described in F1) skips the interrupt-first branch at fm-control.sh:694 and types the exit command into a busy turn. (2) fm-send.sh:366/405/1019 refuse with a misleading 'no backend target recorded in meta' instead of saying the seat is parked. (3) fm-spawn.sh:3595 refuses a Herdr re-dispatch with 'existing metadata has no endpoint'. (4) fm-watch.sh:1017 hands an empty target to secondmate_in_active_turn and secondmate_ring_to_drain. Others: fm-supervise-daemon.sh:594/1389, fm-pending-reply-lib.sh:1635, fm-procevent.sh:865, fm-crew-state.sh:322. Fix: keep the helper's default unchanged and apply the parked=1 skip only where the intent needs it, in fm-watch recorded_windows and the stale and wedge loops. That also removes the need for the --include-parked flag and its order-insensitive argument parsing.
  • ⚠️ tests/fm-parked-seat.test.sh:313 - The test that runs the real watcher only proves an absence, and the same absence would hold with no fix at all. The watcher runs for 0.5s with FM_POLL=0.05, then the test asserts that no .stale-* marker or 'stale:' line appeared. Stale detection needs the pane hash to stay unchanged across a much longer time threshold, so an unparked stopped seat would also produce nothing in 0.5s. The assertion passes with the fix and would pass without it. Either remove this part, or reproduce the failure: stage an aged .hash-/.stale-since- marker so an unparked seat does emit a stale wake within the run, then show that the parked seat does not. The test also duplicates test_park_and_unpark in tests/fm-control.test.sh:1177 and test_parked_seat_in_metadata in tests/fm-crew-state.test.sh:1015.
  • ℹ️ bin/fm-control.sh:1163 - do_relaunch now calls update_meta_parked 0 after journal_write complete, on every relaunch, including tasks that were never parked. That adds an extra locked read and rewrite of the metadata each time. If that rewrite fails, die makes the command exit non-zero after the replacement agent is already live and the journal already says complete, so a successful relaunch is reported as a failure. Fix: only rewrite when parked=1 is present. Better still, rely on the spawn-side clear from F1 and drop this call.

🔧 Fix applied.
5 issues (1 error, 2 warnings, 2 infos) still open:

  • 🚨 bin/fm-spawn.sh:5188 - A relaunch that does not go through fm-control keeps parked=1 on the task, so a live agent ends up hidden from supervision. preserve_relaunch_meta copies every key it does not own, and parked, parked_at and parked_note are not in its owned list. Only fm-control relaunch clears the flag afterwards (fm-control.sh:1163). Example: an operator runs fm-control t1 park and later resumes the seat with the documented fm-spawn.sh t1 --relaunch (docs/agent-control.md:88). The new agent is alive, but the record still says parked=1. As a result, fm-watch recorded_windows (fm-watch.sh:821) never probes it for stale or wedge, fm-crew-state reports state: parked, fm_busy_classify_meta returns unknown no-target, and fm-send refuses with 'no backend target recorded'. The secondmate liveness auto-relaunch has the same problem: fm_secondmate_liveness_relaunch calls fm-spawn the same way (fm-secondmate-liveness-lib.sh:291). It is worse there, because secondmate_liveness_tick (fm-watch.sh:1066-1080) never checks parked. The fallback to window (liveness-lib:216) reads the stopped secondmate as dead and auto-relaunches it on the next tick, which undoes the park. Fix: add parked parked_at parked_note to the owned keys in preserve_relaunch_meta, so any fresh launch clears the flag, and skip parked=1 metas in secondmate_liveness_tick and in the bootstrap sweep (fm-bootstrap.sh:754).
  • ⚠️ bin/fm-backend.sh:363 - fm_backend_target_of_meta is a shared helper, and the change makes it return an empty target for every parked task by default. Only five call sites opt back in with --include-parked. That suppression was meant for the watcher's probe loop, but it now also silently changes non-watcher callers. (1) fm-busy-lib.sh:1197 fm_busy_classify_meta returns unknown no-target. So fm-control <parked-id> exit against an agent that is alive and busy (for example one revived as described in F1) skips the interrupt-first branch at fm-control.sh:694 and types the exit command into a busy turn. (2) fm-send.sh:366/405/1019 refuse with a misleading 'no backend target recorded in meta' instead of saying the seat is parked. (3) fm-spawn.sh:3595 refuses a Herdr re-dispatch with 'existing metadata has no endpoint'. (4) fm-watch.sh:1017 hands an empty target to secondmate_in_active_turn and secondmate_ring_to_drain. Others: fm-supervise-daemon.sh:594/1389, fm-pending-reply-lib.sh:1635, fm-procevent.sh:865, fm-crew-state.sh:322. Fix: keep the helper's default unchanged and apply the parked=1 skip only where the intent needs it, in fm-watch recorded_windows and the stale and wedge loops. That also removes the need for the --include-parked flag and its order-insensitive argument parsing.
  • ⚠️ tests/fm-parked-seat.test.sh:313 - The test that runs the real watcher only proves an absence, and the same absence would hold with no fix at all. The watcher runs for 0.5s with FM_POLL=0.05, then the test asserts that no .stale-* marker or 'stale:' line appeared. Stale detection needs the pane hash to stay unchanged across a much longer time threshold, so an unparked stopped seat would also produce nothing in 0.5s. The assertion passes with the fix and would pass without it. Either remove this part, or reproduce the failure: stage an aged .hash-/.stale-since- marker so an unparked seat does emit a stale wake within the run, then show that the parked seat does not. The test also duplicates test_park_and_unpark in tests/fm-control.test.sh:1177 and test_parked_seat_in_metadata in tests/fm-crew-state.test.sh:1015.
  • ℹ️ bin/fm-control.sh:1163 - do_relaunch now calls update_meta_parked 0 after journal_write complete, on every relaunch, including tasks that were never parked. That adds an extra locked read and rewrite of the metadata each time. If that rewrite fails, die makes the command exit non-zero after the replacement agent is already live and the journal already says complete, so a successful relaunch is reported as a failure. Fix: only rewrite when parked=1 is present. Better still, rely on the spawn-side clear from F1 and drop this call.
  • ℹ️ bin/fm-crew-state.sh:237 - The crew-state label always says seat parked with unlanded work for any parked=1 record, but fm-control park (bin/fm-control.sh:1262-1271) never checks whether the worktree actually has unlanded commits. Example: park a task whose branch is already merged. fm-crew-state then reports state: parked · source: none · seat parked with unlanded work, which is a wrong claim to the operator. Fix: change the detail to seat parked. The note suffix can stay. The same wording is asserted in tests/fm-crew-state.test.sh:1025 and is also used in the docs row docs/agent-control.md:38.
✅ **Test** - passed

✅ No issues found.

  • Live validation: ✅ go - 8 of 9 scenarios driven live against the product
Scenario Result Live Evidence
Operator parks a stopped seat with a note; the record shows parked=1, parked_at and parked_note, the stale markers are cleared, and the worktree commits are unchanged ✅ pass live park-live-drive.log S1: 'parked t1 exit_result=already-stopped ... note="waiting on upstream fix"', meta has parked keys, '(none)' markers, HEAD preserved: yes
Watcher stops raising stale wakes for a parked stopped seat but still raises them for an unparked one ✅ pass live park-live-drive.log S0 baseline 'stale: fmses:fm-t1'; S3 with t1 parked only 'stale: fmses:fm-t2' and no t1 markers; S4 with both parked the watcher blocks 12s twice with no wake and creates no marker…
Unpark restores watcher stale detection for the seat ✅ pass live park-live-drive.log S5: 'unparked t1', no parked keys left, watcher outputs 'stale: fmses:fm-t1'
fm-crew-state reports a parked seat as state parked with the note ✅ pass live park-live-drive.log S2 and park-real-claude.log: 'state: parked · source: none · seat parked with unlanded work · hold for review'
Parking a running Claude seat stops the agent but keeps the window and endpoint ✅ pass live park-real-claude.log: pane_current_command claude -> bash, 'parked c1 exit_result=stopped', window still exists: yes, markers cleared
Adversarial: teardown of a parked seat with unlanded commits is still refused ✅ pass live park-live-drive.log S7: 'REFUSED: worktree ... has work not on any remote and not landed', rc=1, worktree and HEAD intact
Adversarial: --note on a verb other than park or relaunch is refused, and an unknown verb is refused ✅ pass live park-live-drive.log S6: rc=1 '--note and --note-file apply to 'relaunch' and 'park' only'; rc=2 for 'bogus' with the allowlist that includes park/unpark
A parked secondmate with a dead endpoint is not auto-relaunched; after unpark it is eligible again ✅ pass live park-secondmate-liveness.log: the first tick binds only sm2 (unparked); after 'unparked sm1' the tick binds sm1 as well
fm-spawn --relaunch of a parked seat clears the parked record ⏸️ untested no The earlier payload did not show a live result for this scenario. Only the focused test tests/fm-control-relaunch.test.sh was run, and it uses a stubbed tmux. A live check needs a full harness launch…
  • Lab home (bin/fm-lab-home.sh create) + private TMUX_TMPDIR tmux server, real stopped seat panes fmses:fm-t1/fm-t2, run real bin/fm-watch.sh (FM_POLL=1) before and after bin/fm-control.sh t1 park --note ...
  • bin/fm-crew-state.sh t1 / t2 on parked vs unparked seats
  • bin/fm-control.sh t2 park then 3 real watcher runs with both seats parked (blocked 12s with no wake, no probe markers)
  • bin/fm-control.sh t1 unpark then real watcher run surfaces stale: fmses:fm-t1 again
  • Adversarial: fm-control t1 unpark --note x (rc=1) and fm-control t1 bogus (rc=2)
  • bin/fm-teardown.sh t1 on parked seat with unlanded commit -> REFUSED, worktree and HEAD intact
  • Real claude CLI seat in lab tmux: bin/fm-control.sh c1 park --note 'hold for review' -> exit_result=stopped, pane back to bash, window kept, parked=1, markers cleared, crew-state parked
  • Sourced real secondmate_liveness_tick in lab with relaunch budget 0: parked sm1 skipped, unparked sm2 bound; after fm-control sm1 unpark sm1 enters the relaunch path
  • bash tests/fm-parked-seat.test.sh
  • bash tests/fm-control-relaunch.test.sh (incl. test_spawn_relaunch_clears_the_parked_record)
  • bash tests/fm-crew-state.test.sh
  • bash tests/fm-control.test.sh (incl. test_park_and_unpark)
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

Add park and unpark verbs to the lifecycle control plane for stopped seats
with unlanded work. Suppress watcher endpoint probing when parked by default
in fm_backend_target_of_meta without removing the endpoint record or touching
unlanded commits. Report state: parked in fm-crew-state and preserve full
target resolution under --include-parked for snapshots and teardown. Preserve
authoritative unlanded-work refusal in fm-teardown.
…his PR's new test, tests/fm-parked-seat.test.sh. ShellCheck reported SC2034 ("variable appears unused") for FM_HOME, STATE and SCRIPT_DIR. Those three are set inside a subshell and then read by the fm-watch.sh script it loads, but ShellCheck is told not to follow that script (source=/dev/null), so it cannot see them being used. The rule that should hold is that every place in the test which sets variables for the loaded watcher is lint-clean. There are three such places, at the former lines 169, 182 and 195. CI only flagged the one at line 195, but I fixed all three the same way: a `# shellcheck disable=SC2034 # read by the sourced watcher at call time` comment above each, the same style used in tests/fm-parent-channel-scan-exclusion.test.sh:284. No behavior changed. Checks run: - `bin/fm-lint.sh tests/fm-parked-seat.test.sh` (the project linter, ShellCheck 0.11.0 with extended analysis) passes. - `shellcheck -x` on the file passes. - `bash tests/fm-parked-seat.test.sh` passes both of its tests. I did not act on the separate "Behavior portable serial 2" item. That check was cancelled without a result; nothing in the code caused it, and it needs your decision, not a code fix
@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: thank you, @RooseveltAdvisors. A stopped seat that keeps raising stale wakes is real noise, and the live drive is thorough (8/9). This is my first stamp. I read head b4208a8c against main 072a7da3. The no-mistakes check is green and the attestation matches. One CI job, Behavior portable serial 2, was cancelled at the 30-minute cap. That also happens on main, so I reran the failed jobs.

Contract-class: opt-in. Nothing parks unless someone runs fm-control.sh <id> park. With no parked meta, the watcher, bootstrap and crew-state paths are unchanged, and fm-spawn --relaunch drops the parked keys.

VISION: One captain: aligns (less noise, and crew-state shows parked with the note). Authority: aligns (an explicit verb). Scripts/agents: aligns. Restart: aligns (a durable meta record). Spine: cannot tell. "A new task shape earns its way in only when existing primitives genuinely cannot compose." This adds a new seat state and new control verbs. Open PRs already cover parked or stopped seats: #6692 parks deliberately stopped tasks instead of escalating them as stale, and #6191 reports declared pauses for parked seats. Vendor: aligns. Scope: aligns. The fm-spawn --relaunch path is not live-tested.

Because this is a new control-plane primitive with overlapping proposals, Kun decides whether this shape is the one to adopt. That decision comes once CI is green. Two notes would help him: how this relates to #6692 and #6191, and whether AGENTS.md or the first mate needs to know when to park. A live fm-spawn --relaunch of a parked seat would close the last gap, if you can.

Status: waiting on CI (rerun), then Kun (merge-or-leave).

@3264studios

Copy link
Copy Markdown
Contributor

A concrete use case for this, from ordinary operation, in case it helps the merge-or-leave call.

Situation. A home runs several persistent second mates on one provider. That provider's weekly quota ran out mid-week, so every second mate was idle, unable to work, and still costing quota on each supervision wake. The operator wanted to stop them all, keep their homes and backlogs intact, and start them again when capacity returned. That is the full-fleet-stop case #7019 describes.

What happens on main today (read on 21180385):

  • fm-control.sh <id> exit stops the agent. The next secondmate_liveness_tick in bin/fm-watch.sh then classifies the endpoint relaunchable and relaunches it, so the stop is undone within about a minute.
  • The only thing that holds the stop is the watcher's own crash-loop marker, state/.secondmate-relaunch-bound-<id>. Writing it by hand before exit keeps the watcher quiet. But that marker records "this mate keeps dying", not "an operator stopped this mate". Its escalation text says so, and a live probe clears it.
  • secondmate_liveness_one in bin/fm-bootstrap.sh never reads that marker, so the next session start in the parent home relaunches every stopped mate anyway.

So an operator who needs a durable stop today has to reuse a crash-loop record for a purpose it was not designed for, and still loses the stop at the next session start. An explicit park verb that the watcher and the session-start sweep both honor is the missing primitive. #6692 and #6191 cover stale escalation and pause reporting for parked crew seats. Judging by their diffs, neither one touches the second-mate liveness relaunch in the watcher tick or the session-start sweep.

A natural follow-up, not needed for this PR: waking a parked second mate automatically when work is routed to it, for example when fm-send.sh targets a parked mate. It would then be asleep until needed, rather than stopped until someone remembers to unpark it.

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.

3 participants