Repository navigation
fix(bin): answer Claude's exit picker in fm-control exit and fix inbox retry and cursor lookups - #7484
fix(bin): answer Claude's exit picker in fm-control exit and fix inbox retry and cursor lookups#7484AgardnerAU wants to merge 5 commits into
Conversation
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.
|
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 VISION verdict (head 0b49a67 vs main 1aa2a21):
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 |
|
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. |
[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 |
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:
Merging upstream is the maintainer's call, never ours.
What Changed
fm-control exitnow answers the adapter's own exit confirmation dialog instead of always refusing it. The dialog is named by the newfm_control_exit_confirm_dialogfunction. 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 asblocked on a prompt. The docs and the verification record now describe this behaviour and the live re-measurement.fm_task_inbox_due_retryhelper) now re-rings a newer record's due retry when the oldest unhandled record is escalated. Before, the retry stayed quiet behind that record._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 drovebin/fm-control.sh exitlive 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 refusedrm -rfon 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.fm-control exiton 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…fm-control exitwhile 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 stopsfm-control exiton the stopped task is idempotent and reports already-stoppedEvidence: 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
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
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
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
Evidence: Targeted hermetic suites log (control, inbox, wake-drain unread status)
Source: Targeted hermetic suites log (control, inbox, wake-drain unread status)
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
⏭️ **Rebase** - skipped
Step was skipped.
bin/fm-control-lib.sh:309- The merge brought in main's newcortexandkiroadapters (bin/fm-control-lib.sh:67fm_control_harnesses, :271, :159, :172, :191, andfm_control_exit_command:292). The branch'sfm_control_exit_confirm_dialoglist 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). Inanswer_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: addcortex|kiroto the empty-answer arm at bin/fm-control-lib.sh:309.✅ **Test** - passed
✅ No issues found.
fm-control exiton 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…fm-control exitwhile 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 stopsfm-control exiton the stopped task is idempotent and reports already-stoppedenv -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, astate/t1.metatask record (harness=claude, backend=tmux), and a privatetmux -L fm-labserver whose window runs bash and then realclaude --model sonnet. Claude was prompted to start a backgroundsleep 93xshell.Live:/exittyped by hand to open the real picker, Down to select 'Move to background and exit', thenFM_HOME=$LAB TMUX=<lab socket> bin/fm-control.sh t1 exitLive: idle composer with 1 background shell, thenbin/fm-control.sh t1 exit(exit types /exit itself and answers the picker that opens)Live: picker already open with row 1 selected, thenbin/fm-control.sh t1 exit, then a secondbin/fm-control.sh t1 exitto check idempotencePane 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.