fix(client-runtime): capture ping timeout and close codes on disconnect - #168
Merged
Merged
Conversation
onDisconnect ran before browser close events and ignored the patched onPingTimeout hook, so diagnostics collapsed to a bare "disconnected." Record SocketError causes and ping timeouts before formatting detail.
patroza
added a commit
that referenced
this pull request
Jul 29, 2026
…ct (#168) onDisconnect ran before browser close events and ignored the patched onPingTimeout hook, so diagnostics collapsed to a bare "disconnected." Record SocketError causes and ping timeouts before formatting detail. Co-authored-by: T3 Code PR Stack <41898282+github-actions[bot]@users.noreply.github.com>
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.
Summary
Follow-up to #163. Diagnostics still reported bare
t3vm disconnected.because:onDisconnectraces the browser close event — Effect fails the protocol (and runs the hook) before the asynccloseevent populates our capture, and for ping timeout the socket is still open (cleanup closes with 1000 later).onPingTimeouthook (already inpatches/effect@4.0.0-beta.102).Fix
onPingTimeout+ wrappingSocket.runRaw(SocketCloseErrorcodes / open errors) before formatting.causeMessage→ e.g.t3vm ping timeout./t3vm closed (1006 abnormal).reason: "timeout"when appropriate.Root cause of the reconnect storms (Jaeger, not fixed here)
Guest
t3-server-vmsessions thrash on VCS status (runGitCommand× hundreds, multi-minutesubscribeVcsStatus). Host under memory pressure (swap full) + 5s Effect RPC ping → late pongs → disconnect → reconnect. This PR makes that visible; ops/VCS load is separate.Test plan
session.test.tsping timeout + 1006 + open timeout pathsvp checkping timeout/ close code, not baredisconnected.