Repository navigation
#473: a handover's exit is no crash: the host flushes its last status, main takes mawsd's verdict (wire minor 48) - #683
Merged
Conversation
… sockets The engine host's exit order closed its client and exited at once, so whatever the kernel had not yet taken from a slow reader's socket died with the process: on macOS an AF_UNIX stream holds 8 KiB, and the handover's last status (holder.detached, the evidence it handed over) is written just before the exit. mawsd then read the planned exit as a crash (run 43425585102: 'asked to hand over, is gone', then 'exited unexpectedly'). closeClient now settles once each closed client's socket has finished or ended, and the exit order waits for it within CLOSE_GRACE_MS. socket-host.test.ts fails before the change (the exit came while the client had taken nothing) and passes after. Sminos-Session: GUI AI agent workspace charter#37052769 (MAWS on macbook)
… wire minor 47 On the daemon shape mawsd's drain drops main's relayed link before the old host can say it handed over, and main's own look at the gone pid (200 ms after its close) comes ahead of mawsd's verdict. So main read a quick handover as a crash whenever the holder.detached word did not cross the departing relay in time (maws-24's diagnosis of 11-05, never landed). - The host supervisor tells a drain's end with its verdict (onHandover's ended: the old incarnation, handed over or crashed mid-drain, lost's replace verdict on the evidence). - mawsd posts it as daemon.engineHandover's ended on the none that ends the drain, and retells the state under way to a machine.sock client as it says ready. - Main, for a relayed engine host gone with no mark while a drain was reported, waits for that end report (HANDOVER_VERDICT_WAIT_MS, 5 s): handed over starts the successor with no count; crashed mid-drain, an end report naming another process, or none in time is a crash, as before. - WIRE_MINOR 47 (one optional field), the manifest regenerated; the fingerprint does not cover machine events and is unchanged. Red first: host-supervisor.test.ts's relayed scene fails on master (main never waits; the exit is counted), and passes here. Sminos-Session: GUI AI agent workspace charter#37052769 (MAWS on macbook)
…t host test's lock names Class 1a on 772c633 (run 43682204667) found two type errors: the replace branch tested a copy, so loss.crash no longer narrowed below it, and the test's files named breakLock where LockNames has breaker. Sminos-Session: GUI AI agent workspace charter#37052769 (MAWS on macbook)
Class 1a on f94929c (run 43683670700): the fake typed as EngineHandoverWatch lacked the new member. Sminos-Session: GUI AI agent workspace charter#37052769 (MAWS on macbook)
Sminos-Session: GUI AI agent workspace charter#37052769 (MAWS on macbook)
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
…erdict; #473's wire change renumbered to minor 48 U11g took WIRE_MINOR 47 (connectors.addJson). Only wire.ts conflicted: U11g's (47) entry is kept, and #473's daemon.engineHandover ended is appended as (48). The manifest was reset to master's minor 47 and regenerated with pnpm wire:manifest's two files, so it records the one additive entry at 48. The fingerprint is unchanged (machine events are outside it). Sminos-Session: GUI AI agent workspace charter#37052769 (MAWS on macbook)
This was referenced Nov 15, 2026
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.
Fixes board #473: an engine host's planned handover exit was counted as a crash. It flaked
e2e/supervisor.spec.ts(f), "no unexpected exit": red 3 times in 7 days, the latest in run 43425585102 at:802/:794.Diagnosis
The full timeline is in the diagnosis comment on #473. Of maws-24's 11-05 plan, nothing had landed:
fix/473-handover-inflightholds no commit past master's 11-05 head. The 11-13 reading shows two paths.asked to hand over, is gone, thenexited unexpectedly (code null), and so did the mini's 11-10 swap. The host publishesholder.detached(the evidence that it handed over) just before its exit order. Its exit order then ransocket.end()andproc.exit()at once. On macOS an AF_UNIX stream holds 8 KiB, so with mawsd behind on reading, the status was still queued in user space and was lost. A standalone experiment showed it: 22.8 KB written to a paused peer, thenend()andexit(0); the peer received 7.6 KB, and the last line was not among it.holder.detachedonly if the word crosses the departing relay in time.The test reads the right signal:
lastExitis main's verdict, which the app shows. So this is a product fix.Fix
closeClientnow settles once each closed client's socket has finished or ended, and the socket host's exit order waits for that, bounded byCLOSE_GRACE_MS(1 s), beforeproc.exit. Files:socket-host.ts,socket-server.ts,socket-port.ts.onHandover'sended: the old incarnation, plus handed over or crashed mid-drain, fromlost's evidence-based replace verdict). mawsd posts it asdaemon.engineHandover's optionalendedon thenonethat ends the drain. It also retells the state under way to a machine.sock client as that client says ready (maws-24's late-attach case).HANDOVER_VERDICT_WAIT_MS(5 s). Handed over starts the successor with no count. Any of these is a crash, as before: crashed mid-drain, an end report naming another process, or no report in time (an older mawsd).connectors.addJson) adds one optional field. The manifest is regenerated. The fingerprint doesn't cover machine events and is unchanged. Older peers read the field tolerantly (dropped), and both cross-build peers are green.Red before green
src/shared/host/socket-host.test.ts(new): a real Unix socket with a client that has stopped reading. The exit must wait until what was written has left. It failed before the change (exit called at once) and passes after.src/shared/host/host-supervisor.test.ts, "a relayed engine host gone while its relay drained it": it fails on master (main never waits, and the exit is counted) and passes here. Its cases: handed over gives no count; crashed or silent is counted; no drain is judged at once.src/shared/host/detached-transport.test.ts: the drain's end is told with its verdict, both handed over and crashed mid-drain.src/mawsd/engine-handover-event.test.tscoversendedandretell.src/main/hosts/engine-handover.test.tscoversverdict.Runs
Runs of record, on the merged head 5c67bc9 (master 93905c9 plus this branch, wire minor 48):
e2e:supervisor-daemone2e:cross-build,--peer-exact f1852de3ae2e:cross-build,--peer-exact 2c7044231Earlier runs, before the merge:
e2e:supervisor-daemon, unit and probes green; static red on 2 type errors (fixed). Cross-build runs 43682228421 (f1852de) and 43682226946 (2c70442), both green.e2e:supervisor-daemon, unit and probes green; static red on 1 type error in a test fake (fixed).Composer.test.tsx's menu chords, which this branch doesn't touch (logged in the tracker). Unit rerun 43686314363: green.Review
doperpowers:reviewer-high, lens "handover and exit-verdict races between mawsd, the supervisor and main", on1ce09aa61..772c633cc: no material findings, verdict correct. The commits since then are type fixes only.Not verified
e2e:supervisor-daemonrun per head can't prove a 3-in-7-days flake is gone. Tracker row (29) stays until it has been quiet for a while.Also logged in the tracker:
detached-transport.test.ts:660flakes locally on master at a load near 55 (2 red in 5 runs), unchanged by this branch.Sminos-Session: GUI AI agent workspace charter#37052769 (MAWS on macbook)