Repository navigation
fix: deliver afk escalations when Herdr is idle - #2
Merged
Merged
Conversation
knowttl
added a commit
that referenced
this pull request
Jul 30, 2026
* fix(supervision): stop alarming long in-contract calls as possible wedges A crewmate blocked on a long foreground call is idle by design: a `no-mistakes` gate call blocks synchronously against its own multi-thousand-second allowance, so its pane stays frozen far past the 240s wedge threshold. Both supervisors escalated on that threshold alone, so every pipeline gate produced a stream of possible-wedge alarms against healthy workers (three in one day on 2026-07-30, one of them 916s into a healthy call with a 3000s allowance). A warning that is usually wrong trains its reader to dismiss the one that is real. The threshold now selects re-examination, not alarm. On reaching it, the crew's current state is re-read once per threshold window; a crew still provably working is deferred for another window, and only a crew that stops verifying as working - or one that stays idle past the new FM_WEDGE_WORKING_ESCALATE_SECS allowance (default 3600s) - escalates. That is the disambiguation a supervisor otherwise had to perform by hand before believing the alarm. The real-wedge guarantee is preserved and documented: a crew that goes quiet surfaces within one threshold window of stopping, and a frozen pipeline that keeps reporting itself as running surfaces within the allowance. The deferral trades false alarms for latency, never for silence, and can be disabled with FM_WEDGE_WORKING_ESCALATE_SECS=0. bin/fm-classify-lib.sh owns the decision (wedge_escalation_deferred) for both the always-on watcher and the away-mode daemon; each consumer owns only its own verification marker, so the crew state is read at most once per threshold window per pane. Compatibility review: the changed code makes no harness- or backend-specific call. It consumes bin/fm-crew-state.sh's verdict, which already resolves the busy signature per recorded harness (claude, codex, opencode, pi, pi-signed, grok, kimi) and the endpoint per recorded backend (tmux, herdr, zellij, orca, cmux) through bin/fm-backend.sh; the daemon path additionally remains restricted to its existing tmux/herdr supervisor panes. Codex Desktop is not a spawn backend and has no stale marker, so it is not applicable here. Tests: tests/fm-watch-triage.test.sh and tests/fm-daemon.test.sh cover both directions - repeated threshold windows absorb a live in-contract call, while a stopped crew and a frozen pipeline past the allowance still escalate. Each escalation assertion was watched failing against deliberately broken variants (no ceiling; always-working verdict) before being kept. * test(daemon): drop fork-only Herdr native-idle supervisor-guard tests These two tests assert that the away-mode supervisor guard treats Herdr's native `agent.get` idle verdict as conclusive and skips the regex-over-capture corroboration. That short-circuit was a fork-only change; the implementation it asserted was removed when bin/fm-supervise-daemon.sh was restored to match upstream exactly (c4ec3b2), leaving the tests behind and tests/fm-daemon.test.sh deterministically red on the default branch. This fork tracks upstream exactly and fork-only customizations are discarded, so the artifact to remove is the test, not the implementation: re-adding the short-circuit would recreate the drift the upstream match deliberately removed. Upstream behavior is unchanged - a non-`busy` native verdict still corroborates against the recorded harness's rendered busy signature before the supervisor pane is treated as idle. The rest of PR #2's away-mode work is untouched and still covered: the U+00A0 composer classification tests pass, as do the herdr busy-state, capture-fallback, and inject-dispatch tests. tests/fm-daemon.test.sh now runs to completion: 100 passing, 0 failing (previously it aborted at 90 with these 2 failures). Note for the PR body: this removal and its reason belong on their own line at merge review. * no-mistakes(review): Clarify away-mode stale escalation contract * no-mistakes(document): Align wedge deferral documentation
This was referenced Aug 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Diagnosis
The primary read-only daemon log recorded repeated
inject deferred: supervisor pane busy (agent mid-turn)events and a 31,726-second max-defer wedge.pane_is_busyasked Herdr for native state but then re-scanned scrollback when it reportedidle; historical quotedesc to interruptoutput therefore made an idle supervisor appear busy indefinitely.A related tmux submit-verification bug treated Claude’s
❯plus U+00A0 empty composer as pending because POSIX[:space:]does not trim U+00A0.Fix
busyoridlestatus as conclusive for the supervisor injection guard, while retaining regex fallback forunknown.docs/herdr-backend.md.Tests and verification
Confirmed before this PR:
bash tests/fm-composer-lib.test.shpassed.bash tests/fm-daemon.test.shpassed.PATH="$PWD/.tmp-bin:$PATH" bin/fm-lint.shpassed with the repository-pinned ShellCheck 0.11.0 installer.esc to interrupt, a max-defer delivery simulation, and the Claude U+00A0 composer state.No Herdr session, workspace, or pane lifecycle command was used.