Skip to content

fix(host): contain proxy resets and distinguish reconnect interruptions - #3268

Merged
SawyerHood merged 1 commit into
mainfrom
bb/thr_hpwtyqqy4q
Sep 8, 2026
Merged

SawyerHood merged 1 commit into
mainfrom
bb/thr_hpwtyqqy4q

Conversation

@SawyerHood

Copy link
Copy Markdown
Collaborator

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 ECONNRESET in 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-lost cause 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

  • Reproduced an uncaught read ECONNRESET with 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.

AGENT GENERATED

@SawyerHood
SawyerHood merged commit 426ed78 into main Sep 8, 2026
16 checks passed
@SawyerHood
SawyerHood deleted the bb/thr_hpwtyqqy4q branch September 8, 2026 20:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant