Skip to content

fix(bin): stop wedge-escalating a backlog-held worker's idle pane - #18

Merged
Hozzy02 merged 1 commit into
mainfrom
fm/fm-watch-held-stale
Sep 25, 2026
Merged

Hozzy02 merged 1 commit into
mainfrom
fm/fm-watch-held-stale

Conversation

@Hozzy02

@Hozzy02 Hozzy02 commented Sep 25, 2026

Copy link
Copy Markdown
Owner

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

  • Added a task_is_backlog_held predicate to bin/fm-classify-lib.sh. It reads the held: verdict from tasks-axi show, so tasks-axi still decides when a hold-until expires. If the read fails for any reason, it returns not-held, so a stuck worker still escalates.
  • In bin/fm-watch.sh, a new task_pause_declared helper combines that check with the existing paused/captain-held status check. It now gates every stale path, so a held pane follows the long PAUSE_RESURFACE_SECS cadence instead of escalating as a wedge.
  • Added triage tests that run against the real tasks-axi and skip if it's missing. The new held-stale test fails on the base commit and passes here. Updated docs/architecture.md to 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: yes output line against real tasks-axi. $task is 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)
ok - task_is_backlog_held follows tasks-axi's active-hold verdict and fails toward not held
ok - a backlog-held idle worker surfaces once and is not wedge-escalated, while an unheld one still is
ok - a not-provably-working non-terminal stale is surfaced immediately (never left to wait out the timer)
ok - a declared pause is absorbed on first sight, then re-surfaced as a recheck past the threshold, never wedge-escalated
ok - exited declared-pause and captain-held panes use bounded pause cadence while a live decision gate still surfaces once
ok - unchanged stale hashes reclassify when a crew enters or leaves pause
ok - a resumed secondmate clears pause and stale tracking before stale exemption
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)

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-held

$ task_is_backlog_held (before hold)
not-held
$ tasks-axi show rwosweb-lint-cleanup | grep held
  held: yes
$ task_is_backlog_held (after hold)
held
$ task_is_backlog_held (unknown id)
not-held

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

⚠️ **Review** - 1 info
  • ℹ️ bin/fm-watch.sh:1169 - task_pause_declared now starts a tasks-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 measured tasks-axi show at 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.sh subset 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_tracking
  • Regression 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 after tasks-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.

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
@Hozzy02
Hozzy02 merged commit 9c52d35 into main Sep 25, 2026
13 checks passed
@Hozzy02
Hozzy02 deleted the fm/fm-watch-held-stale branch September 26, 2026 00:41
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.

1 participant