Repository navigation
fix(bin): report a dead-agent record once instead of escalating forever - #4775
Conversation
…ing forever The wedge escalation path never asked whether there was still an agent to be wedged. A wedge is something stuck that might recover, so re-alarming it earns its cost; an agent that is gone never moves again, its pane never churns, the idle timer never resets, and the escalate path clears its own timer and re-arms with nothing bounding the count. Observed on a live fleet: two finished lanes reached 226 and 203 consecutive escalations, roughly one every FM_STALE_ESCALATE_SECS, indefinitely - about 400 notifications a day from two lanes with no agent running at all. On one, fm-control.sh exit answered already-stopped and fm-crew-state.sh read "failed - run failed". Closing the Herdr pane did not stop it either: with the pane genuinely gone and herdr pane read returning pane_not_found, the count kept climbing, because the poll is driven by the record's window= line rather than by the pane. The cost is not the repetition but that it drowns the alarms that matter. fm_backend_agent_state already separates a thinking agent from a gone one at process level. In the branch that was about to escalate, read it once and treat only its two recovery-grade verdicts - dead (endpoint present, no agent in it) and missing (endpoint authoritatively absent) - as proof, reporting that record once and not re-escalating it while it stays that way. Every other verdict, including alive, ambiguous, unreadable, unverified, and a read that failed outright, keeps the identical schedule, reason, and escalation count, so a genuinely wedged live agent is unaffected. The probe costs at most one backend read per window per threshold, the same budget the declared-wait consult and the worktree write probe already take. The report decides nothing about the record's fate: both lanes still held unlanded work and teardown refusing them was correct, so retiring, relaunching, or cleaning up stays with the supervisor. The once-only marker is owned entirely by that function and is dropped by the same read the moment the endpoint stops reading gone, so a replacement launched into the same window escalates normally and its own later death is reported again. Related, and not closed by this: kunchenguid#4412, kunchenguid#4482, kunchenguid#4316. Tests drive the real watcher against a record whose endpoint does not exist and pin both directions: dead and missing report once and never advance the count across later thresholds, while alive, ambiguous, and unreadable endpoints keep escalating with the identical reason and a climbing count.
Review of the parent commit found a reachable sequence where a later death in the same window lost its promised report. The marker was keyed on the verdict string alone and dropped only when a threshold probe read a non-gone verdict, but probes run only at thresholds: a replacement launched into the same window that dies without ever being probed alive - it crashes at startup, or works and then crashes - was absorbed by the previous death's marker. The pane's first sight yielded only the generic stale wake and every later threshold matched the stale marker, so the second death never got the detailed once-report that both the function's own comment and docs/architecture.md promise. Record the verdict together with the pane hash it was reported for, and absorb a repeat only while both still match. A replacement churns the pane, which resets the stale suppressor, wedge timer, and escalation count while no reset site touches this marker, so the pane half is what tells the second death apart from the first. The live-probe drop stays as it was. Clearing the marker at those reset sites instead would re-open unbounded re-alarming for a dead pane whose display ever ticks, which is the exact defect the parent commit exists to close. The noise bound is unchanged: an unchanged dead pane still absorbs on every later threshold and never advances the escalation count, and every verdict short of proof still escalates exactly as before.
a2b6ca2 to
ae7f3a0
Compare
|
Speaking as Kun's firstmate: First look on HEAD Author body vs #4722: body explicitly Attestation: MATCH — body Contract-class: restore — unconfigured watcher already promised wedge escalation for stuck live agents; dead/missing endpoints were wrongly on that ladder with no ceiling. Probe uses existing VISION.md (per rule):
CI: tip run |
|
Speaking as Kun's firstmate: this is merged. Thank you @umeranjum17 — really appreciate you taking the time on this. |
A record whose agent is gone now reports itself once instead of escalating forever.
Fixes #4722
The problem
The wedge escalation path never asked whether there was still an agent to be wedged. A wedge means something is stuck and might recover, so re-alarming it earns its cost. An agent that is gone never moves again: its pane never churns, the idle timer never resets, and the escalate path clears its own timer and re-arms with nothing bounding the count.
Observed on a live fleet, with numbers:
FM_STALE_ESCALATE_SECS, indefinitely. Together that is about 400 notifications a day from two lanes with no agent running at all.bin/fm-control.sh <id> exiton one of them answeredalready-stopped. The agent had been gone for hours.bin/fm-crew-state.shreadfailed - run failed. Every alarm after its death was noise.herdr pane readreturningpane_not_found, the escalation counter kept climbing, because the poll is driven by the durable record'swindow=line rather than by the pane.state/<id>.meta.The cost is not the repetition itself. It is that ~400 alarms a day from finished lanes drown the alarms that matter, until the supervisor stops reading any of them.
fm_backend_agent_statealready separated an agent that is thinking from one that is gone. The escalation path simply never consulted it.What changed
In the branch that was about to escalate,
bin/fm-watch.shnow readsfm_backend_agent_stateonce. Only its two recovery-grade verdicts count as proof:dead(the endpoint is present with no agent running in it) andmissing(the endpoint is authoritatively absent). Such a record is reported once, naming which verdict fired, and is not re-escalated while it stays that way.The once-marker records the verdict together with the task's per-incarnation busy gen (
state/<id>.busy-gen, owned bybin/fm-busy-event.sh), which is re-minted exactly when an agent is armed or relaunched. A successor launched into the same window therefore gets the full alarm back, and its own later death is reported in full. Where no incarnation token is readable the pane hash stands in, because an unreadable token must never mean "report on every threshold" - that would hand back the storm this change exists to close.The probe runs only inside the at-threshold branch, so it costs at most one backend read per window per
FM_STALE_ESCALATE_SECS, the same budget the declared-wait consult and the worktree write probe already take.What this deliberately does not change
demand-deep-inspectionwording. That path is load-bearing and is untouched.alive,ambiguous,unreadable,unverified, and a read that failed outright - keeps that same unchanged behaviour. This narrows which panes escalate, never how loudly the ones that still do.Why this is trustworthy
The fault was reproduced before any code was written - a record pointing at an endpoint that does not exist, driven through the real watcher, with the counter climbing every threshold. That reproduction is the regression test, and it fails without the fix (
possible wedge, escalation 1) and passes with it.tests/fm-watch-triage.test.shpins both directions, because a bound proved only in the quiet direction is indistinguishable from deleting wedge detection:deadandmissingendpoints report once and never advance the escalation count across later thresholds.alive,ambiguous, andunreadableendpoints keep escalating with the identical reason and a climbing count.Check status
Thirteen of the fourteen checks pass on this exact head.
The fourteenth, Behavior portable serial 1, reported no verdict either way: it was cancelled, not failed. Run 35284949308 is on this head (
ae7f3a0), and its concurrency rule cancelled the in-flight run when a newer push superseded it; job id105415114606has conclusioncancelled. The immediately preceding run on this branch, 35273818897, completedsuccesswith that same job green.Rerunning it needs admin rights on this repository, which the contributor does not have - single-job rerun, run-level rerun, and workflow dispatch were all refused, and
ci.ymldeclares noworkflow_dispatchtrigger. A maintainer can clear it in one click by rerunning that job. No no-op commit was pushed to manufacture a fresh run, since that would trade a clearly explained gap for a quietly misleading green.Known limitation
fm_backend_agent_statereads live rovo-on-herdr panes asdead, whichdocs/verification/rovo.mdalready records as a Herdr-side integration gap (Herdr ships no rovo agent detection). This change is a new consumer of that verdict, so a stalled-but-live rovo worker onbackend=herdrwould get the single dead-record report and then stay quiet rather than escalating as a wedge. That is pre-existing and documented rather than introduced here, and it is left for a deliberate owner-side follow-up instead of being worked around in this change.Related
Related, and not closed by this change:
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
tests/fm-watch-triage.test.sh:2933- test_identical_dead_display_of_a_successor_still_reports asserts the outcome (successor death reported, later thresholds silent) but never asserts its stated premise that the dead display is byte-identical across rounds; today that holds only structurally (the capture file is never rewritten), so a future edit rewriting✅ **Test** - passed
✅ No issues found.
bin/fm-watch.shend-to-end against a real tmux backend (isolated socket) with the real crew-state binary and realfmstate; the dead-record escalation fix behaves correctly in the li…bin/fm-watch.shagainst an isolated-socket tmux backend with the real crew-state binary and realfmstate, as recorded in this run's testing outputbin/fm-watch.sh end-to-end against a real tmux backend on an isolated socket with the real crew-state binary (dead-record escalation path)docs/architecture.md:36- The new dead-record absorb is one more consumer of fm_backend_agent_state'sdeadverdict, which docs/verification/rovo.md (lines 206-210) records as reading live rovo-on-herdr panes asdead; a stalled-but-live rovo worker on backend=herdr would therefore get the single dead-record report and then be silenced instead of escalating as a wedge. rovo.md's existing warning already covers 'any recovery path that trusts this classifier', so no edit was made here; if rovo-on-herdr is a supported placement, its one-shot silence is a behavioral consequence worth a deliberate owner-side follow-up in docs/verification/rovo.md or the architecture dead-record contract.✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.