Skip to content

fix(bin): surface launches parked on an interactive prompt as not-started - #5250

Merged
kunchenguid merged 3 commits into
kunchenguid:mainfrom
sdivanl:fm/fm-launch-prompt-busy-bound
Sep 22, 2026
Merged

kunchenguid merged 3 commits into
kunchenguid:mainfrom
sdivanl:fm/fm-launch-prompt-busy-bound

Conversation

@sdivanl

@sdivanl sdivanl commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Intent

A worker parked on an interactive launch prompt must surface within minutes instead of reading as busy until the one-hour bound.
On 2026-09-21 a crewmate launched on the codex harness parked on that CLI's sign-in screen and did no work at all; because an interactive prompt during launch reads as a BUSY launch rather than a stopped one, no alert fired and the stuck worker was spotted by eye before supervision saw it.
The same shape covers a Pi folder-trust dialog on a fresh worktree - the harness-specific trust pre-registration filed as separate work addresses that one case and does not close this detection gap.

The recorded fix shape: make the launch path prove the worker actually began its brief, or classify a launch whose pane is parked on a recognized interactive prompt - harness trust dialog, sign-in screen, first-run menu - as not-started rather than busy, so the gap surfaces in minutes.
Keep the existing busy-bound semantics for a genuinely working launch, and do not shorten the general bound.

Verification expected: colocated tests for the not-started/busy classification, plus a live check that a worker parked on a harness prompt surfaces promptly.

What Changed

  • Add fm_busy_launch_prompt_parked and a harness-scoped signature table to bin/fm-busy-lib.sh: a launch whose busy record is still the untouched fm-spawn seed now classifies as unknown launch-prompt instead of busy fm-spawn when the captured pane matches that harness's own recognized trust, sign-in, or first-run dialog (Claude, Pi/pi-signed/omp, Gemini). Records advanced by any real hook event are never reclassified, and the general busy bound is unchanged.
  • Capture the rendered tail unconditionally in bin/fm-crew-state.sh and pass the existing capture through bin/fm-watch.sh, so crew-state reads and the watcher agree on the launch-prompt verdict.
  • Add colocated classification tests, a live end-to-end test registered in bin/fm-test-run.sh, and document the backstop in docs/architecture.md, docs/tmux-backend.md, and docs/verification/runtime-backends.md.

Risk Assessment

✅ Low: The change is a well-bounded, honestly-labeled best-effort detection backstop that only removes a busy verdict for untouched fm-spawn records and does not touch the general busy bound; the only findings are an unused env-override seam and a stale comment.

Testing

I drove the real product end to end for the four launch-prompt classification and crew-state scenarios: the opt-in live guard launched real claude, pi, and gemini binaries into isolated tmux panes, captured each genuine trust/auth prompt with the production capture shape, and confirmed both fm_busy_classify and the watcher's production absorb predicate treat the parked launch as unknown launch-prompt/not-busy. Separately I ran the real bin/fm-crew-state.sh against a real parked Claude pane and got state: unknown · source: pane · harness state unavailable (unknown launch-prompt), proving the authoritative read no longer absorbs it as working. The four remaining boundary scenarios (working launch keeps busy, advanced-record immunity, no-tail fallback, and adversarial harness scoping) were only exercised through the colocated tests/fm-busy-state.test.sh unit suite, which is not the live running product, so they are reported as untested rather than pass. No UI is involved (backend/CLI classification), so terminal transcripts are the reviewer-visible artifacts.

  • Live validation: ✅ go - 4 of 8 scenarios driven live against the product
Scenario Result Live Evidence
A real Claude worker launched into a fresh worktree and left parked on its workspace-trust dialog is classified unknown launch-prompt, and the watcher's production absorb predicate treats it as not… ✅ pass live FM_LAUNCH_PROMPT_SIGNALS_LIVE=1 bash tests/fm-launch-prompt-signals-live-e2e.test.sh (live claude 2.1.278) and artifact live-launch-prompt-e2e.log
A real Pi-engine worker (pi, pi-signed, omp) launched into a fresh worktree carrying a trust-requiring project resource and left parked on the Trust project folder? dialog is classified `unknown lau… ✅ pass live FM_LAUNCH_PROMPT_SIGNALS_LIVE=1 bash tests/fm-launch-prompt-signals-live-e2e.test.sh (live pi 0.86.1) and artifact live-launch-prompt-e2e.log
A real Gemini worker launched with no credential and left parked on its auth-method picker or workspace-trust dialog is classified unknown launch-prompt. ✅ pass live FM_LAUNCH_PROMPT_SIGNALS_LIVE=1 bash tests/fm-launch-prompt-signals-live-e2e.test.sh (live gemini 0.60.0) and artifact live-launch-prompt-e2e.log
The authoritative crew-state read (bin/fm-crew-state.sh) against a real parked Claude pane reports unknown ... launch-prompt, never working, so the watcher's pause/absorb path cannot swallow the… ✅ pass live ROOT="$PWD" bash ~/.no-mistakes/evidence/01M348CGYMPH2J3SAQ6WJV8PBQ/live-crew-state-parked.sh; artifact live-crew-state-parked.log
A genuinely working launch whose pane shows the normal working footer keeps busy fm-spawn; the backstop does not shorten or replace the existing busy-bound semantics. ⏸️ untested no The prior payload only ran the colocated unit suite bash tests/fm-busy-state.test.sh case test_launch_prompt_never_shortens_a_working_launch, which is not the live running product. No live launch…
A record advanced by any real hook event is never reclassified from rendered pane text, even when that pane renders the trust dialog. ⏸️ untested no The prior payload only ran the colocated unit suite bash tests/fm-busy-state.test.sh case test_launch_prompt_never_reclassifies_an_advanced_record, which is not the live running product. No real h…
With no captured tail supplied, a launch record still pinned at the fm-spawn seed keeps its own state rather than being reclassified. ⏸️ untested no The prior payload only ran the colocated unit suite bash tests/fm-busy-state.test.sh case test_launch_prompt_requires_a_captured_tail, which is not the live running product. No live call omitting…
Adversarial: the backstop is scoped to harnesses with a verified signature and requires both the dialog heading and its own option line - an unarmed harness (opencode) showing Claude dialog text stays… ⏸️ untested no The prior payload only ran the colocated unit suite bash tests/fm-busy-state.test.sh cases test_launch_prompt_scoped_to_armed_harnesses and test_launch_prompt_pi_requires_both_markers, which is…
Evidence: Live launch-prompt signature guard against real claude/pi/gemini

Source: Live launch-prompt signature guard against real claude/pi/gemini

# live claude version: 2.1.278 (Claude Code) ok - claude: a real launch parked on its own rendered trust dialog surfaces through the watcher gate # live pi version: 0.86.1 ok - pi, pi-signed, omp: a real Pi-engine launch parked on its own rendered trust dialog surfaces through the watcher gate # live gemini version: 0.60.0 ok - gemini: a real launch parked on its own rendered auth or trust dialog surfaces through the watcher gate # checked 3 launch-prompt signature(s) against real installed binaries

# live claude version: 2.1.278 (Claude Code)
ok - claude: a real launch parked on its own rendered trust dialog surfaces through the watcher gate
# live pi version: 0.86.1
ok - pi, pi-signed, omp: a real Pi-engine launch parked on its own rendered trust dialog surfaces through the watcher gate
# live gemini version: 0.60.0
ok - gemini: a real launch parked on its own rendered auth or trust dialog surfaces through the watcher gate
# checked 3 launch-prompt signature(s) against real installed binaries
Evidence: Real claude trust dialog captured, then real fm-crew-state.sh reports unknown launch-prompt

Source: Real claude trust dialog captured, then real fm-crew-state.sh reports unknown launch-prompt

state: unknown · source: pane · harness state unavailable (unknown launch-prompt) fm_busy_classify -> unknown launch-prompt PASS: real parked launch reads unknown/launch-prompt, never working

== lab: /tmp/fm-lp-crewstate.TmHduE
== claude: 2.1.278 (Claude Code)
== real claude trust dialog captured:

────────────────────────────────────────────────────────────────────────────────
 Accessing workspace:

 /tmp/fm-lp-crewstate.TmHduE/wt

 Quick safety check: Is this a project you created or one you trust? (Like your
 own code, a well-known open source project, or work from your team). If not,
 take a moment to review what's in this folder first.

 Claude Code'll be able to read, edit, and execute files here.

 Security guide

 ❯ No, exit
   Yes, I trust this folder

 Enter to confirm · Esc to cancel

== bin/fm-crew-state.sh lp (real script, real tmux pane, armed fm-spawn record)
state: unknown · source: pane · harness state unavailable (unknown launch-prompt)

== bin/fm-busy-classify direct read of the same real capture
fm_busy_classify -> unknown launch-prompt

PASS: real parked launch reads unknown/launch-prompt, never working
Evidence: Driver for the live fm-crew-state parked-launch check

Source: Driver for the live fm-crew-state parked-launch check

#!/usr/bin/env bash
# Live driver: prove bin/fm-crew-state.sh reports a launch parked on a real
# Claude trust dialog as `unknown ... launch-prompt` (not `working`), using a
# real tmux pane and the real claude binary. Scratch state lives outside the
# worktree; nothing is answered (Escape only) and no model tokens are spent.
set -u

ROOT=${ROOT:?set ROOT to the worktree}
SOCK=default
SESSION="fm-lp-crewstate-$$"
ID=lp
LAB=$(mktemp -d "${TMPDIR:-/tmp}/fm-lp-crewstate.XXXXXX")
WT="$LAB/wt"
STATE="$LAB/state"
mkdir -p "$WT" "$STATE"
git -C "$WT" init -q
git -C "$WT" symbolic-ref HEAD refs/heads/fm/feat-lp
CLAUDE_BIN=$(command -v claude)

cleanup() {
  tmux kill-session -t "$SESSION" >/dev/null 2>&1 || true
  rm -rf -- "$LAB"
}
trap cleanup EXIT

echo "== lab: $LAB"
echo "== claude: $($CLAUDE_BIN --version 2>&1)"

# Real launch into a brand-new worktree under the operator's onboarded config:
# claude parks on its workspace-trust dialog.
tmux new-session -d -s "$SESSION" -n w -c "$WT" -- "$CLAUDE_BIN" --dangerously-skip-permissions hello
TARGET="$SESSION:w"

tail=''
for _ in $(seq 1 75); do
  tail=$(tmux capture-pane -p -t "$TARGET" -S -40 2>/dev/null) || true
  printf '%s' "$tail" | grep -qiE 'Is this a project you created or one you trust' && break
  sleep 0.2
done
if ! printf '%s' "$tail" | grep -qiE 'Is this a project you created or one you trust'; then
  echo "FAIL: claude never rendered its trust dialog within 15s; tail:"; printf '%s\n' "$tail"; exit 1
fi
echo "== real claude trust dialog captured:"
printf '%s\n' "$tail"

printf 'window=%s\nbackend=tmux\nharness=claude\nworktree=%s\nkind=scout\n' "$TARGET" "$WT" > "$STATE/$ID.meta"
"$ROOT/bin/fm-busy-event.sh" arm "$STATE" "$ID" >/dev/null

echo
echo "== bin/fm-crew-state.sh $ID (real script, real tmux pane, armed fm-spawn record)"
out=$(FM_ROOT_OVERRIDE="$ROOT" FM_HOME="$LAB" FM_STATE_OVERRIDE="$STATE" \
  "$ROOT/bin/fm-crew-state.sh" "$ID" 2>&1)
echo "$out"

echo
echo "== bin/fm-busy-classify direct read of the same real capture"
# classify via the library the production way
verdict=$(bash -c '
  . "$1/bin/fm-busy-lib.sh"
  fm_busy_classify tmux "$2" claude "$3" "$4" "$5"
' _ "$ROOT" "$TARGET" "$ID" "$STATE" "$tail")
echo "fm_busy_classify -> $verdict"

case "$out" in
  *"state: unknown"*launch-prompt*) ;;
  *) echo "FAIL: expected 'state: unknown' naming launch-prompt"; exit 1 ;;
esac
case "$out" in
  *"state: working"*) echo "FAIL: parked launch read as working"; exit 1 ;;
esac
[ "$verdict" = "unknown launch-prompt" ] || { echo "FAIL: direct classify was '$verdict'"; exit 1; }

tmux send-keys -t "$TARGET" Escape >/dev/null 2>&1 || true
echo
echo "PASS: real parked launch reads unknown/launch-prompt, never working"

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

⚠️ **Review** - 2 issues (1 warning, 1 info)
  • ⚠️ bin/fm-busy-lib.sh:929 - The six per-signature environment overrides introduced here (FM_BUSY_CLAUDE_TRUST_PROMPT_REGEX, FM_BUSY_CLAUDE_IMPORTS_PROMPT_REGEX, FM_BUSY_PI_LAUNCH_PROMPT_REGEX, FM_BUSY_GEMINI_TRUST_PROMPT_REGEX, FM_BUSY_GEMINI_AUTH_PROMPT_REGEX, FM_BUSY_GEMINI_APIKEY_PROMPT_REGEX) are not required by any stated intent requirement: nothing in the repository sets, documents, or tests any of them, so they are dead configurability that can silently disable the launch-prompt backstop. Their presence also diverges from the deliberate hardening asserted in tests/fm-agy-harness.test.sh (an environment override must not change the agy busy signature for the same class of rendered-text check). No intent requirement needs a mode/flag here, and the narrower required form is the hardcoded literal regex. Remedy: drop the ${VAR:-...} wrappers at lines 929, 933, 952, 979, 983 and 987 and use the literal patterns.
  • ℹ️ bin/fm-watch.sh:349 - Stale comment left by this change's new tail consumer: window_is_busy's doc still says '<tail40> ... is consumed only by the Grok-scoped fallback inside the contract.' bin/fm-busy-lib.sh's new launch-prompt backstop also consumes tail40 (for claude/pi/gemini), so the comment now understates the argument's role and could mislead a maintainer into dropping the tail capture from a caller, re-opening the fm-watch/fm-crew-state absorb path this change closes.
✅ **Test** - passed

✅ No issues found.

  • Live validation: ✅ go - 4 of 8 scenarios driven live against the product
Scenario Result Live Evidence
A real Claude worker launched into a fresh worktree and left parked on its workspace-trust dialog is classified unknown launch-prompt, and the watcher's production absorb predicate treats it as not… ✅ pass live FM_LAUNCH_PROMPT_SIGNALS_LIVE=1 bash tests/fm-launch-prompt-signals-live-e2e.test.sh (live claude 2.1.278) and artifact live-launch-prompt-e2e.log
A real Pi-engine worker (pi, pi-signed, omp) launched into a fresh worktree carrying a trust-requiring project resource and left parked on the Trust project folder? dialog is classified `unknown lau… ✅ pass live FM_LAUNCH_PROMPT_SIGNALS_LIVE=1 bash tests/fm-launch-prompt-signals-live-e2e.test.sh (live pi 0.86.1) and artifact live-launch-prompt-e2e.log
A real Gemini worker launched with no credential and left parked on its auth-method picker or workspace-trust dialog is classified unknown launch-prompt. ✅ pass live FM_LAUNCH_PROMPT_SIGNALS_LIVE=1 bash tests/fm-launch-prompt-signals-live-e2e.test.sh (live gemini 0.60.0) and artifact live-launch-prompt-e2e.log
The authoritative crew-state read (bin/fm-crew-state.sh) against a real parked Claude pane reports unknown ... launch-prompt, never working, so the watcher's pause/absorb path cannot swallow the… ✅ pass live ROOT=&#34;$PWD&#34; bash ~/.no-mistakes/evidence/01M348CGYMPH2J3SAQ6WJV8PBQ/live-crew-state-parked.sh; artifact live-crew-state-parked.log
A genuinely working launch whose pane shows the normal working footer keeps busy fm-spawn; the backstop does not shorten or replace the existing busy-bound semantics. ⏸️ untested no The prior payload only ran the colocated unit suite bash tests/fm-busy-state.test.sh case test_launch_prompt_never_shortens_a_working_launch, which is not the live running product. No live launch…
A record advanced by any real hook event is never reclassified from rendered pane text, even when that pane renders the trust dialog. ⏸️ untested no The prior payload only ran the colocated unit suite bash tests/fm-busy-state.test.sh case test_launch_prompt_never_reclassifies_an_advanced_record, which is not the live running product. No real h…
With no captured tail supplied, a launch record still pinned at the fm-spawn seed keeps its own state rather than being reclassified. ⏸️ untested no The prior payload only ran the colocated unit suite bash tests/fm-busy-state.test.sh case test_launch_prompt_requires_a_captured_tail, which is not the live running product. No live call omitting…
Adversarial: the backstop is scoped to harnesses with a verified signature and requires both the dialog heading and its own option line - an unarmed harness (opencode) showing Claude dialog text stays… ⏸️ untested no The prior payload only ran the colocated unit suite bash tests/fm-busy-state.test.sh cases test_launch_prompt_scoped_to_armed_harnesses and test_launch_prompt_pi_requires_both_markers, which is…
  • bash tests/fm-busy-state.test.sh - all passed, including the 8 new launch-prompt classification cases (Claude trust/imports, Pi/pi-signed/omp trust, Gemini trust/auth/API-key, working-launch non-shortening, harness scoping, advanced-record immunity, no-tail fallback)
  • bash tests/fm-crew-state.test.sh - all passed, including test_no_run_launch_prompt_parked_is_not_working
  • FM_LAUNCH_PROMPT_SIGNALS_LIVE=1 bash tests/fm-launch-prompt-signals-live-e2e.test.sh - drove real claude 2.1.278, pi 0.86.1, and gemini 0.60.0 into their genuine launch prompts, captured the real panes, and required unknown launch-prompt plus a non-busy watcher gate
  • ROOT=&#34;$PWD&#34; bash ~/.no-mistakes/evidence/01M348CGYMPH2J3SAQ6WJV8PBQ/live-crew-state-parked.sh - real claude parked on its trust dialog, then real bin/fm-crew-state.sh read state: unknown · source: pane · ... (unknown launch-prompt), never working
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

✅ **PR** - passed

✅ Pull request created and recorded by no-mistakes.

✅ **CI** - passed

✅ All 20 checks passed; the pull request was merged.

@sdivanl
sdivanl force-pushed the fm/fm-launch-prompt-busy-bound branch from a3ef85b to 2be0b6c Compare September 22, 2026 10:14
@sdivanl sdivanl changed the title fix(bin): surface parked launch prompts as not started fix(bin): surface launches parked on an interactive prompt as not-started Sep 22, 2026
@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: first stamp — waiting-ci.

HEAD 2be0b6c50ad67abfc5964038e20a449d4fcdfd55 vs main f9f74a1d91cc7e105ec3df2249eda4e07f9ba540. MERGEABLE/UNSTABLE. Attestation MATCH. No Fixes/Closes claim in author body.

contract-class: restore (own inspection). Tip narrows false busy fm-spawn when the pane is still at the spawn seed and the harness-scoped interactive launch-prompt signature matches (Claude/Pi/Gemini trust/sign-in), classifying unknown launch-prompt so supervision surfaces not-provably-working launches. Captain-approved busy redesign already treats missing/unverified as unknown/not-busy; a parked interactive prompt was incorrectly absorbed as busy for the full BUSY_TURN_MAX_SECS. Genuine post-hook busy unchanged. Not a new always-on observer/wake class.

VISION: One captain/interface — aligns (honest not-started vs busy). Authority — aligns. Scripts/mechanics — aligns (classifier regex backstop is deterministic). Restart — aligns. Delegation spine — aligns (supervision sees parked launch). Vendor-orthogonal — aligns (harness-scoped signatures). Scope — aligns (busy/watch command layer). Closing: restores busy-contract honesty on the unconfigured path → auto-merge candidate when CI fully green.

CI: NM pass (35714848076 / 35714914213). CI run 35714848055 still has pending portable serial jobs (1/2/4/8 at stamp time); others green. workflow-zero; no approval needed this pass (checks already running).

Waiting on CI finish — not on author. No Firstmate flag. Will squash-merge if the remaining serials stay green (restore + MATCH + safe review).

@kunchenguid
kunchenguid merged commit 6f0f139 into kunchenguid:main Sep 22, 2026
20 checks passed
@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: this is merged. Thank you @sdivanl — really appreciate you taking the time on this.

CI fully green on tip 2be0b6c50ad67abfc5964038e20a449d4fcdfd55 (NM + all portable/Herdr/lint). contract-class restore; attestation MATCH; squash-merged.

BohnBawerick added a commit to BohnBawerick/firstmate that referenced this pull request Sep 23, 2026