Skip to content

fix(bin): answer Claude's exit picker in fm-control exit and fix inbox retry and cursor lookups - #7484

Open
AgardnerAU wants to merge 5 commits into
kunchenguid:mainfrom
AgardnerAU:fm/fm-supervision-small-fixes
Open

AgardnerAU wants to merge 5 commits into
kunchenguid:mainfrom
AgardnerAU:fm/fm-supervision-small-fixes

Conversation

@AgardnerAU

@AgardnerAU AgardnerAU commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Intent

Check any of our submissions to Kun Chen's repos to see if they need action from us; if so and it makes sense, use codex to review them and resubmit; if unsure, wait.

Context: a read-only triage (data/upstream-pr-triage-2026-10-30/report.md, 2026-10-31) found these AgardnerAU PRs on kunchenguid/firstmate now conflict with current main and need a refresh, with no scope or design choice:

What Changed

  • fm-control exit now answers the adapter's own exit confirmation dialog instead of always refusing it. The dialog is named by the new fm_control_exit_confirm_dialog function. Today only Claude's background-task exit picker is answered. The answer is one Enter on its preselected "Exit and stop tasks" row, sent at most once for each exit, including on the re-read after the stop wait times out. Other recognised dialogs, and a picker that stays open after the answer, still refuse as blocked on a prompt. The docs and the verification record now describe this behaviour and the live re-measurement.
  • The task inbox (new fm_task_inbox_due_retry helper) now re-rings a newer record's due retry when the oldest unhandled record is escalated. Before, the retry stayed quiet behind that record.
  • The presentation-cursor and outcome-backstop lookups now share _fm_status_presentation_cursor_row. This makes a malformed or duplicated manifest row fail only its own task's lookup, not every task's. Tests cover all three changes.

🤖 Generated with Claude Code

Risk Assessment

✅ Low: This is a merge-only refresh. The branch keeps its scope: the same 9 files as before the merge. The conflict resolution keeps main's T3 refusal and OpenCode Ctrl-C exit path, and keeps the existing exit-picker policy (one Enter, Claude only, refuse anything else). The only gap found is a fail-closed list omission for the newly merged cortex and kiro adapters.

Testing

I ran the plan's three targeted hermetic suites (control, inbox, wake-drain/cursor) and they passed. These cover the picker cases, main's merged OpenCode Ctrl-U/Ctrl-C exit path, the malformed-cursor-row scoping and the inbox re-ring fixes. They are not live checks, so that merge-behaviour scenario is recorded as untested. I drove bin/fm-control.sh exit live against a real Claude Code worker in a disposable marked lab home on a private tmux socket. It answered the real background-task picker on 'Exit and stop tasks', both when its own /exit opened the picker and when the picker was already open. The agent stopped, the background shell was killed, and the pane, shell and worktree remained. A repeat exit reported already-stopped. Adversarial check: with 'Move to background and exit' selected, exit refused and the pane did not change. My first live attempt launched Claude as the window's own command, unlike real tmux spawns. Exit then destroyed the window, so it reported exit=unconfirmed. I fixed the setup to the production layout (bash in the window, then claude) and drove the scenario again. No live Herdr was used, as the plan forbids. This is CLI/TUI behaviour, so the evidence is pane transcripts, not screenshots. The tmux server is killed and no lab processes remain. The sandbox refused rm -rf on the lab directory /tmp/fm-lab.BGTnQi, so it is still on disk. Claude Code probably also added a trust entry for its wt-t1 path when I accepted the trust dialog.

  • Live validation: ✅ go - 4 of 5 scenarios driven live against the product
Scenario Result Live Evidence
Operator runs fm-control exit on an idle Claude task that has a background shell; exit types /exit, Claude opens its background-task picker, exit answers it once on 'Exit and stop tasks', and report… ✅ pass live live-exit-answers-claude-picker.txt (rc=0, 'stopped t1', pane back at bash-5.2$, sleep 932 gone, worktree clean) + live-exit-pane-stream-markers.txt (picker rendered)
Operator runs fm-control exit while Claude's picker is already open on 'Exit and stop tasks'; exit answers it with one Enter instead of typing into it, and the agent stops ✅ pass live live-exit-answers-already-open-picker.txt (rc=0, 'stopped t1', sleep 933 gone)
Adversarial: picker open with 'Move to background and exit' selected; exit refuses and sends nothing, so no detached shell is left without its agent ✅ pass live live-adversarial-move-to-background-selected.txt (rc=1 refusal, pane identical before and after, sleep 931 still alive)
Repeat fm-control exit on the stopped task is idempotent and reports already-stopped ✅ pass live live-exit-answers-already-open-picker.txt (second call: 'already-stopped t1', rc=0)
Merge keeps main's behaviour: OpenCode 2.x Ctrl-U/Ctrl-C raw-key exit, a picker still open after one answer refuses, a non-owning adapter showing the picker refuses, plus this branch's cursor-row scop… ⏸️ untested no The prior payload did not establish a live result for this scenario. It was checked only through hermetic suites (hermetic-suites.log, rc=0). The OpenCode CLI is not on PATH, so the OpenCode exit path…
Evidence: Live: exit types /exit, real Claude picker opens and is answered once, agent and background shell stopped, endpoint and worktree kept

Source: Live: exit types /exit, real Claude picker opens and is answered once, agent and background shell stopped, endpoint and worktree kept

\### pane before fm-control exit (idle composer, 1 background shell: sleep 932)
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
❯ 
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
  Model: Sonnet 5.5 | Ctx: 33.1k | ⎇ task-t1 | (+0,-0)
  ⏵⏵ auto mode on · 1 shell

\### pane process before
claude

$ bin/fm-control.sh t1 exit
fm-gate-refuse: gate agent lifecycle permitted only against lab home /tmp/fm-lab.BGTnQi
stopped t1 harness=claude backend=tmux endpoint=fmses:fm-t1 worktree=/tmp/fm-lab.BGTnQi/wt-t1
rc=0

\### pane after (endpoint preserved)
bash-5.2$ claude --model sonnet --allowedTools 'Bash(sleep:*)'
Resume this session with:
claude --resume 38012a78-8043-47af-be6a-c89b303d2628
bash-5.2$

\### pane process after
bash

\### background shell after (sleep 932)
none - stopped with the agent (Exit and stop tasks was chosen, not Move to background)

\### worktree preserved
## task-t1
Evidence: Live pane-stream markers showing the real 'Background work is running' / 'Exit and stop tasks' picker rendered during the exit

Source: Live pane-stream markers showing the real 'Background work is running' / 'Exit and stop tasks' picker rendered during the exit

      2 /exit
      1 Background work is running
      1 Exit and stop tasks
      1 Resume this session
Evidence: Live: already-open picker answered, and a repeat exit reports already-stopped

Source: Live: already-open picker answered, and a repeat exit reports already-stopped

\### pane before fm-control exit (picker already open, row 1 selected)
   Background work is running
   The following will stop when you exit:
   shell · sleep 933
   ❯ 1. Exit and stop tasks
     2. Move to background and exit
     3. Stay
   Enter to confirm · Esc to cancel

\### background shell before
1624969 sleep 933
1634933 sleep 7.5

$ bin/fm-control.sh t1 exit
fm-gate-refuse: gate agent lifecycle permitted only against lab home /tmp/fm-lab.BGTnQi
stopped t1 harness=claude backend=tmux endpoint=fmses:fm-t1 worktree=/tmp/fm-lab.BGTnQi/wt-t1
rc=0

\### pane after
bash-5.2$ claude --model sonnet --allowedTools 'Bash(sleep:*)'
Resume this session with:
claude --resume 8474d7e4-cc6f-4b62-ae35-d5f13ede6f41
bash-5.2$

\### pane process after
bash

\### background shell after
none - stopped with the agent

$ bin/fm-control.sh t1 exit   # idempotence on the stopped agent
fm-gate-refuse: gate agent lifecycle permitted only against lab home /tmp/fm-lab.BGTnQi
already-stopped t1 harness=claude backend=tmux endpoint=fmses:fm-t1 worktree=/tmp/fm-lab.BGTnQi/wt-t1
rc=0
Evidence: Live adversarial: 'Move to background and exit' selected, exit refuses rc=1, pane and background shell unchanged

Source: Live adversarial: 'Move to background and exit' selected, exit refuses rc=1, pane and background shell unchanged

\### pane before fm-control exit (selection moved to row 2)
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
   Background work is running
   The following will stop when you exit:
   shell · sleep 931
     1. Exit and stop tasks
   ❯ 2. Move to background and exit
     3. Stay
   Enter to confirm · Esc to cancel

$ bin/fm-control.sh t1 exit
fm-gate-refuse: gate agent lifecycle permitted only against lab home /tmp/fm-lab.BGTnQi
error: task t1's composer visibly holds pending text; refusing to type the /exit exit command because it would concatenate onto that text. Clear or submit the pending text, then retry 'exit'
rc=1

\### pane after
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
   Background work is running
   The following will stop when you exit:
   shell · sleep 931
     1. Exit and stop tasks
   ❯ 2. Move to background and exit
     3. Stay
   Enter to confirm · Esc to cancel

\### background shell still alive?
1431787 sleep 931
Evidence: Targeted hermetic suites log (control, inbox, wake-drain unread status)

Source: Targeted hermetic suites log (control, inbox, wake-drain unread status)

FM_TEST_BEGIN 2026-10-31T02:05:35Z tests/fm-task-inbox.test.sh family=watcher-wake-lock expected_gate_skip=none
FM_TEST_BEGIN 2026-10-31T02:05:35Z tests/fm-wake-drain-unread-status.test.sh family=watcher-wake-lock expected_gate_skip=none
ok - a note: answer buried under a later routine note: is surfaced with both lines
ok - already-presented note: lines are not re-surfaced on the next drain
ok - a brand-new note: after presentation is surfaced without replaying handled lines
ok - a queued status signal annotates every unread note, not only the newest
WAKE_ACK_REQUIRED: after handling completes run bin/fm-wake-drain.sh --ack-through 1 --recovery-generation 1388313.1793412364.ZxiM1a
WAKE_ACK_REQUIRED: after handling completes run bin/fm-wake-drain.sh --ack-through 1 --recovery-generation 1388313.1793412364.ZxiM1a
WAKE_ACK_REQUIRED: after handling completes run bin/fm-wake-drain.sh --ack-through 1 --recovery-generation 1388313.1793412364.ZxiM1a
ok - a pending-reply resolution buried under a later note surfaces once and closes OPEN DECISIONS
WAKE_ACK_REQUIRED: after handling completes run bin/fm-wake-drain.sh --ack-through 1 --recovery-generation 1397310.1793412371.K1bxzf
WAKE_ACK_REQUIRED: after handling completes run bin/fm-wake-drain.sh --ack-through 2 --recovery-generation 1397310.1793412371.K1bxzf
WAKE_ACK_REQUIRED: after handling completes run bin/fm-wake-drain.sh --ack-through 2 --recovery-generation 1397310.1793412371.K1bxzf
WAKE_ACK_REQUIRED: after handling completes run bin/fm-wake-drain.sh --ack-through 2 --recovery-generation 1397310.1793412371.K1bxzf
ok - a self-announced pending-reply close does not wake yet still surfaces once in UNREAD STATUS
ok - unread status over the former byte cap preserves every line
ok - presentation cursor advances only through its captured endpoint
ok - a reused task id starts its replacement status log unread at byte zero
ok - fallback identity still presents and advances status state
ok - a malformed presentation-cursor row fails only its own task
ok - snapshot failures are reported visibly
ok - OPEN DECISIONS still folds needs-decision/blocked independently of unread notes
WAKE_ACK_REQUIRED: after handling completes run bin/fm-wake-drain.sh --ack-through 1 --recovery-generation 1457775.1793412419.VKQXKZ
ok - an empty-queue backstop presentation still preserves the status for its later signal annotation
ok - routine working and branch-covered done lines print nothing on an empty-queue drain
FM_TEST_END 2026-10-31T02:07:07Z tests/fm-wake-drain-unread-status.test.sh exit=0 duration_ms=91547 gate_skip=false
ok - inbox: a steer is written durably and round-trips byte-exact with a self-describing doorbell
ok - inbox: a hostile-name doorbell executes as a no-op in bare shells
ok - inbox: terminal-control inbox names are rejected without typing
ok - inbox: the ring skips dead or missing endpoints and still rings live or unclassifiable endpoints
ok - inbox: the ring submits its own stuck doorbell, skips other pending text, and retries a lost Enter once on both paths
ok - inbox: the idempotent enqueue dedups an exact re-run onto the same record, handled or not
ok - inbox: unrelated pending and handled history avoids per-record parsing and comparison
ok - inbox: prefilter preserves multiline, blank, legacy and delivery-mode exact matching
ok - inbox: a prefilter error falls back without duplicating an exact retry
ok - inbox: pending prefilter precedes handled and finds an ack before grep opens the record in both modes
ok - inbox: idempotent enqueue follows a record concurrently moved to handled
ok - inbox: the handled mv is the idempotent ack and sequences are never reissued
ok - inbox: concurrent writers serialize on the sequence lock and lose nothing
ok - inbox: a writer retries when a competing lock vanishes after its failed claim
ok - inbox: ladder bookkeeping ignores a concurrently removed inbox
ok - inbox: fire-and-forget records stay durable and outside the ladder
ok - inbox: a fire-and-forget record whose ring did not land is owed exactly one retry
ok - inbox: a due fire-and-forget retry re-rings past an escalated ordinary record
ok - inbox: without config/wait-no-turns a fire-and-forget retry mark stays quiet
ok - inbox: the re-ring ladder paces by grace, escalates once, and resets on ack
ok - watcher: an unhandled aged message on an idle pane re-rings without waking firstmate, and the ack silences it
ok - watcher: busy deferrals survive restart, escalate once at the bound, and never type
ok - watcher: delivery and acknowledgement reset the durable busy budget
ok - watcher: unwritable busy bookkeeping surfaces without typing
ok - watcher: idle successor surfaces once despite unremovable predecessor bookkeeping
ok - watcher: busy successor surfaces once despite unremovable predecessor bookkeeping
ok - watcher: persistent idle busy-reset failure escalates once and later instructions still deliver
ok - watcher: persistent protected busy-reset failure escalates once and later instructions still deliver
ok - watcher: busy limit '999999999999999999999999999999' escalates exactly once at 2
ok - watcher: busy limit '1000000000' escalates exactly once at 2
ok - watcher: busy limit '0' escalates exactly once at 2
ok - watcher: busy limit '000' escalates exactly once at 2
ok - watcher: busy limit '' escalates exactly once at 2
ok - watcher: busy limit 'invalid' escalates exactly once at 2
ok - watcher: busy limit '1' escalates exactly once at 1
ok - watcher: busy limit '3' escalates exactly once at 3
ok - watcher: unremovable obsolete busy state does not block or escalate a fire-and-forget retry
ok - watcher: busy successor escalates once despite stale predecessor ring history
ok - watcher: dead successor escalates once despite stale predecessor ring history
ok - watcher: missing successor escalates once despite stale predecessor ring history
ok - watcher: unwritable successor escalates once despite stale predecessor ring history
ok - watcher: a non-busy protected delivery breaks the busy streak and preserves the attempt ladder
ok - watcher: a non-busy failed delivery breaks the busy streak and preserves the attempt ladder
ok - watcher: a healthy or empty inbox stays completely silent
ok - watcher: acknowledgement silences an unwritable ladder without a stale wake
ok - watcher: unwritable ladder bookkeeping surfaces a stale wake after the doorbell
ok - watcher: a fire-and-forget record's owed retry rings exactly once and never escalates
ok - watcher: a fire-and-forget retry waits out the worker's own decision, then rings once
ok - watcher: spending a retry keeps a newer record's mark written during its ring
ok - watcher: a spent ring budget emits exactly one ordinary stale wake for recovery
ok - watcher: a positively dead pane is never typed into and surfaces exactly one stale wake
ok - watcher: dead-pane recovery overrides stale busy state
FM_TEST_END 2026-10-31T02:07:34Z tests/fm-task-inbox.test.sh exit=0 duration_ms=118500 gate_skip=false
FM_TEST_BEGIN 2026-10-31T02:07:34Z tests/fm-control.test.sh family=backend-dispatch expected_gate_skip=none
ok - fm-control exit: every verified harness gets its own verified exit command
ok - fm-control exit: a recorded OpenCode major picks /exit (1.x) or Ctrl-U then Ctrl-C (2.x)
ok - fm-control exit: OpenCode 2.x retries Ctrl-C exactly once while the agent is still alive
ok - fm-control interrupt: every verified harness gets its own verified key and repeat count
ok - fm-control Devin interrupt: second press only after the armed hint, then busy invalidated without fabricating idle
ok - fm-control Devin interrupt: an idle agent gets one Escape and reports not-running
ok - fm-control Devin exit: a busy record whose turn already ended never opens the revert picker
ok - fm-control Devin interrupt: a revert picker a press opened is closed with Escape, never Enter
ok - fm-control Devin: an open revert picker refuses every typed command
ok - fm-control interrupt: opencode needs a double Escape, claude a single one
ok - fm-control: a harness with no verified control mechanics is refused, not guessed at
ok - fm-control-lib: a recorded harness resolves to its verified adapter without guessing
ok - fm-control-lib: only a runtime's own recorded session has a relaunch resume form
ok - fm-control: prefixed recorded harnesses reach interrupt and exit mechanics
ok - fm-control-lib: the backend key matrix matches each adapter's real send-key surface
ok - fm-control-lib: adapter capability is per task kind, not per adapter alone
ok - fm-control interrupt: a backend that cannot deliver the harness's key refuses instead of sending another
ok - fm-control: a backend that cannot prove an agent stopped refuses exit and relaunch
ok - fm-control relaunch: commandcode off tmux and herdr is refused before the running agent is stopped
ok - fm-control-lib: stop-proving verbs are gated on the backends that really classify agent state
ok - fm-control: a legacy window label is refused and the exact task id is named
ok - fm-control: an explicit backend endpoint is never a control target
ok - fm-control: an unrecorded task id is refused
ok - fm-control: a record whose endpoint identity names another task is refused
ok - fm-control: a remotely placed secondmate is refused by placement, not by a metadata complaint
ok - fm-control: interrupt and exit lock before task-state resolution
ok - fm-control: the verb list is closed - no raw keys, arbitrary text, or clear verb
ok - fm-control: resume is refused with the determinism reason and the alternative
ok - fm-control: profile and note flags belong to relaunch only
ok - fm-control exit: an already-stopped agent is idempotent success with no bytes sent
ok - fm-control exit: an unprovable tmux endpoint refuses instead of claiming the agent stopped
ok - fm-control interrupt: refuses when no agent is running rather than keying a shell
ok - fm-control exit: an endpoint whose process cannot be attributed refuses
ok - fm-control exit: a busy agent receives interrupt delivery before the exit command
ok - fm-control exit: an idle agent goes straight to its exit command
ok - fm-control exit: retiring a codex incarnation drops busy_gen with the sidecar
ok - fm-control exit: an already-open background-task picker is answered with Exit and stop tasks
ok - fm-control exit: the background-task picker the exit command opened is confirmed once
ok - fm-control exit: a picker that renders after the submit returned is answered when the stop wait times out
ok - fm-control exit: a picker still open after one answer, or not owned by the adapter, refuses
ok - fm-control interrupt: unconfirmed delivery preserves observed busy state
ok - fm-control interrupt: muse confirms cancellation from its session log
ok - fm-control interrupt: postconditions are revalidated after acknowledgement polling
ok - fm-control exit: an interrupt-stopped agent satisfies the gone-state postcondition
ok - fm-control exit: a stubborn agent reports delivered input and an unconfirmed exit
ok - fm-control interrupt: grok reports delivery without claiming cancellation
ok - fm-control interrupt: grok's idle footer does not confirm cancellation
ok - fm-control: a lifecycle command to a secondmate is unmarked and opens no reply expectation
ok - fm-control's arrival leaves fm-send's from-firstmate marking untouched
FM_TEST_END 2026-10-31T02:09:38Z tests/fm-control.test.sh exit=0 duration_ms=123970 gate_skip=false
FM_TEST_SUMMARY total=3 failed=0 skipped_gate=0 duration_ms=242763
FM_TEST_SUMMARY_FAMILY family=backend-dispatch count=1 duration_ms=123970 failed=0
FM_TEST_SUMMARY_FAMILY family=watcher-wake-lock count=2 duration_ms=210047 failed=0
FM_TEST_SLOWEST rank=1 script=tests/fm-control.test.sh duration_ms=123970
FM_TEST_SLOWEST rank=2 script=tests/fm-task-inbox.test.sh duration_ms=118500
FM_TEST_SLOWEST rank=3 script=tests/fm-wake-drain-unread-status.test.sh duration_ms=91547
rc=0

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

⏭️ **Rebase** - skipped

Step was skipped.

⚠️ **Review** - 1 info
  • ℹ️ bin/fm-control-lib.sh:309 - The merge brought in main's new cortex and kiro adapters (bin/fm-control-lib.sh:67 fm_control_harnesses, :271, :159, :172, :191, and fm_control_exit_command :292). The branch's fm_control_exit_confirm_dialog list was not updated for them. For those two harnesses the function returns 1 (unknown harness) instead of printing nothing (verified adapter that answers no dialog). In answer_exit_dialog (bin/fm-control.sh:458-460) a failed substitution gives the empty string, so the result is still a refusal (fail-closed). Behaviour does not change, but the function's own contract now differs from the verified-adapter list. Fix: add cortex|kiro to the empty-answer arm at bin/fm-control-lib.sh:309.
✅ **Test** - passed

✅ No issues found.

  • Live validation: ✅ go - 4 of 5 scenarios driven live against the product
Scenario Result Live Evidence
Operator runs fm-control exit on an idle Claude task that has a background shell; exit types /exit, Claude opens its background-task picker, exit answers it once on 'Exit and stop tasks', and report… ✅ pass live live-exit-answers-claude-picker.txt (rc=0, 'stopped t1', pane back at bash-5.2$, sleep 932 gone, worktree clean) + live-exit-pane-stream-markers.txt (picker rendered)
Operator runs fm-control exit while Claude's picker is already open on 'Exit and stop tasks'; exit answers it with one Enter instead of typing into it, and the agent stops ✅ pass live live-exit-answers-already-open-picker.txt (rc=0, 'stopped t1', sleep 933 gone)
Adversarial: picker open with 'Move to background and exit' selected; exit refuses and sends nothing, so no detached shell is left without its agent ✅ pass live live-adversarial-move-to-background-selected.txt (rc=1 refusal, pane identical before and after, sleep 931 still alive)
Repeat fm-control exit on the stopped task is idempotent and reports already-stopped ✅ pass live live-exit-answers-already-open-picker.txt (second call: 'already-stopped t1', rc=0)
Merge keeps main's behaviour: OpenCode 2.x Ctrl-U/Ctrl-C raw-key exit, a picker still open after one answer refuses, a non-owning adapter showing the picker refuses, plus this branch's cursor-row scop… ⏸️ untested no The prior payload did not establish a live result for this scenario. It was checked only through hermetic suites (hermetic-suites.log, rc=0). The OpenCode CLI is not on PATH, so the OpenCode exit path…
  • env -u NO_MISTAKES_GATE bash bin/fm-test-run.sh tests/fm-control.test.sh tests/fm-task-inbox.test.sh tests/fm-wake-drain-unread-status.test.sh (rc=0, 0 failures)
  • Live lab: bin/fm-lab-home.sh create, a throwaway git project with worktree, a state/t1.meta task record (harness=claude, backend=tmux), and a private tmux -L fm-lab server whose window runs bash and then real claude --model sonnet. Claude was prompted to start a background sleep 93x shell.
  • Live: /exit typed by hand to open the real picker, Down to select 'Move to background and exit', then FM_HOME=$LAB TMUX=<lab socket> bin/fm-control.sh t1 exit
  • Live: idle composer with 1 background shell, then bin/fm-control.sh t1 exit (exit types /exit itself and answers the picker that opens)
  • Live: picker already open with row 1 selected, then bin/fm-control.sh t1 exit, then a second bin/fm-control.sh t1 exit to check idempotence
  • Pane output piped to a log and stripped of ANSI codes, to confirm the real picker rendered during the exit
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

fm_task_inbox_due_action returned quiet whenever the oldest ordinary record was already escalated, so a due retry mark naming a newer unhandled fire-and-forget record never rang. Once escalated, the oldest record no longer rings the inbox, so the retry is now returned before quiet.
status_presentation_cursor_offset and status_outcome_backstop_cursor_offset rejected the whole manifest when any row was structurally malformed (extra field, non-numeric offset, empty identity), so one bad row failed every task's lookup and stalled status presentation fleet-wide. Both now read through one shared row parser that validates only the requested task's row, so a malformed or duplicated row fails only its own task.
fm-control exit refused when /exit opened Claude Code's "Background work is running" picker, so an agent with a running background shell could never be stood down through the control plane. The claude adapter now names that picker as its exit confirmation (fm_control_exit_confirm_dialog), and exit answers it with one Enter on its preselected "Exit and stop tasks" row, at most once. That row matches exit's contract; moving the work to the background would leave a shell running without its agent. There is still no generic raw-key entry point: any other recognised dialog, the picker under another adapter, or the picker still open after its answer refuses as before.
@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: thanks @AgardnerAU for writing these up so carefully, with the original reports, a lab reproduction on the base commit, and live evidence for each fix.

I read the whole diff against main 1aa2a21e. It touches 9 files, with no workflow, CI-script, or secret surface, so I approved the fork CI runs (39131495289 CI, 39131495328 Require no-mistakes). The no-mistakes attestation matches head 0b49a674.

VISION verdict (head 0b49a67 vs main 1aa2a21):

  • One captain, one interface: aligns. A worker that can actually be stood down, a retry that rings, and a drain that no longer hides other tasks' status all reduce noise.
  • Authority is explicit: the exit-picker part needs a captain call. fm-control exit would now choose an option in a vendor dialog and stop the worker's background work on its own. Main deliberately refuses that Enter (fix: refuse a confirming Enter on the Claude background-task exit picker #6666, "refuse a confirming Enter on the Claude background-task exit picker"). The inbox and cursor parts align.
  • Scripts own mechanics: aligns. Exact matcher, at most one Enter, deterministic parsing.
  • Restart is a non-event: aligns. No durable record changes shape.
  • Delegation with a spine: aligns. Load-bearing tests, and a still-open picker or another adapter's picker still refuses.
  • Fleet outlives vendor: aligns. Version-pinned, re-measured against Claude Code 2.1.302, Claude-only by name.
  • Scope: aligns.

Contract-class: new-default. The inbox retry (#2) and cursor-row scoping (#3) read as restore to me, because each fixes a specified default path that was broken. The exit-picker change (#1) replaces a specified, documented default: today exit refuses and leaves the dialog to the operator (docs/agent-control.md, the runtime-backends record, #6666). After this PR it answers the dialog by default. A good motive doesn't make that a restore, so the PR as a whole needs Kun's decision.

Next step: we're waiting on CI, which I just approved. If CI and no-mistakes come back green, this goes to Kun for a merge-or-leave decision on the exit-picker change. That will be a captain decision, not something waiting on you. Optional, entirely your call: if you split #2 and #3 into their own PR, those two could land on their own as restores without waiting on that decision.

Overlap note: #7480 (Claude permission-prompt wake) is a different path from this one (a PermissionRequest hook vs the exit verb). Both edit docs/verification/runtime-backends.md, but in different sections.

@AgardnerAU

Copy link
Copy Markdown
Contributor Author

Fixes 2 (inbox retry past an escalated record) and 3 (malformed presentation-cursor row scoped to its own task) are now carried as restores in their own PR: #7517. This PR still holds the exit-dialog fix for your decision.

@AgardnerAU AgardnerAU changed the title fix(bin): answer Claude's exit picker, re-ring inbox retries past escalation, scope cursor row errors fix(bin): answer Claude's exit picker in fm-control exit and fix inbox retry and cursor lookups Oct 31, 2026
@greptile-apps

greptile-apps Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge within its stated scope.

Reviews (1) · Last reviewed commit: "Merge current upstream main into exit pi..." · Reviewed by Greptile

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.

2 participants