You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit ac8a767
Browse filesBrowse the repository at this point in the historyBrowse files
fix: resurface queued wakes from handling successors (kunchenguid#7466)
* fix(bin): resurface wakes appended while a handling successor is parked
The supervision host parks on the handling successor it starts for a wake
its engine handled, and a handling successor never resurfaced recovery, so
a row another script appended during the park (a captain inbox note from
the Basecamp integration) sat queued until an unrelated close - four hours
in the observed case.
A handling successor now records the newest queued sequence at its start
and closes once with the recovery wake while a newer row is still queued;
a newer row already consumed only advances that mark, so the predecessor's
delivered episode is still never re-announced.
Follow-ups, not built here:
- A row appended in the short window between a handled close and its
successor's start (about a second) is below the successor's mark; if the
engine handles that close without claiming the row, the row waits for the
next close. Closing that window needs the host to treat rows left queued
after a handled attended turn as main's, which is a separate host change.
- After a machine reboot the primary session does not restart on its own,
so queued wakes wait until it is resumed by hand. Either auto-resume the
primary session after boot, or alert the owner when the primary session
is down while wakes are queued.
* no-mistakes(review): Close handling-successor startup wake race
* no-mistakes(test): Stabilize parked-host inbox wake regression timeout
* no-mistakes(document): Clarify handling-successor wake continuity guarantees
* no-mistakes(ci): Stabilized the flaky remote secondmate lifecycle test by extending the auto-relaunch watcher deadline from ~30 to ~60 seconds. The CI runner exceeded the old deadline by about 3 seconds; the changed production branch was not reachable in this fixture. `bash -n` and `git diff --check` pass. The full test was attempted but exceeded the 600-second local execution limit before reaching this case
* no-mistakes(ci): Fixed flaky concurrent Herdr recovery testing by retrying only documented session-lock contention after both competitors finish. Cleanup now handles fixture-owned read-only hooks. Targeted E2E passed; bash syntax and diff checks passed. Shellcheck reported only existing SC1091 source-following notices
* no-mistakes(test): Preserve successor wake boundaries across handoffs
* no-mistakes(test): Revert successor boundaries and drain teardown fixture wake
* no-mistakes(test): Notify main when downtime handback publication fails
* no-mistakes(test): Revert downtime handback notification changes
* no-mistakes(document): Correct stale supervision wake routing documentation
* fix(bin): stop the supervision host deadlocking and re-announcing handed-back closes
Two defects in this branch's handling-successor changes surfaced as the
"Behavior portable serial 2" shard hanging at its 30-minute limit.
A TERM that lands while the host settles a handled turn's successor handoff
left the host holding the wake-queue and recovery-marker locks; its exit
cleanup then waited forever on the queue lock it still owned. The cleanup now
releases those locks if this process owns them before releasing its grant.
When an accepted close turns main-only at its turn, the host hands it back and
leaves the successor running, but republished the episode as pending
downtime, so that successor re-announced the same close and exited. The
handback now republishes the episode as already announced; a later durable
append still opens a pending episode the successor recovers.
* no-mistakes(test): Park on successor after handling settlement failure
* no-mistakes(test): Use tab-delimited handled-settlement failure logs
---------
Co-authored-by: Caleb LeNoir <calebl@users.noreply.github.com>
Copy file name to clipboardExpand all lines: docs/supervision-host.md
+5-3Lines changed: 5 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -126,13 +126,14 @@ A close the engine takes is handled as in [One wake](#one-wake), with the dialog
126
126
A handled wake with only routine outcomes never reaches main.
127
127
A handled wake that recorded a captain outcome while the captain is still attended exits with one `supervision-host: branch-outcome:` line naming its store rows, without the close it handled; see [Captain outcomes](#captain-outcomes).
128
128
A turn that fails hands its close to main with one `supervision-host:` line, as away.
129
-
Main-only rows that share the queue with the branch's rows stay queued for main, which is woken for each on its own triggering close, as on Pi.
129
+
Main-only rows that share the queue with the branch's rows stay queued for main.
130
+
The [handling-successor recovery contract](watcher-continuity.md#durable-queue-and-turn-end-backstop) guarantees that a main-only row appended after the predecessor closes, including before the successor initializes or while the host is parked, reaches main as a pass-through.
130
131
The engine turn runs beside a captain who is present, so its guarded actions take the task leases that keep it and main off the same task.
131
132
132
133
### Away
133
134
134
135
Every close goes to the engine; captain outcomes remain in the store until the return drain presents them (see [Captain outcomes](#captain-outcomes)).
135
-
Every turn that starts attended meets the attended rule again at its start, and the offer's scan is the scope the turn claims: a close accepted away whose turn starts attended, because the captain returned in between, or an attended close whose task turned main-only (a decision appeared) while the successor started, reaches main unchanged and leaves that successor cycle running, with the handoff that turn had confirmed handed back to downtime.
136
+
Every turn that starts attended meets the attended rule again at its start, and the offer's scan is the scope the turn claims: a close accepted away whose turn starts attended, because the captain returned in between, or an attended close whose task turned main-only (a decision appeared) while the successor started, reaches main unchanged and leaves that successor cycle running, with the handoff that turn had confirmed handed back to downtime as already announced, so that successor does not announce the same close again.
136
137
A captain who leaves while an attended turn runs turns its captain outcomes into away outcomes: they wait for the return too.
137
138
138
139
### Quiet mode
@@ -167,7 +168,8 @@ On each actionable close the engine takes, the host runs these steps:
167
168
3. It runs one bounded engine turn with the branch prompt and the wake message carrying, attended, the dialog mirror and, away, the record's read-back.
168
169
The engine drains, handles, reports through `bin/fm-branch-report.sh`, and acknowledges, exactly as the Pi branch does.
169
170
4. It releases the branch's leases and grant, whether or not the wake was handled.
170
-
5. It parks on the successor only for a handled wake.
171
+
5. For a handled wake, it settles the handling-successor recovery transition and then parks on that successor.
172
+
If settlement fails, it logs `handling-settle-failed` and still parks, leaving a later main-only pass-through to restore the handoff or deliver the restore failure to main.
171
173
A main-only pass-through is not a park: the host exits after leaving that cycle running, as [Attended](#attended) describes.
172
174
173
175
The host counts the wake handled only when all three hold:
Copy file name to clipboardExpand all lines: docs/watcher-continuity.md
+7-2Lines changed: 7 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -193,8 +193,12 @@ The bounded turn-end guard enforces recovery at Stop when no watcher is live and
193
193
So a finished, hung, or identity-mismatched claim cannot suppress that recovery ([`turnend-guard.md`](turnend-guard.md#harness-integrations) owns that boundary).
194
194
195
195
The recovery-episode contract below owns once-per-generation announcement.
196
-
A handling successor does not re-announce.
196
+
A handling successor does not re-announce the predecessor-delivered wake while its handling handoff remains open.
197
197
It enters its poll loop immediately and keeps scanning signals, stale panes, and checks.
198
+
After the supervision host finishes a handled turn, it settles the successor handoff under the durable-queue and recovery-marker locks.
199
+
Any row left for main then becomes a recoverable downtime episode, including one appended after the predecessor closed but before the successor initialized or the host confirmed its handoff.
200
+
The successor closes once with the recovery wake only while that row is still queued; this is how a captain inbox note reaches main during handling-successor startup or while the host is parked on the handled wake's successor.
201
+
When the host instead hands the accepted close back to main and leaves that successor running, it republishes the episode as announced downtime, because the close it hands back is that episode's delivery; the successor therefore does not announce it again, while a later durable append still opens a pending episode it recovers.
198
202
199
203
### Manual recovery and other harnesses
200
204
@@ -230,7 +234,7 @@ Its ordinary arm check still announces a never-announced generation, including o
230
234
### Generation reuse
231
235
232
236
An ordinary watcher close attempts to publish downtime, and every durable queue append publishes it.
233
-
A handling successor closing to resurface recovery preserves the existing marker instead.
237
+
A watcher closing to resurface the recovery it found at its start preserves the existing marker instead, while a handling successor resurfacing a later row publishes downtime like any close.
234
238
If EXIT cleanup cannot acquire the downtime-marker lock within its bound, it retains the stale singleton for the next arm to publish the missing downtime before clearing that lock (see [Grace, beacon, and stop signals](#grace-beacon-and-stop-signals)).
235
239
A downtime republication of a pending episode reuses its generation.
236
240
A watcher close leaves an announced downtime episode announced, while a successful durable append opens a fresh pending generation so a live watcher can recover the new work.
@@ -468,6 +472,7 @@ They also prove that a legacy or handoff-phase watcher marker from an absent rep
468
472
469
473
- The once-per-generation announcement bound with the real Pi extension against a refused handling handshake.
470
474
- A handling successor that must surface a real crew event instead of going blind.
475
+
- A handling successor that resurfaces a row appended between its predecessor's close and its own startup handoff.
471
476
472
477
`tests/fm-watch-triage.test.sh` proves TERM stops a watcher blocked inside a poll's pane capture and still releases its lock and records an acknowledgeable stop.
473
478
It also exercises a single TERM with a live foreign downtime-marker lock holder, retained stale singleton and subsequent arm-style recovery, including decimal `08` and zero `00` cleanup bounds.
0 commit comments