Skip to content

fix(afk): deliver Codex wake events reliably via native submit confirmation - #8314

Open
artburkart wants to merge 14 commits into
kunchenguid:mainfrom
artburkart:fm/codex-wake-delivery
Open

artburkart wants to merge 14 commits into
kunchenguid:mainfrom
artburkart:fm/codex-wake-delivery

Conversation

@artburkart

@artburkart artburkart commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

What Changed

  • Herdr backend (bin/backends/herdr.sh) and the classifier (bin/fm-classify-lib.sh) gain native-submit confirmation for Codex wake injection. Ambiguous or unconfirmed submits are marked and held rather than blindly retried.
  • The supervise daemon and wake-drain (bin/fm-supervise-daemon.sh, bin/fm-wake-drain.sh) track delivery positions and frozen digests alongside the escalation buffer. Primary receipts start at the confirmed delivery cursor, and a stale wedge no longer keeps a captured endpoint.
  • fm-afk-start, fm-afk-return and fm-afk-launch now clear or restore the positions and frozen-positions sidecars wherever the escalation buffer is discarded or rolled back. Docs are updated, and tests are added or extended for the daemon, herdr backend, AFK launch, lifecycle e2e and the live herdr submit-confirm e2e.

Risk Assessment

✅ Low: The changes are bounded to supervision delivery and receipt handling, with no substantiated remaining defect or intent contradiction after accounting for recorded decisions.

Testing

I tried the live Herdr+Claude submit-confirm e2e with its opt-in flag. The isolated Herdr lab session never reported running within 60s, and a second manual provision attempt via bin/fm-herdr-lab.sh failed the same way. Live Codex scenarios therefore went untested. As a fallback I ran tests/fm-backend-herdr.test.sh and tests/fm-daemon.test.sh. Both exited 0, but they use stubs, so they establish no live result. The working tree is clean.

  • Live validation: ⚠️ inconclusive - 0 of 3 scenarios driven live against the product
Scenario Result Live Evidence
Live Codex primary in a Herdr lab receives a long supervision prompt via the guarded native route ⏸️ untested no Both bin/fm-herdr-lab.sh provision attempts (the e2e test's own and a manual one) failed: the lab session never reported running within 60s. A working Herdr server in this sandbox would let this be…
Codex native submission keeps exact text, guards and single-attempt failures (stubbed Herdr backend test) ⏸️ untested no The prior payload ran this only against a stubbed Herdr backend (tests/fm-backend-herdr.test.sh) with live=false, so it did not establish a live result.
Daemon receipts: drain does not acknowledge unpresented events, and ambiguous digests are held (daemon test) ⏸️ untested no The prior payload ran this only against stubs and fixtures (tests/fm-daemon.test.sh) with live=false, so it did not establish a live result.
Evidence: live submit e2e log

Source: live submit e2e log

fm-herdr-lab: lab session 'fm-lab-herdr-submit-con-1456412-20952' did not report running within 60 seconds
not ok - could not provision the isolated Herdr lab
exit=1
Evidence: backend test log

Source: backend test log

ok - fm_backend_herdr_version_check: accepts the current protocol (14)
ok - fm_backend_herdr_version_check: refuses an old protocol loudly
ok - fm_backend_herdr_version_check: refuses loudly when herdr is not installed
ok - fm_backend_herdr_workspace_label: a primary home (no marker) resolves to 'firstmate'
ok - fm_backend_herdr_workspace_label: a secondmate home (.fm-secondmate-home) resolves to '2ndmate-<id>'
ok - fm_backend_herdr_workspace_label: trims whitespace around the marker's secondmate id
ok - fm_backend_herdr_workspace_label: an empty marker file falls back to the primary label 'firstmate'
ok - fm_backend_herdr_workspace_label: two different secondmate homes get two different, non-colliding labels
ok - fm_backend_herdr_cli: sets HERDR_SESSION AND appends a trailing --session flag on every call
ok - herdr client selection: a live pane behind a stale shadowing client reads alive
ok - herdr recovery-grade read: a stopped server means missing there, and nowhere else
ok - herdr stale registration: a shell-only pane with a lingering Pi record is agent-free with an explicit reason
ok - herdr stale registration: no registered status can outrank a shell-only process view
ok - herdr pane agent session: a resumable reference is reported with the agent label that reported it
ok - herdr pane agent session: anything unresumable degrades to a nonzero read with no output
ok - herdr stale registration: a registered agent with a live Pi foreground process still reads alive
ok - herdr pane owns session: the foreground-occupant proof accepts only the real ancestry plus foreground group
ok - herdr stale registration: only a shell-only pane demotes a registration
ok - herdr stale registration: a transient prompt helper settles into stale-agent instead of reading live
ok - herdr stale registration: an exhausted settle window still reads a non-shell foreground as live
Terminated
ok - herdr stale registration: an agent process outside the foreground group still counts as alive
Terminated
ok - herdr stale registration: the descendant walk reads a spaced executable path whole
ok - herdr stale registration: an unreadable process view refuses instead of guessing either way
ok - herdr stale registration: an empty foreground list over a real shell is not unreadable, it settles via the descendant walk
ok - herdr process state: every foreground process is read, with spaced and tabbed args intact
ok - herdr process state: missing fields read empty and malformed views stay unreadable
ok - herdr process state: a foreground of several shells still proves a shell-only pane
ok - herdr process state: one sample costs the same jq calls for 1 or 8 foreground processes
ok - herdr stale registration: presentation reclaim never closes a stale-registration pane
ok - herdr projection abort cleanup reports success only when the task pane closed
ok - herdr stale registration: busy_state proves a working record at process level before reporting busy
ok - herdr client selection: one selected client is reused per process
ok - herdr client selection: selected clients remain scoped to their session
ok - herdr client selection: only protocol_mismatch triggers reselection; other failures pass through untouched
ok - herdr client selection: the happy path makes no extra call
ok - herdr client status: .server.compatible, legacy protocol equality, unknown, and stopped shapes all normalize
ok - fm_backend_herdr_launcher_identity: a firstmate not running inside herdr has no launcher workspace to inherit
ok - fm_backend_herdr_launcher_identity: HERDR_ENV=1 without a pane id selects the backend but binds no parent
ok - fm_backend_herdr_launcher_identity: resolves the launcher's exact workspace even when a same-labeled workspace sorts first
ok - fm_backend_herdr_launcher_identity: refuses a launcher pane that names a different herdr session
ok - fm_backend_herdr_launcher_identity: refuses a claimed pane without exact server identity
ok - fm_backend_herdr_launcher_identity: refuses a launcher pane whose injected socket belongs to another herdr server
ok - fm_backend_herdr_launcher_identity: refuses as unreadable when the launcher's own pane was destroyed
ok - fm_backend_herdr_launcher_identity: names a launcher pane id that resolves elsewhere or names no tab as stale and names the values to refresh
ok - fm_backend_herdr_launcher_identity: refuses when the launcher's pane and tab disagree about their workspace
ok - fm_backend_herdr_launcher_identity: refuses when the launcher's workspace is gone from its own session
ok - fm_backend_herdr_workspace_ensure: places a worker in the launcher's exact workspace, not the first same-labeled one
ok - fm_backend_herdr_workspace_ensure: refuses to guess between two same-labeled home workspaces
ok - fm_backend_herdr_workspace_ensure: a --secondmate container resolves that home's own workspace, not the launcher's
ok - fm_backend_herdr_container_ensure: surfaces the exact ambiguous-placement refusal instead of a generic failure
ok - fm_backend_herdr_container_ensure: version-gates, starts the server, ensures the firstmate workspace, echoes session:workspace_id + the seeded default tab id
ok - fm_backend_herdr_server_ensure: scrubs home and harness identity without disturbing unrelated environment or session routing
ok - fm_backend_herdr_server_ensure: still starts a stopped server when no ownership marker is present
ok - fm_backend_herdr_server_ensure: an externally managed server that stays down gets a bounded wait, no start, and an error naming its owner
ok - fm_backend_herdr_server_ensure: a running externally managed server is used at once
ok - fm_backend_herdr_server_ensure: a replacement marker makes it wait without starting, then proceed once the server is running
ok - fm_backend_herdr_server_ensure: a running server is not used while a replacement marker remains
ok - fm_backend_herdr_server_ensure: with no owner marker, a cleared replacement hands back to the Firstmate-owned start
ok - fm_backend_herdr_server_ensure: a replacement that never ends fails naming its marker instead of starting or using a server
ok - fm_backend_herdr_container_ensure: reuses an existing firstmate workspace without recreating it, and reports no seeded default tab (adopted, not created)
ok - fm_backend_herdr_container_ensure: workspace create passes --no-focus
ok - fm_backend_herdr_container_ensure: creates the workspace under the SECONDMATE home's own label, not 'firstmate'
ok - fm_backend_herdr_create_task: prunes exactly the seeded default tab container_ensure identified, once the first real task tab exists
ok - herdr repeated spawn/teardown: one persistent firstmate workspace reused, zero orphans, default tab pruned, create ran once
ok - fm_backend_herdr_create_task: an ADOPTED workspace's pre-existing tab is never pruned (the created-vs-adopted gate)
ok - fm_backend_herdr_create_task: the label-collision startup-workspace scenario (2026-07-02 incident) leaves the captain's live tab untouched
ok - fm_backend_herdr_workspace_prune_seeded_default_tab: refuses to close the seeded default tab when its pane reports a working agent (defense in depth)
ok - fm_backend_herdr_create_task: refuses a duplicate tab label (herdr's own tab create has no uniqueness check)
ok - fm_backend_herdr_create_task: a same-labeled tab with a live (even idle) registered agent still refuses exactly as before
ok - fm_backend_herdr_create_task: scans every same-labeled tab and refuses if any duplicate is live
ok - fm_backend_herdr_create_task: closes and replaces a same-labeled tab whose pane is dead (pane_not_found)
ok - fm_backend_herdr_create_task: closes and replaces a same-labeled tab whose pane is alive but hosts no registered agent (a restored plain shell)
ok - fm_backend_herdr_create_task: closes every confirmed same-labeled husk only after creating the replacement
ok - fm_backend_herdr_create_task: refuses success when a preexisting husk tab remains after replacement
ok - fm_backend_herdr_create_task: refuses (fail-safe) rather than guessing when the duplicate's agent state cannot be classified confidently
ok - fm_backend_herdr_create_task: creates the replacement tab BEFORE closing the 

... [11757 bytes truncated] ...

 not a timing race) only when EVERY poll in the window fails
ok - fm_backend_herdr_wait_for_working: treats blocked as submit-active for confirmation without changing watcher busy-state semantics
ok - fm_backend_herdr_send_text_submit: reports 'empty' once agent_status reports working after one Enter, without ever reading the composer
ok - fm_backend_herdr_send_text_submit: reports 'pending' when agent_status stays idle and the composer still holds unsent text after retried Enters (swallowed)
ok - fm_backend_herdr_send_text_submit: a failed literal send reports send-failed and replays the transport's stderr
ok - fm_backend_herdr_send_text_submit: a slash-command popup's placeholder fill on Enter #1 never flips agent_status to working, so it does not short-circuit as submitted; Enter #2 is retried and lands it
ok - fm_backend_herdr_send_text_submit: the Claude background-task exit picker gets no confirming Enter
ok - fm_backend_send_text_submit (herdr): a picker behind a blocked verdict is named by the caller's next composer read
ok - fm_backend_herdr_send_text_submit: a post-Enter blocked state confirms delivery without retrying into the prompt
ok - fm_backend_herdr_send_text_submit: native working + proven pending after retries reports empty (queued Enter)
ok - fm_backend_herdr_send_text_submit: a failed Enter cannot borrow preexisting working state as queued-delivery proof
ok - fm_backend_herdr_send_text_submit: a failed Enter cannot borrow a later native transition as delivery proof
ok - fm_backend_herdr_send_text_submit: idle native agent-state plus empty composer reports empty (landed Claude turn)
ok - fm_backend_herdr_send_text_submit: idle native baseline uses a rendered busy footer to confirm a queued Enter
ok - fm_backend_herdr_composer_state: cursor's mid-turn placeholder-plus-busy-token row reads pending (why delivery needs a separate signal)
ok - fm_backend_herdr_rendered_busy_state: busy/idle/unknown from the rendered footer, with an unreadable pane never reading idle
ok - fm_backend_herdr_send_text_submit: a rendered-footer idle-to-busy transition confirms delivery when native agent-state never reports idle
ok - fm_backend_herdr_send_text_submit: an already-busy footer baseline is never accepted as proof that this Enter landed
ok - fm_backend_herdr_send_text_submit: confirms submission via native agent-state alone, immune to a codex-style dynamic idle-tip composer that would have misread as 'pending' under the old composer-based confirmation
ok - fm_backend_herdr_composer_state: a faint real-codex dynamic idle-tip composer row reads empty
ok - fm_backend_composer_state (herdr): the pre-injection empty-box guard still refuses a genuinely non-empty composer, unaffected by the submit-confirmation change
ok - fm_backend_herdr_send_text_submit: a slow transition landing on a later sample within one Enter's budget is confirmed WITHOUT sending a needless extra Enter
ok - fm_backend_herdr_send_text_submit: reports 'send-failed' when the literal send-text call itself errors
ok - fm_backend_herdr_send_text_submit: an unreadable identity on an expected Codex pane returns 'send-failed' without typing
ok - fm_backend_herdr_send_text_submit: an unnamed identity on an expected Codex pane returns 'send-failed' without typing
ok - fm_backend_herdr_send_text_submit: reports 'unknown' when the post-Enter agent-get read fails (never retries past an unreadable target)
ok - fm_backend_herdr_send_text_submit: an unreadable composer stops Enter retries after native status stays idle
ok - fm_backend_herdr_send_text_submit: a 1500-character payload a Claude composer still holds is submitted whole
ok - fm_backend_herdr_send_text_submit: a long payload whose Claude composer kept only the tail is not submitted, is cleared, and reports send-failed
ok - fm_backend_herdr_send_text_submit: a refused suffix whose clear cannot be verified reports unknown, not send-failed
ok - fm_backend_herdr_send_text_submit: a refused 480-character suffix wrapped over five rows is cleared one row per Ctrl+U and reports send-failed
ok - fm_backend_herdr_send_text_submit: after a refused suffix is cleared, a resend starts from an empty Claude composer and submits only the message
ok - fm_backend_herdr_send_text_submit: a Claude composer holding leftover text is refused before anything is typed
ok - fm_backend_herdr_send_text_submit: a matching head in the transcript does not prove the current composer
ok - fm_backend_herdr_send_text_submit: an away-mode digest and a marked steer are submitted when Claude's read-back only drops U+2063
ok - fm_backend_herdr_send_text_submit: dropping U+2063 does not let a marked digest missing its head be submitted
ok - fm_backend_herdr_composer_state: a slash-command popup cannot hide a typed composer
ok - fm_backend_herdr_send_text_submit: a typed slash command hidden behind its popup is still proven and submitted
ok - fm_backend_herdr_composer_content: Claude 2.1.291's marked popup row is not read as the typed command
ok - fm_backend_herdr_send_text_submit: a slash command behind Claude 2.1.291's marked popup row is proven and submitted
ok - fm_backend_herdr_send_text_submit: with Claude 2.1.291's popup on screen a suffix, a placeholder plus remainder, or a prefix is still refused and cleared
ok - fm_backend_herdr_send_text_submit: a typed slash command Claude draws in muted truecolor grey is proven and submitted
ok - fm_backend_herdr_send_text_submit: a lone paste placeholder still submits the full long payload
ok - fm_backend_herdr_send_text_submit: a lone multi-line paste placeholder still submits the long multi-line payload
ok - fm_backend_herdr_send_text_submit: a paste placeholder followed by a literal remainder is not submitted and is cleared
ok - fm_backend_herdr_send_text_submit: three paste placeholders with no literal remainder submit the long payload
ok - fm_backend_herdr_send_text_submit: non-Claude and unidentified panes keep the pre-proof type-then-Enter behavior
ok - fm_backend_validate: herdr is a known backend (P2)
ok - fm_backend_busy_state: tmux (no native primitive) always reports unknown, preserving the P1 regex-only path
error: unknown backend 'bogus' (known: tmux herdr zellij orca cmux paseo rex t3code tern hc)
ok - fm_backend_composer_state dispatches every backend to its named thin classifier, unknown for unrecognized backends
ok - fm-peek/fm-send: explicit stale targets matching metadata use the recorded backend
ok - fm_backend_herdr_normalize_event routes through the shared record with an empty from_status
ok - fm_backend_herdr_escalation_marker keys the dedupe marker exactly like the watcher's .stale-<key>
ok - fm_backend_herdr_apply_transition: blocked dedupe starts only after explicit commit
ok - fm_backend_herdr_apply_transition: a working edge clears the marker so the next ->blocked re-escalates
ok - fm_backend_herdr_clear_transition removes task-owned dedupe state
ok - fm_backend_herdr_apply_transition: idle/done (defer) and unknown/empty (fallback) take no fast action
ok - fm_backend_herdr_wait_transition: a home with no herdr panes falls back to polling (rc 2)
ok - fm_backend_herdr_wait_transition: below-capability protocol/schema falls back to polling (rc 2)
ok - fm_backend_herdr_wait_transition: reconnect level-reconcile returns an uncommitted blocked pane
ok - fm_backend_herdr_wait_transition: subscribes before reconnect level-reconcile
ok - fm_backend_herdr_wait_transition: a still-blocked, already-escalated pane is not re-delivered on reconnect
ok - fm_backend_herdr_wait_transition: a streamed ->blocked edge returns the record sub-poll
ok - fm_backend_herdr_wait_transition: streamed working clears the marker, idle/done are deferred (clean timeout)
ok - fm_backend_herdr_wait_transition: a reader/subscribe failure falls back to polling (rc 2)
ok - fm_backend_herdr_wait_transition: Bash 3.2-safe bad-ack path closes fd 9 and removes its FIFO
ok - fm_backend_herdr_wait_transition: stock macOS Bash clean timeout closes fd 9 and returns 1
jq: parse error: Invalid numeric literal at EOF at line 1, column 8
ok - Codex native submission preserves exact text/endpoint, guards and single-attempt failures
exit=0
Evidence: daemon test log

Source: daemon test log

ok - fm-afk-start.sh fails before daemon startup when the afk flag cannot be written
ok - fm-afk-start.sh ignores stale pidfile-only live pids
ok - fm-afk-start.sh refuses tern as an away-mode supervisor backend (unsupported; documented in docs/tern-backend.md)
ok - fm-afk-start.sh reclaims stale daemon locks whose live pid identity no longer matches
ok - supervise daemon state root is scoped by FM_HOME
ok - routine signal self-handles
ok - captain-relevant status verbs escalate
ok - check + unknown escalate; heartbeat self-handles
{run-worktree}/bin/fm-classify-lib.sh: line 1669: fm_lock_acquire_wait_bounded: command not found
ok - a delivered unknown wake is acknowledged once per away session; a new one and ordinary escalations still fire
ok - a failed unknown-wake acknowledgement write does not re-inject a delivered digest
ok - transient stale self-handles and records a persistence marker
ok - enriched stale wedges bypass status absorption except under a declared wait, without disturbing busy workers
ok - an enriched wedge under a declared wait uses the pause cadence and restores wedge detection on resume
ok - an enriched wedge under a worker blocker is not escalated only where config/wedge-defer-worker-wait arms it
ok - stale + terminal status escalates immediately
ok - stale escalation and current wait cadence remain independent
ok - paused reasons with captain phrases remain pause-classified
ok - a foreign resolved line keeps a pause, while the worker's own resolved line retracts it
ok - a captain-held transfer classifies as pause, not as a wedge candidate
ok - handle_wake on a paused stale records a pause marker, drops the wedge marker, and does not escalate
ok - handle_wake records a declared pause from a routine signal for long-cadence rechecks
ok - a terminal signal clears pause and stale tracking across both supervisors
ok - housekeeping migrates a normal-watcher's declared pause into daemon tracking
ok - housekeeping clears an already-resumed watcher pause across both supervisors
ok - housekeeping seeds pause tracking from status without a watcher marker
ok - persistent stale escalates after threshold and clears its marker
ok - resumed (busy) stale clears its marker without escalating
ok - housekeeping re-surfaces a stale declared pause on the long cadence and resets its window
ok - housekeeping re-surfaces a forgotten captain hold on the long cadence and resets its window
ok - housekeeping silences a captain hold only under an away record, never under quiet mode's
ok - a busy pane cannot gate the pause clear once its crew's status no longer declares the wait
ok - housekeeping matures a busy pane's declared-wait window into exactly one recheck per window
ok - away-mode housekeeping opens one overdue decision and worker resume closes it
ok - without config/pause-ceiling an old away-mode pause keeps the plain pause recheck
ok - a failed overdue queue stays an open decision the next housekeeping pass raises
ok - failed enqueue followed by a worker event closes without an obsolete alert, retaining failed resolutions
ok - a watcher-written overdue marker leaves the blocker to ordinary escalation
ok - an open overdue decision with no marker is not opened again
ok - unrelated blockers and repeated pauses preserve overdue decisions
ok - initial overdue publication reconciles resumes on either side of its blocker append
ok - overdue self-announcement preserves prior unread events without duplicate heartbeat
ok - quiet-mode housekeeping applies the overdue pause ceiling
ok - housekeeping bounds a distant declared time, defers to a near one, and rechecks a passed one at once
ok - housekeeping clears a paused marker once the crew is no longer declaring the pause
ok - housekeeping clears the pause marker once a captain hold is answered
ok - housekeeping moves an existing stale marker to pause before wedge escalation
ok - housekeeping moves a captain hold's existing stale marker to pause before wedge escalation
ok - housekeeping clears tracking when a crew leaves pause
ok - persistent herdr stale resolves the target from metadata and escalates
ok - herdr idle busy-footer stale clears through capture corroboration
ok - resumed herdr stale clears through backend-aware busy state
ok - persistent Orca stale resolves the terminal from metadata
ok - multiple escalations flush as a single batched digest
ok - batch flush measures max-delay from the first append, not the last
ok - catch-all scan escalates a missed terminal once, not twice
ok - handle_wake routes routine->self and captain->escalate
ok - a decision-owned queued row escalates once as the decision, then suppresses until the status changes
ok - a captain-held decision-owned row is self-handled without escalation, now and on repeat
ok - INJECT_SKIP forces self-handle, bypassing captain-relevant classification
ok - is_wake_reason distinguishes watcher wake reasons from singleton-status stdout
ok - terminal-stale escalate removes its marker so housekeeping does not re-escalate
ok - captain signal escalate marks seen so the catch-all scan does not re-fire
ok - _collapse_newlines replaces newlines with literal separator
ok - afk flag absent: daemon does not inject, buffer preserved
ok - busy-guard defers injection when supervisor pane is busy
ok - marker detection: marker -> stay afk, no marker -> exit afk
ok - /afk invocation is exempt from afk exit (no self-cancel)
ok - should_exit_afk returns false when afk is not active
ok - strip_injection_marker removes the sentinel marker cleanly
ok - a marker-preserving primary still receives the typed U+2063 away-supervisor envelope and no record
ok - record-backed doorbell: only a doorbell naming this home's own record stays afk; a bare ASCII label, a missing record, and another home's record exit
ok - pane_input_pending detects partial input on the cursor line
ok - pane_input_pending: a blank unidentified cursor row defers (strict container-proof rule)
ok - pane_input_pending: only proven empty agent prompts pass
ok - fm_tmux_composer_state: a bare shell prompt ($/%/#/>) reads unknown, never empty (dead-shell injection safety)
ok - fm_tmux_composer_state: a bordered composer box and bare agent glyphs (❯/›) still read empty
ok - fm_tmux_composer_state: only matching edge borders form a composer box
ok - pane_input_pending preserves bright placeholder-like drafts in styled captures
ok - classify_signal dedupes against the catch-all scan seen marker
ok - turn-end markers stay routine while mixed actionable status batches escalate
ok - an actionable event is escalated to an away captain despite later routine appends
ok - the daemon commits exactly the endpoint captured by classification
ok - a stale wake escalates a blocker hidden by later progress
ok - a stale span read failure surfaces without advancing its marker
ok - a recreated status rejects the old captured identity
ok - an unverifiable status identity surfaces without advancing markers
ok - a status read failure surfaces without advancing the daemon suppressor
ok - catch-all routine scans advance before later actionable appends
ok - failed escalation writes retain durable wakes and classification positions
ok - stuck inbox escalation reaches supervision in away mode and survives buffering failure
ok - stuck inbox escalation reaches supervision in quiet mode and survives buffering failure
ok - write inbox escalation reaches supervision in away mode and survives buffering failure
ok - write inbox escalation reaches supervision in quiet mode and survives buffering failure
ok - reset inbox escalation reaches supervision in away mode and survives buffering failure
ok - reset inbox escalation reaches supervision in quiet mode and survives buffering failure
ok - inbox dispatch preserves ordinary stale, busy-turn, and other doorbell routing
ok - catch-all markers advance only after escalation buffering succeeds
ok - classification failure retains the complete durable wake batch
ok - missing-status stale wakes remain ordinary and acknowledgeable
ok - transient unreadable signals recover without advancing their position
ok - daemon catch-all reclassifies permission-recovered status content
ok - a permanent classification failure is reported, acknowledged, and never advances its position
ok - the away-mode catch-all scan surfaces a masked event once
ok - classify_stale dedupes against the signal path seen marker
ok - AFK nonterminal working:+merged keeps wedge aging and re-escalates at bound
ok - genuine done: and merge-check events still escalate
ok - pane_input_pending: an idle bordered composer is NOT pending (afk-invx-i5)
ok - pane_input_pending: text inside a bordered composer is still pending
ok - submit-ACK confirms a submit when the composer returns to a bordered-empty box
ok - submit-ACK reports pending on a persistently swallowed Enter (type-once)
ok - max-defer on an empty stuck pane types once, alarms, and preserves the buffer
ok - max-defer flushes and clears the buffer on an empty bordered pane
ok - max-defer on a pending composer alarms without typing
ok - a composer deferral names pending text apart from an unproven composer
ok - normal flush clears a stale wedge marker
ok - an oversized buffered digest is delivered bounded, with the full text kept durable
ok - a digest past its byte budget counts the omitted events and keeps them in the full text
ok - an initial-send failure logs its stage, bytes, and stderr, and the wedge alarm names it
ok - an Enter-confirmation failure logs its own stage and byte count
ok - a bounded digest's full-text file survives a failure after typing, and a deferral writes none
ok - below MAX_DEFER: no inject, no alarm, buffer preserved
ok - max-defer does not flush or alarm while afk is inactive
ok - library mode: sourcing the daemon defaults FM_WEDGE_ALARM_EXEC to discard (no test can fire a real notification)
ok - wake helpers replace inherited notifier overrides with the safe recorder
ok - the discard seam suppresses every notifier, including command: (fires nothing)
ok - direct notifier helpers honor the discard seam, including command:
ok - osascript channel routes through the notifier seam with the summary (never a real notification)
ok - herdr channel routes through the notifier seam with the summary (never a real notification)
ok - rex channel routes through the notifier seam with the summary (never a real pane write)
ok - auto never adds the opt-in rex channel, even on a Rex supervisor pane
ok - command channel runs the captain command with the summary on $1 and on stdin
ok - command channel failures redact configured commands while logging their exit status
ok - unknown channel directives are redacted while the alarm keeps running
ok - off disables every active alert regardless of directive position (marker and tmux flash are unaffected)
ok - auto resolves to the macOS osascript notifier on Darwin (default-on)
ok - auto on a non-macOS platform selects no built-in OS channel (the marker or a configured command carries it)
ok - config/wedge-alarm selects every configured channel and skips comment and blank lines
ok - a failing channel logs and falls back to the next channel, never crashing the alarm
ok - a hung notifier is bounded, logged, and falls through to the next channel
ok - a backgrounded command notifier remains bounded until its process group is reaped
ok - a hung notifier override is bounded, logged, and proceeds to the next channel
ok - daemon shutdown stops and reaps the active notifier process group
ok - inject_wedge_alarm writes the marker AND emits the active alert even with no tmux status-line (herdr backend)
ok - in-process wedge throttle prevents alert spam when the marker cannot persist
ok - fm-send returns 3 with a non-error no-resend warning when confirmation stays pending
ok - fm-send exits non-zero when initial text send fails
ok - fm-send exits non-zero unless delivery is proven empty
ok - discover_supervisor_backend: override > TMUX_PANE > HERDR_ENV+HERDR_PANE_ID > tmux fallback
ok - discover_supervisor_target: override > TMUX_PANE > herdr '<session>:<pane-id>' composition > firstmate:0 fallback
ok - discover_supervisor_{target,backend}: hc markers resolve <session>:<address> + hc; bare id, nested tmux/herdr keep their verdicts; supported list stays closed to hc
ok - discover_supervisor_*: t3code resolves from the home's live thread after env, TMUX_PANE, and herdr; zero, ambiguous, and no-bearer fall through
ok - pane_is_busy: t3code accepts only a settled thread with no pending request and never reads a rendered tail
ok - pane_is_busy: herdr native busy_state='busy' short-circuits without a capture fallback
ok - primary busy guard isolates rendered signatures by detected harness
ok - pane_is_busy: omitted backend defaults to tmux for Grok's isolated fallback
ok - pane_input_pending: dispatches through fm_backend_composer_state for backend=herdr
ok - inject_msg: herdr busy-guard defers before ever attempting a submit
ok - inject_msg: herdr composer-guard defers before ever attempting a submit
ok - inject_msg: herdr pane-gone check defers before any busy/composer/submit call
ok - inject_msg: dispatches busy-guard/composer-guard/submit through the herdr backend and succeeds on a confirmed empty composer
ok - inject_msg: defers on a dead-shell/unreadable composer (unknown), never typing the escalation into a shell
ok - inject_msg: unrecognized composer states defer by default
ok - a dialog name on a first-sight stale reaches the away persistence line
ok - a seen terminal status on the picker clears like a plain stale
ok - a dialog name joins the escalation of an unseen status
ok - a dialog name after demand-deep-inspection still escalates, and a declared wait still pauses
ok - consumer handover shares successful cuts and preserves interleaved appends and failures
ok - frozen digest receipts preserve next-generation endpoints
ok - ambiguous native submission holds later flushes without dropping new events
ok - ambiguous frozen native submission is held
ok - daemon delivery receipts stop before unread informational lines
ok - a daemon drain does not consume the primary's unread notes
ok - an event presented by the primary's outcome backstop is not escalated again
ok - a primary drain receipt does not cover unpresented actionable events
exit=0
  • Outcome: ⚠️ 2 warnings across 1 run (3m2s)

Pipeline

Updates from git push no-mistakes

✅ **Intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

✅ **Review** - passed

✅ No issues found.

⚠️ **Test** - 2 warnings
  • ⚠️ The Herdr lab session could not start here (not running within 60s). The live Codex native-submit scenarios are untested. A leftover tripwire for session fm-lab-probe-1458052-13876 remains in the lab state because teardown refused it.
  • ⚠️ live validation verdict: inconclusive (0 of 3 scenarios were driven live against the product); untested: Live Codex primary in a Herdr lab receives a long supervision prompt via the guarded native route, Codex native submission keeps exact text, guards and single-attempt failures (stubbed Herdr backend test), Daemon receipts: drain does not acknowledge unpresented events, and ambiguous digests are held (daemon test)
  • Live validation: ⚠️ inconclusive - 0 of 3 scenarios driven live against the product
Scenario Result Live Evidence
Live Codex primary in a Herdr lab receives a long supervision prompt via the guarded native route ⏸️ untested no Both bin/fm-herdr-lab.sh provision attempts (the e2e test's own and a manual one) failed: the lab session never reported running within 60s. A working Herdr server in this sandbox would let this be…
Codex native submission keeps exact text, guards and single-attempt failures (stubbed Herdr backend test) ⏸️ untested no The prior payload ran this only against a stubbed Herdr backend (tests/fm-backend-herdr.test.sh) with live=false, so it did not establish a live result.
Daemon receipts: drain does not acknowledge unpresented events, and ambiguous digests are held (daemon test) ⏸️ untested no The prior payload ran this only against stubs and fixtures (tests/fm-daemon.test.sh) with live=false, so it did not establish a live result.
  • FM_HERDR_SUBMIT_CONFIRM_LIVE=1 bash tests/fm-herdr-submit-confirm-live-e2e.test.sh (provisioning failed)
  • bin/fm-herdr-lab.sh prepare/provision of a probe lab (provision failed; teardown refused for a missing tripwire)
  • bash tests/fm-backend-herdr.test.sh (exit 0, stubbed)
  • bash tests/fm-daemon.test.sh (exit 0, stubbed)
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

@greptile-apps

greptile-apps Bot commented Nov 9, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The reviewed changes appear safe to merge; no new actionable issue remains.

Reviews (8) · Last reviewed commit: "no-mistakes(ci): Fixed ci-1 (Greptile) b..." · Reviewed by Greptile

Comment thread bin/fm-supervise-daemon.sh Resolved
Comment thread bin/fm-supervise-daemon.sh Resolved
Comment thread bin/fm-afk-launch.sh Resolved
@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: thank you @artburkart, and welcome. Moving Codex digests onto Herdr's native agent prompt request, and holding ambiguous sends instead of retrying them blind, is a good direction. I read the whole diff at head d192161e against main 660d2b31 and approved your fork CI runs for this head. The no-mistakes attestation binds this head with no skipped steps, and the no-mistakes check, Repo invariants and Test coverage guard pass. The red Full suite row is only the maintainer full-ci label gate, so it doesn't count against you.

Where it stands: waiting on you for two things.

  1. Greptile's open P2, "Rollback loses delivery positions" on bin/fm-afk-launch.sh (r4517556571). I think it's right. fm_afk_launch_restore_backup now deletes .subsuper-escalations.positions and .subsuper-escalations.frozen-positions, but the backup and restore loops don't carry them. So a restored buffer loses its receipts, and its events can show up again in the primary's drain. Please back up and restore both position files with their buffer (or reply on the thread if you disagree), then resolve the thread.
  2. Live evidence for the native Codex route. For every Herdr home with a Codex primary, this replaces the default delivery path. Your docs say native Codex acceptance "remains unperformed", and the body shows 0 of 4 scenarios run live because the lab never started. This can be tested live, and your new opt-in guard covers it. Could you run FM_HERDR_SUBMIT_CONFIRM_LIVE=1 bash tests/fm-herdr-submit-confirm-live-e2e.test.sh on a host where Herdr and Codex start, and post the transcript, including the long-prompt reply? A live away-mode digest landing in a real Codex primary would be even better.

When both are done, please re-raise with git push no-mistakes so the attestation binds the new head.

FYI, not blocking: the Known limitation you listed is noted for Kun's decision. Callers without FM_HERDR_EXPECTED_HARNESS (fm-send, the steering doorbell, fm-control, warm compaction) still fall back to literal paste when identity is unresolved. That matches main's behaviour, so it isn't a regression. The same goes for the new .native-unconfirmed hold, which stops every later away digest until someone clears it by hand.

Contract-class (my own read): new-default. For every unconfigured Herdr+Codex home, delivery moves from paste/Enter to a native prompt with no retry. Digest receipts and the daemon/primary drain split also change unconfigured presentation behaviour. So once the full suite is green, this goes to Kun for a merge-or-leave decision and won't auto-merge. VISION.md: aligns on every rule except two I can't settle yet: adapter verification (the live evidence above) and whether the ambiguity hold surfaces to the captain. Both are covered by the asks above.

@artburkart
artburkart force-pushed the fm/codex-wake-delivery branch from d192161 to c490eda Compare November 9, 2026 23:39
@artburkart artburkart changed the title fix(herdr): deliver Codex wake digests via guarded native submission fix(afk): make Codex wake delivery confirm submits and hold ambiguous digests Nov 9, 2026
@artburkart

Copy link
Copy Markdown
Contributor Author

Thanks for the review.

  1. Rollback positions: fixed in f63b1fd2. The launch backup loops and the rollback restore loop in bin/fm-afk-launch.sh now carry .subsuper-escalations.positions and .subsuper-escalations.frozen-positions with the buffer, and unit_rollback_restores_delivery_positions in tests/fm-afk-launch.test.sh covers it. The thread is resolved, and the branch was re-raised through git push no-mistakes, so the attestation binds the new head c490eda5.
  2. Live evidence: we can't currently start a live Herdr lab with a Codex primary on our host, so the live run isn't available yet. The change is covered by the stubbed and executable suites listed in the PR body. We're glad to run FM_HERDR_SUBMIT_CONFIRM_LIVE=1 bash tests/fm-herdr-submit-confirm-live-e2e.test.sh and post the transcript, including the long-prompt reply, once a Codex-primary host is available.

The decision on default delivery for Herdr+Codex homes is Kun's to make.

@artburkart artburkart changed the title fix(afk): make Codex wake delivery confirm submits and hold ambiguous digests fix(daemon): deliver Codex wake digests with confirmed native submit Nov 10, 2026
@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: thanks @artburkart. The rollback fix looks right: both position files now travel with the buffer, and unit_rollback_restores_delivery_positions covers it. The new receipt fix in 4eefa909 (receipts start at the confirmed delivery cursor) answers the no-mistakes review finding. Greptile is 5/5 and every thread is resolved. I read the whole diff at 4eefa909 against main 913bb7a7 and approved your fork CI runs for this head.

Where it stands: waiting on you for two things.

  1. One clean no-mistakes re-raise. The attestation binds 4eefa909, but it shows rebase: skipped. Your branch has no conflict with main. This repo treats any skipped step as blocking, so please run git push no-mistakes once more and make sure no step is skipped.
  2. Live Codex evidence is still open. I understand you don't have a Codex-primary Herdr host right now. This PR still replaces the default delivery path for every Herdr home with a Codex primary, and the change can be tested live. So we need FM_HERDR_SUBMIT_CONFIRM_LIVE=1 bash tests/fm-herdr-submit-confirm-live-e2e.test.sh passing the native Codex long-prompt case before it can move on. Please post the transcript once you have a host. Another contributor with a Codex-on-Herdr setup can run it too.

After both are in, this goes to the maintainer suite and then to Kun for a decision on the default change.

A drain that reaches the primary session publishes delivery receipts the daemon honors, while the daemon's own queue drain does not, so classification still sees events its own drain read.
…moved wherever the escalation buffer is discarded (fm-afk-start clear_stale_artifacts, fm-afk-return clear_delivery_artifacts, fm-afk-launch restore); extended the clear-stale unit test. ci-2: escalate_flush_frozen now writes the native-unconfirmed ambiguity marker when INJECT_RETRY_UNSAFE is set, so ambiguous frozen digests are held; added test_frozen_native_ambiguity_holds. fm-afk-launch tests passed. fm-daemon.test.sh ran 174 passing, 0 failing, including the new test, before hitting the 590s timeout, so the remainder of that file did not run
…h rollback

The away-mode launch backup and rollback loops preserved the escalation
buffer but not its .positions and .frozen-positions sidecars, so a failed
launch restored the buffer without its delivery receipts. Back up and
restore both sidecars with the buffer, and add a regression test.
The live submit-confirm e2e treated Codex as ready once its composer read
empty, but Herdr's agent status can still report unknown for several
seconds afterwards, so the native submit guard refused the send. Also wait,
bounded, for Herdr to report the agent idle or done, and fail with the last
observed status on timeout. The submit guard itself is unchanged.
@artburkart
artburkart force-pushed the fm/codex-wake-delivery branch from 4eefa90 to aa0d5dd Compare November 10, 2026 03:36
@artburkart artburkart changed the title fix(daemon): deliver Codex wake digests with confirmed native submit fix(afk): deliver Codex wake events reliably via native submit confirmation Nov 10, 2026
Comment thread bin/fm-supervise-daemon.sh Resolved
@greptile-apps

greptile-apps Bot commented Nov 10, 2026

Copy link
Copy Markdown

Want your agent to iterate on Greptile's feedback? Try greploops.

…ch before sending. The daemon's retry hold is keyed to its own harness, but the Herdr backend picks native Codex submission from the pane's live identity. In `bin/backends/herdr.sh`, `fm_backend_herdr_send_text_submit` now returns `send-failed` without submitting when the pane is Codex and `FM_HERDR_EXPECTED_HARNESS` is set to something other than `codex`. A non-Codex daemon targeting a Codex pane via `FM_SUPERVISOR_TARGET` can therefore no longer send natively without `INJECT_RETRY_UNSAFE` being set. Callers that don't set the expected harness (direct `fm-send`, etc.) behave as before, and the daemon path for a Codex daemon is unchanged. I added the regression test `test_send_text_submit_refuses_codex_pane_when_expected_harness_differs` to `tests/fm-backend-herdr.test.sh`. It uses a Codex pane with the expected harness set to `claude`, and asserts the result is `send-failed` and nothing is prompted or typed. `bash tests/fm-backend-herdr.test.sh` exited 0 with 256 `ok` lines and no `not ok`. I did not run the daemon test suite
@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: thanks @artburkart. The clean re-raise landed: the attestation binds 5c823dd3 with every step completed, including rebase. The new FM_HERDR_EXPECTED_HARNESS guard fixes Greptile's "wake digests can repeat" P1. A Codex pane reached by a daemon expecting a different harness, or a pane whose identity can't be read, now gets send-failed without anything being typed. Greptile is 5/5 and all four threads are resolved.

I read the whole diff at 5c823dd3 against main 913bb7a7. There are no workflow, CI, network or credential changes. I've approved your fork CI runs for this head.

Where it stands: waiting on you for one thing, the live Codex evidence. Thanks for trying the opt-in e2e. I can see the Herdr lab never reported running within 60 seconds, so no Codex case ran. This PR still replaces the default delivery path for every Herdr home with a Codex primary, so we need FM_HERDR_SUBMIT_CONFIRM_LIVE=1 bash tests/fm-herdr-submit-confirm-live-e2e.test.sh to pass its native Codex long-prompt case on a real host. Please post that transcript before this moves on. Any contributor with Codex on Herdr can run it too.

Contract-class: new-default (my own read, unchanged). Once the live evidence is in and CI is green, we run the full suite, and then this goes to Kun as a decision on the default change.

@artburkart

Copy link
Copy Markdown
Contributor Author

Live evidence for the native Codex route, run on macOS at head 5c823dd3 with herdr 0.9.5, Claude Code 2.1.321 and codex-cli 0.167.0:

$ FM_HERDR_SUBMIT_CONFIRM_LIVE=1 FM_HERDR_LAB_FLEET_SESSION=default bash tests/fm-herdr-submit-confirm-live-e2e.test.sh
ok - live Herdr submit confirm: Claude Code (2.1.321 (Claude Code)) on herdr 0.9.5 reports empty and renders the requested reply in isolated session fm-lab-herdr-submit-con-71137-411
ok - live Herdr submit confirm: Claude Code (2.1.321 (Claude Code)) on herdr 0.9.5 submits a U+2063 away-supervisor payload whose read-back drops the mark
ok - live Herdr submit confirm: Claude Code (2.1.321 (Claude Code)) on herdr 0.9.5 proves and submits a typed /context behind its command popup and renders its report
ok - live Herdr submit confirm: Claude Code (2.1.321 (Claude Code)) on herdr 0.9.5 proves and submits a typed /exit behind its command popup
ok - live Herdr submit confirm: Codex (codex-cli 0.167.0) on herdr 0.9.5 submits a native long prompt

The Codex scenario sends a 6,000-character prompt through Herdr's native agent prompt request, and the requested reply token renders in the pane. Codex's folder-trust and hook-trust prompts for the checkout were accepted beforehand, so Codex ran with the repository's hooks active.

An earlier live run found that the guard's Codex readiness check could fire before Herdr's native status settled. agent get reported unknown for several seconds after the composer was empty, so the native submit correctly refused. 9bb5c95f makes the guard wait for idle before sending. The send guard itself is unchanged.

@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: thanks @artburkart, that's the evidence I asked for. The live run at 5c823dd3 (herdr 0.9.5, codex-cli 0.167.0) passes the native Codex long-prompt case: a 6,000-character prompt goes through Herdr's native agent prompt and the reply token renders. All four Claude cases pass too. Your note on 9bb5c95f (wait for idle before the native submit, send guard unchanged) matches what I see in the diff.

Where it stands: nothing is waiting on you now. It's waiting on us. The head is unchanged, the attestation binds it with no skipped steps, the quick checks pass, Greptile is 5/5 and all four threads are resolved. The next step is the full suite. We're holding all new full-suite runs until main is green again: main currently fails Behavior portable serial 9 because of an upstream Pi release (#8325), so a run now would fail for reasons that aren't yours. Once main is fixed I'll queue it here.

Contract-class: new-default (my own read, unchanged). It changes the default delivery path for every Herdr home with a Codex primary. Once the full suite is green, it goes to Kun as a merge-or-leave decision rather than auto-merging.

@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: thanks @artburkart. Nothing is waiting on you. Every author-side gate is met on 5c823dd3: the attestation binds it with no skipped steps, the live Codex native long-prompt run passes, the quick checks pass, Greptile is 5/5, and all four threads are resolved. Since #8318 landed, the branch conflicts with main, and that conflict is ours to fix, so please don't rebase. The full suite can't run on a conflicting branch. Because this changes the default delivery path for every Herdr home with a Codex primary (contract-class: new-default), it now goes to Kun for a merge-or-leave decision. If Kun says merge, we'll resolve the conflict, re-run no-mistakes and the full suite, and merge only if it's green.

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