Repository navigation
desk-hub stand-in: a client's reset mid-upgrade no longer ends the local hub (provision.test flake) - #291
Merged
Conversation
…cal hub Node's HTTP server takes its own error listener off a socket before it emits 'upgrade'; the stand-in's proxy added one only once the hub had upgraded. A client that reset its connection before then (and on a refusal, at any point) threw an unhandled 'error' event and ended local/run.ts, so every later request met ECONNREFUSED. In test/endpoint/provision.test.ts the retire case that reconciles a lost DELETE does exactly this: the restarted endpoint's hub link is refused 401 under the dead service token, and the retire's unenroll stops the link while that refusal can still sit unread, which resets the socket. That is the death seen on the pool (runs 40669200856, 40690529203) and reproduced locally with the hub's own output: "Unhandled 'error' event, read ECONNRESET". The upgrade handler now owns the socket's errors from the start, and the socket's close ends the hub's side whether or not the hub has upgraded, so a client gone mid-handshake leaves no upgrade open behind it. apps/desk-hub/test/proxy.test.ts holds the proxy to it (11 uncaught errors against the old handler). The endpoint suites' local hub now reports an unasked exit with its output, so a death mid-suite says why. Sminos-Session: p5-desk-track-owner#b4948247 (doperpowers on macbook)
Codex Review SummaryThis 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. |
Sminos-Session: p5-desk-track-owner#b4948247 (doperpowers on macbook)
SSFSKIM
added a commit
that referenced
this pull request
Oct 28, 2026
…291); its tracker row closes Sminos-Session: GUI AI agent workspace charter#37052769 (MAWS on macbook)
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 the
test/endpoint/provision.test.tsflake on the Linux pool (the 2026-10-28 P5 O14 row ofdocs/tech-debt-tracker.md; runs 40669200856 and 40690529203, unit 4 of 4, on branches that do not touch it).Cause
The local hub did not die on its own:
apps/desk-hub/local/run.tsthrew. Node's HTTP server takes its ownerrorlistener off a socket before it emitsupgrade, and the stand-in's proxy (apps/desk-hub/local/proxy.ts) added one only once the hub had upgraded. A client that reset its connection before then, or at any point on a refusal, raised an unhandled'error'event (read ECONNRESET, orwrite EPIPE) and ended the whole process. Every later request then metECONNREFUSED.The suite does this in one place. In
retire › reconciles a DELETE the hub completed whose answer was lost, the restarted endpoint still holds a service token that the hub has already deleted. Its hub link's upgrade is refused 401, and the retire's unenroll callsHubLink.stop()while that refusal can still sit unread, which resets the socket. The suite always dies at the same point: that case passes, and the next one (is refused on an attended enrollment) fails on its first request withECONNRESET, followed by sixECONNREFUSEDfailures. That is the signature of both pool runs.Evidence:
/machine/socketupgrade was the last one in flight, and the runner died withUnhandled 'error' event … Error: read ECONNRESET at TCP.onStreamRead.wsclient, the endpoint's socket library, closed while its upgrade is being refused kills the runner. So does a raw client's reset. The same check, run outside vitest in anode:22-slimcontainer on Linux and on macOS, gave the same result on both:Fix
apps/desk-hub/local/proxy.ts: the upgrade handler owns the socket's errors from the start. The socket's close now ends the hub's side whether or not the hub has upgraded, so a client gone mid-handshake leaves no upgrade open behind it. If the client is already gone after admission, the upgrade is not forwarded at all. Deployed Access drops the connection here and nothing more; the stand-in now does the same.apps/desk-hub/test/proxy.test.ts(new): tests the proxy in front of a hub double. A client that resets once refused, one that resets before it is answered, and one that resets before or after the hub upgraded. Against the old handler it reports 11 uncaught errors and a hub side left open.test/endpoint/local-hub.ts: an unasked exit of the local hub now prints its tail of output, so a death mid-suite says why. Both pool failures had onlyECONNREFUSEDto show.The fix is not a retry, and the test's cases and assertions are unchanged. The endpoint's behaviour, aborting an in-flight handshake on stop, is legitimate client behaviour and stays as it is.
Verification
ci-gate --gates static,unit,probes --runner macos --class1a pool, run 40694837226, green (static, unit 1–4/4, probes).provision.test.tsandproxy.test.tsboth ran in unit 4/4 on the pool. No hosted e2e groups: the change touches none ofsrc/endpoint,apps/desk-hub/srcor desk-web.provision.test.tspassed in all 20, and the local hub never died. Each run took the gate's unit 4/4 file set, all 499 files together, at--maxWorkers=8as the pool runs them. The same harness on the unfixed tree had already failed once in 20 loaded runs, as described above. Separately,src/main/files/service.test.ts > cuts a listing at the cap with truncatedhit its 5 s timeout in 8 of the 20 local runs. That is this Mac's load and unrelated to this change: the file is untouched here and passed in the gate's unit 4/4.doperpowers:reviewer-medium, no material findings.The tracker row's exit ("the cause is found and fixed") is met; the row can go when this lands.
Sminos-Session: p5-desk-track-owner#b4948247 (doperpowers on macbook)