Repository navigation
fix(bin): stop wedge-escalating a backlog-held worker's idle pane - #18
Merged
Merged
Conversation
The watcher now treats an active tasks-axi hold like a declared pause, so a held pane surfaces at most once and then stays on the long recheck cadence. Claude-Session: https://claude.ai/code/session_013AShGS2fmfRDZ58LH51Qox
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.
Intent
Seen 2026-09-24/25: a worker pane whose backlog task was put on a captain hold (task rwosweb-lint-cleanup, parked waiting on another fix) kept producing stale/possible-wedge wakes, escalation 1, 2, 3 and a demand-deep-inspection, each needing a firstmate turn to re-acknowledge. Design and implement the smallest fix so a task that is held (tasks-axi hold) or has a declared paused: state does not keep escalating as a wedge, while a genuinely stuck unheld worker still does. Follow bin/fm-classify-lib.sh and bin/fm-watch.sh ownership; add tests. Load firstmate-coding-guidelines before editing. Brevity caps: commit subject plus at most 3 body lines; PR description at most 5 lines plus footer. Decisions made: declared paused: and captain-held status lines were already handled; the gap was a backlog-only hold, which the status log never reflects. The new task_is_backlog_held predicate in fm-classify-lib.sh reads tasks-axi show's held verdict (so tasks-axi stays the single owner of hold-until expiry) and fails toward not-held on any read error, preserving wedge escalation. fm-watch.sh folds it into a task_pause_declared helper used everywhere status_is_paused_or_captain_held gated the stale path, so a held live-agent pane surfaces at most once then stays on the long PAUSE_RESURFACE_SECS cadence, and a dead-agent held pane goes straight to that cadence, matching the existing paused/captain-held contract. Deliberately out of scope to keep the fix small: the away-mode daemon (fm-supervise-daemon.sh) stale path, and the busy-turn-over-age escalation for a busy held pane. Tests use real tasks-axi (installed in CI) and skip explicitly if absent. The existing exited-declared-pause test fails only when run inside a Herdr pane environment (HERDR_* env), identically on main; it is not caused by this change.
What Changed
task_is_backlog_heldpredicate tobin/fm-classify-lib.sh. It reads theheld:verdict fromtasks-axi show, sotasks-axistill decides when a hold-until expires. If the read fails for any reason, it returns not-held, so a stuck worker still escalates.bin/fm-watch.sh, a newtask_pause_declaredhelper combines that check with the existing paused/captain-held status check. It now gates every stale path, so a held pane follows the longPAUSE_RESURFACE_SECScadence instead of escalating as a wedge.tasks-axiand skip if it's missing. The new held-stale test fails on the base commit and passes here. Updateddocs/architecture.mdto match.🤖 Generated with Claude Code
Risk Assessment
✅ Low: The change is small and matches the stated design. The new predicate fails toward not-held on any error, so an unheld stuck worker still escalates as a wedge. I confirmed the
held: yesoutput line against real tasks-axi.$taskis bound at the top of the loop in every rewritten branch, and tests cover the held and unheld cases.Testing
I ran the two new backlog-hold tests and five existing pause/stale tests from fm-watch-triage.test.sh using real tasks-axi, and all passed. The held-worker test goes through a real fm-watch.sh run: a held pane surfaces once and is then absorbed, while an unheld pane still escalates as a possible wedge. The same test fails on the base code's watcher, so it shows the regression. A CLI transcript shows the predicate following tasks-axi's held verdict and treating an unknown task id as not held. There is no UI change, so no screenshots. I ran nothing inside a Herdr pane, and I deleted the temporary runner scripts, leaving the worktree clean.
Evidence: Targeted fm-watch triage test run (post-change)
Evidence: New test fails on base fm-watch.sh (regression proof)
not ok - a backlog-held worker still wedge-escalated after its first surface (got escalated)Evidence: task_is_backlog_held with real tasks-axi
before hold: not-held tasks-axi show: held: yes after hold: held unknown id: not-heldPipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
bin/fm-watch.sh:1169- task_pause_declared now starts atasks-axi(node) subprocess on hot per-poll paths whenever the status line is not paused or captain-held. That happens on every poll for each changing, not-busy pane (fm-watch.sh:1169), for each unchanged stale pane with no .paused marker (fm-watch.sh:1133), and for each held pane with a .paused marker (fm-watch.sh:1023). Before this change these were pure string checks. I measuredtasks-axi showat about 60ms per call, so the cost is small at a 15s POLL, but it grows with fleet size. If it ever matters, you could cache the verdict per task per cycle or read it only on the first sight of each hash.✅ **Test** - passed
✅ No issues found.
tests/fm-watch-triage.test.shsubset run with real tasks-axi 0.2.4 (7 tests, all passed): test_task_is_backlog_held_classifier, test_backlog_held_stale_never_wedge_escalates, test_nonterminal_stale_not_working_surfaced, test_nonterminal_stale_paused_absorbed_then_resurfaced, test_exited_declared_pause_is_bounded_but_live_gate_surfaces, test_nonterminal_stale_pause_transitions_reclassify_unchanged_hash, test_secondmate_unpause_clears_pause_trackingRegression check: ran test_backlog_held_stale_never_wedge_escalates against the base commit's bin/fm-watch.sh (a0c8f92). It failed with 'got escalated', which confirms the test catches the bug. Restored the file afterwards.Manual CLI check with real tasks-axi, using the task name rwosweb-lint-cleanup from the incident, in a temporary FM_HOME: task_is_backlog_held returns not-held before the hold, held aftertasks-axi hold --kind captain, and not-held for an unknown id✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.