Repository navigation
fix(afk): route claude+herdr away-mode launch through the terminal-backed path - #3089
NicholasACTran wants to merge 2 commits into
Conversation
…cked path A Claude Code background shell hosting the sub-supervisor daemon inside the captain's own pane leaves a footer token that herdr's claude agent-detection ruleset misreads as permanently "working", so the away-mode busy guard can never read that pane idle and no escalation is ever delivered. Root cause documented in data/firstmate-afk-daemon-wedged-investigation/report.md (2026-08-26): 408 identical busy-guard deferrals over 95 minutes, versus a clean 2h22m run on the terminal-backed FM_SUPERVISOR_TARGET path. Route claude on the herdr backend through bin/fm-afk-launch.sh start (the non-visible tracked terminal path) instead of start-native, and correct the "it is fine" belief recorded in the afk skill and both launcher scripts' header comments. Other harness/backend combinations are unaffected: tmux's rendered busy-fallback regex does not match the background-shell footer token, so only herdr's native agent-status path is implicated. Deliberately not implemented: teaching the busy guard to subtract the daemon's own footer contribution, since that couples firstmate to a private, versioned herdr ruleset that already changes without notice.
Confidence Score: 5/5The reviewed changes appear safe to merge because no blocking failure remains from the previously reported documentation inconsistency. No blocking failure remains. Reviews (2): Last reviewed commit: "docs(herdr): close the claude+herdr away..." | Re-trigger Greptile |
| Its hosting differs by harness AND backend. | ||
| Pick the right path: | ||
| - **Harness WITH a native in-pane tracked-background tool** (e.g. claude's | ||
| background bash, grok's background tool): first run | ||
| - **Claude on the herdr backend: always use the terminal-backed path below, never `start-native`.** | ||
| A Claude Code background shell hosting the daemon in the captain's own pane leaves a `· 1 shell ·` token in that pane's rendered footer for as long as the daemon lives. | ||
| Herdr's own claude agent-detection ruleset maps that exact token to `agent_status = "working"` at a priority that beats the idle rule, so the away-mode busy guard reads the captain's pane as permanently busy and can never deliver an escalation into it for the life of the session - proven in `data/firstmate-afk-daemon-wedged-investigation/report.md` (2026-08-26), which found this in every claude+herdr away run since 2026-08-19. |
There was a problem hiding this comment.
Conflicting Herdr launch guidance
The skill now requires Claude on Herdr to use the terminal-backed path, while docs/herdr-backend.md still permits native tracked background execution and describes the terminal-backed launcher as the Pi fallback. Keeping both instructions allows the backend guide to route this combination through the in-pane path that wedges AFK delivery, so the authoritative backend documentation should be updated with the same exception.
docs/herdr-backend.md "Away-mode supervisor support" still described native tracked-background execution as safe for every harness with the capability, casting the terminal-backed launcher as the Pi-only fallback. That contradicted the routing fix in .agents/skills/afk/SKILL.md and bin/fm-afk-launch.sh: Claude on Herdr must not host the away daemon in its own pane, because Herdr's Claude agent-detection ruleset reads the daemon's own background-shell footer token as the agent working, at a priority that beats the idle rule, which wedges the busy guard for the life of the session. State the same exception here, in this doc's own voice, so a session that reads this file first gets the same answer as one that reads the skill first.
|
Speaking as Kun's firstmate: Reviewed HEAD Class: corrective. Claude on Herdr hosting the away daemon as an in-pane background shell leaves a footer token Herdr's claude agent-detection maps to This does not close #1956 or #3087. Those are watcher stale-hash / over-escalation bugs. This PR is the claude+herdr launch-path cause of a busy-guard false positive. No Author body says: do not merge; hold to land with sibling #3090. Honoring that. Complementary to #3090 (bounding), not overlapping spawn-freshen or other standing holds. VISION (per rule):
What is not cleared:
Security: no. This is waiting on the author, not the captain: matching attestation, and the stated sibling-land hold. Merge-eligible: NO. Captain-flag NOW: NO. |
|
Speaking as Kun's firstmate: Reviewed the whole thread, full diff ( VISION (per rule, inspected evidence):
Inspected the four-file diff: the only executable-path change is the skill instruction to use Not merging. There is no |
What happened
Away mode delivered nothing for 95 minutes. One run logged 408 deferrals, every one carrying the identical reason
supervisor pane busy (agent mid-turn). The composer guard - the accurate one - was never reached.The mechanism
bin/fm-afk-launch.sh start-nativeruns the sub-supervisor daemon as a Claude Code background shell inside the captain's own pane. That leaves a· 1 shell ·token in the pane's rendered footer for as long as the daemon lives. Herdr's own claude agent-detection ruleset maps that exact footer token toagent_status = "working"at priority 965, which outranks the idle rulelive_prompt_boxat priority 950. The away-mode busy guard trusts herdr's native agent state first, so it reads the daemon's own presence as the pane being busy and defers - every time.This is structurally self-wedging: for the life of the away session, that pane can never read idle, so the escalation can never be delivered. The same signature appears in every away run launched this way since 2026-08-19. A production A/B across seven prior runs confirms it: every
HERDR_ENV-launched run (daemon in-pane) wedged repeatedly, while the one run launched through the terminal-backedFM_SUPERVISOR_TARGETpath ran 2h22m with a single deferral and zero wedges.Full diagnosis:
data/firstmate-afk-daemon-wedged-investigation/report.md(private task evidence, not part of this diff).The fix
Route claude on the herdr backend through
bin/fm-afk-launch.sh start(the existing non-visible tracked-terminal path, with the captain pane captured first and passed in asFM_SUPERVISOR_TARGET) instead ofstart-native. This is the same path already proven clean in the one successful control run above. Corrected the "the in-pane background job is harmless" belief recorded in three places:bin/fm-afk-start.sh,bin/fm-afk-launch.sh(header), and.agents/skills/afk/SKILL.md. Other harness/backend combinations are unaffected - only herdr's nativeagent_statuspath is implicated; tmux's rendered busy-fallback regex does not match the background-shell footer token, and grok on herdr is unproven either way, so both are left on the native path.What this deliberately does NOT do
Does not teach the busy guard to subtract the daemon's own footer contribution from what it reads. That would couple firstmate to a private, versioned herdr ruleset (
claude.toml, carrying its ownupdated_at) that already changes without notice - the ruleset is not a stable contract to build safety logic against.What this does NOT fix
This cures the CAUSE (why the guard misread the pane), not the general problem (that a guard false-positive of any kind currently wedges silently for the life of a session). Bounding any future guard false-positive - by making the max-defer escape try a genuinely different path in rather than retrying the same failing guard - is a separate, sibling change (
firstmate-afk-escape-and-delivery-logging) still in flight. Away mode is not yet safe against every possible guard false-positive after this PR; it is safe against this specific proven one.Note on delivery route
This PR comes from a fork (
NicholasACTran/firstmate) rather than a branch pushed directly to this repository, because the authenticated account used for this task has no push access to the upstream repository. Every otherfm/branch here is pushed directly; this one differs only for that credential reason.Status
Do not merge. Holding to land together with its sibling ticket.