Repository navigation
fix(host): contain proxy resets and distinguish reconnect interruptions - #3268
Merged
Merged
Conversation
3 of 12 tasks
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.
Human comments
What was wrong
The machine authentication proxy piped upgraded WebSocket sockets without handling their errors or closing the peer. An upstream reset could therefore raise an uncaught
ECONNRESETin the host daemon. Separately, reconnect reconciliation labeled a missing active turn as a daemon restart even when the reconnecting process had the same instance ID.What changed
Handle errors and close both sides of upgraded proxy connections, including clients that disconnect during the upgrade. When the same daemon reconnects without a previously active turn, emit the existing
host-connection-lostcause so the timeline reports a lost connection; preserve the restart message for a different daemon instance. No server/daemon wire fields or public API changed, so no protocol bump is needed. These fixes do not address the underlying Connect tunnel instability.How you verified
read ECONNRESETwith a real upstream TCP reset before the proxy fix; the regression passes afterward. Coverage also exercises client-side resets and peer cleanup.pnpm exec turbo run test --filter=@bb/host-daemon -- --run src/machine-auth-proxy.test.ts— 10 passed.pnpm exec turbo run test --filter=@bb/server -- --run test/internal/background-task-reconciliation.test.ts— 12 passed, covering missing/still-active turns on same-instance reconnect, actual daemon replacement, and disconnect grace behavior.pnpm exec turbo run typecheck --filter=@bb/host-daemon --filter=@bb/server— passed.git diff --check— passed. EAP codename scan: clean working tree, HEAD, added lines, and commit messages in the push range.