Repository navigation
fix(bin): bound stale alarms for backlog captain holds - #3842
kunchenguid merged 10 commits into
Conversation
Confidence Score: 5/5The PR appears safe to merge. The previously reported re-held-call suppression failure is fixed because the throttle scope now includes a lifecycle identity that changes when an answer is recorded and the task is held again; no blocking failure remains. Reviews (6): Last reviewed commit: "fix(ci): isolate the Herdr restart fixtu..." | Re-trigger Greptile |
|
Speaking as Kun's firstmate: First look on HEAD Contract-class: restore. Same principle as #3443 for the hold record; no new unconfigured always-on behavior. Unheld paths keep alarming. Attestation MATCH tip. Greptile SUCCESS 5/5. Tip NM SUCCESS (34038223601). CI run 34038084492 still in_progress (serial portable jobs pending; parallel/Herdr/Lint green so far). MERGEABLE/UNSTABLE — not merging until CI fully green. No competing PR on this surface. Security: clean tip expected (bin/docs/tests only; no workflow writes) — FYI only, not a captain card. VISION (per rule):
Stamp waiting-ci restore. Revisit when CI 34038084492 completes green. |
c858110 to
d09f953
Compare
|
Speaking as Kun's firstmate: Newer activity on HEAD Contract-class: restore. Same promised wait semantics for an open captain hold; unheld paths keep alarming. Attestation MATCH. Greptile 5/5. Tip NM SUCCESS. CI run 34074352902: Behavior tests (Herdr) FAILURE — VISION: One captain — aligns (bounds noise during an open decision). Authority — aligns. Scripts — aligns. Restart — aligns (lifecycle identity). Delegation — aligns. Fleet — aligns. Scope — aligns. Security: bin/docs/tests only — FYI only. Stamp waiting-author restore. Please clear the Herdr presentation e2e failure on this tip (or show it flake-only with a green re-run). Not waiting on the captain. |
f1c9ea5 to
21920de
Compare
…tus line A legitimate wait has two records and the stale alarm reads only one. `status_is_paused_or_captain_held` takes a status line, so it sees a wait the worker declared. It cannot see the wait firstmate records when it hands work to the captain: `bin/fm-captain-hold.sh hold` writes that into the backlog and leaves the status log alone, so a delivered task keeps `done: PR ...` as its last line for the whole time the captain is deciding. Both stale branches were blind to it, and each churned a new pane hash back into its own alarm: a `done:` line is captain-relevant and reaches the terminal-stale branch, while a held task whose last line is `working:` reaches `surface_nonterminal_stale` and fails its declared-wait test. Consult that second record where the watcher is about to alarm, through `bin/fm-captain-hold.sh open`, which already owns the predicate's semantics, and bound the alarm on the shared `.paused-resurfaced-<key>` marker and `PAUSE_RESURFACE_SECS` window the declared-wait absorb already uses. The first sight still alarms, the window's end alarms once more, and a held crew that goes genuinely silent still escalates through the wedge timer. Only an established open captain call bounds anything: an unreadable backlog, an absent or incompatible tasks-axi, a row this home does not carry, and every task with no hold keep alarming exactly as before. The backlog hold is deliberately not recorded as a declared pause, because the loop-top reconciliation and `pause_state_class` both read the status line and would clear a flag that line does not support. Extends the fix in kunchenguid#3443, which closed the forms of this loop that the status line itself can express.
Three gaps in the bound added by the previous commit, all in how the throttle is scoped and where the backlog is consulted. The scope carried only the status-log signature. A task can be held, answered with `--release`, and re-held as a genuinely different captain call without any status append, so the second call inherited the first one's marker and its first sight was absorbed - the one thing this bound must never do. The task id is not the call: `bin/fm-captain-hold.sh open` gains `--identity`, which reports the call's own lifecycle - its hold-set stamp and the number of recorded answers - on an exit 0 and only then, leaving the silent predicate every existing caller reads unchanged. The throttle scope now carries that identity. The terminal path recorded the throttle before publishing the durable wake. A failed append exits the watcher with nothing queued, and the next sighting then read that fresh marker and absorbed the retry, turning a delayed alarm into a lost one. Recording moves behind the append, as the non-terminal path already had it, and the comment claiming the marker could not outlive its wake is gone because it was false. The backlog was consulted only on a new terminal pane hash. A captain call can open after a hash was absorbed as provably working, changing neither the pane nor the status log, so nothing re-read the backlog and the wedge timer kept firing possible-wedge alarms through a legitimate wait. That timer now consults the call at its own alarm boundary and takes the same bounded cadence - and only at that boundary, so an ordinary repeat poll under the bound stays the local-only read it was. Regression coverage for each, all driving churn through one watcher process rather than relaunching per pane change: relaunch cost dominated the earlier shape, and an absorbing watcher stays in its poll loop across churn in production anyway. An unheld task still alarms on every new hash, and an elapsed wedge timer with no open captain call still escalates as a possible wedge.
Lifts the lifecycle-identity and cadence-ownership work back out, leaving the change at the shape that matches the defect actually observed: the stale alarm did not consult the backlog captain hold, on either stale branch. Reviewing the wider version surfaced a series of adjacent gaps in the watcher's alarm state machine - a call opening after the first alarm, marker invalidation at the hold lifecycle boundary, and which deadline a terminal timer represents. They are real, but fixing them turns a small extension into a state-machine change to the alarm path, which is a different review on a subsystem that is being actively reworked. They are named as known limitations rather than carried here, and none of them is load-bearing for what remains: the bound does strictly less than the reverted version, leaves the wedge path escalating on STALE_ESCALATE_SECS exactly as before, and introduces no silence that the existing terminal-alarm path did not already have. Kept from the reverted work is the record-after-append ordering, because that is a defect in the code being shipped rather than an adjacent one: recording the cadence marker before publishing the durable wake let a failed append lose an alarm outright instead of delaying it. History is preserved: the earlier commits stay on the branch and this removal sits on top of them.
… log The throttle this change introduces was scoped to the task's status-log signature. Answering a call with `--release` and holding the task again creates a genuinely different captain call without necessarily appending to that log, so the second call inherited the first one's marker and its first sight was absorbed. That is the one alarm this bound must never swallow. A delivery announced twice is noise; a decision waiting on the captain that is never surfaced is invisible, because nobody asks for what they do not know to ask for. Measured rather than assumed, on the same fixture - a delivered task held for the captain, released, and re-held with no status append, driven through bin/fm-watch.sh: base c499f84 call-1 first=ALARM call-1 churn=ALARM new call first sight=ALARM before this fix call-1 first=ALARM call-1 churn=absorbed new call first sight=absorbed after call-1 first=ALARM call-1 churn=absorbed new call first sight=ALARM Base never suppresses the new call, so the suppression came from this change and closing it completes the fix rather than widening it. `bin/fm-captain-hold.sh open` gains `--identity`, printing the call's lifecycle - its hold-set stamp and count of recorded answers - on an exit 0 and only then, so the silent predicate bin/fm-teardown.sh reads is untouched. The throttle scope carries that identity beside the status signature. The sibling case was measured too and is NOT included: on the status-declared path, where the last line is `captain-held:`, base already absorbs a re-held call's first sight. That behaviour predates this change and stays documented as a known limitation rather than repaired here.
The Herdr behaviour test intermittently reused a local worktree still claimed by an earlier fixture after a restart. The restart scenarios now use an isolated Treehouse project. The full Herdr test passes on Herdr 0.8.2; bash -n and git diff --check pass as well.
21920de to
3a6b578
Compare
|
Speaking as Kun's firstmate: this is merged. Thank you @mremond — really appreciate you taking the time on this. |
Intent
Propose an upstream PR that completes the fix the maintainer has already accepted on spurious watcher alarms, and present it so the maintainer can approve it easily without reconstructing the context.
The already-accepted fix this refers to is upstream issue #3443, opened 2026-09-01 and now closed. It established that a stale alarm on a quiet pane must consult the declared wait BEFORE queueing the wake. surface_nonterminal_stale in bin/fm-watch.sh now calls status_is_paused_or_captain_held and checks the .paused-resurfaced- cadence marker against PAUSE_RESURFACE_SECS before fm_wake_append, so a worker stopped on a declared wait alarms once and then has its pane churn absorbed for the window.
This PR completes that fix on the one wait source it does not read. A task that has been delivered and held for the captain records that wait in the backlog through bin/fm-captain-hold.sh, not in the status log, so its last status line stays "done: PR ..." for the whole time the decision is pending, and the alarm is queued against it anyway. Apply the same principle, in the same function, with the same cadence marker, to that remaining wait source.
What Changed
Risk Assessment
✅ Low: The change is bounded to stale-alarm handling, preserves first-sighting alarms, and continues alarming when the backlog hold cannot be proven open.
Testing
The initial ephemeral runner attempt stopped before scenarios because of a helper-path setup error; after correcting it, all focused target tests and manual controls passed, while the supplied base reproduced the defect. Reviewer-visible CLI transcripts were captured; no screenshot was applicable because this is a shell watcher/notification-queue change with no rendered UI. The broad repository suite was intentionally not run.
Evidence: Before-fix reproduction
Source: Before-fix reproduction
Base commit reproduced the duplicate-notification defect during held-delivery pane churn.Evidence: Target watcher behavior
Source: Target watcher behavior
Target transcripts show held work suppressing intermediate pane churn, cadence resurfacing, unheld controls continuing to notify, durable-queue retry, re-held lifecycle behavior, and secondmate scope.Evidence: Safety controls
Source: Safety controls
Unreadable backlog produced two notifications; three stable polls made zero tasks-axi calls; the due changed-pane check consulted tasks-axi and suppressed the duplicate notification.Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
✅ **Review** - passed
✅ No issues found.
✅ **Test** - passed
✅ No issues found.
Targetedtest_live_declared_wait_churn_honors_the_resurface_throttle,test_open_captain_call_bounds_stale_churn,test_stale_churn_without_a_captain_call_still_alarms,test_failed_wake_append_does_not_arm_the_captain_hold_throttle,test_reheld_captain_call_starts_its_own_resurface_window, andtest_secondmate_nonpaused_stale_remains_suppressedfromtests/fm-watch-triage.test.shRantest_open_captain_call_bounds_stale_churnagainst a temporarygit archive 6d396da7c43f03315873332b2591119a8c780a97; it reproduced the pre-fix repeated-notification failureManually drovefm-watch.sh,fm-captain-hold.sh, tasks-axi, and the durable notification queue with an unreadable-backlog controlManually counted tasks-axi calls across three stable polls and a due changed-pane classification to verify backlog consultation remains off the ordinary polling pathRecheckedgit status --shortand target commit/tree after testing✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.