Skip to content

Debounce reconnect disconnect logging#1862

Merged
juliusmarminge merged 1 commit intomainfrom
t3code/fix-reconnect-errors
Apr 9, 2026
Merged

Debounce reconnect disconnect logging#1862
juliusmarminge merged 1 commit intomainfrom
t3code/fix-reconnect-errors

Conversation

@juliusmarminge
Copy link
Copy Markdown
Member

@juliusmarminge juliusmarminge commented Apr 9, 2026

Summary

  • Prevent repeated disconnect warnings when multiple WebSocket subscriptions fail during the same reconnect window.
  • Reset transport disconnect reporting after a subscription successfully receives a value, so future disconnects can be logged again.
  • Avoid unhandled promise noise during replay recovery triggered by resubscribe and sequence-gap paths.
  • Add coverage for the reconnect recovery path and the one-time disconnect log behavior.

Testing

  • bun fmt
  • bun lint
  • bun typecheck
  • bun run test

Note

Medium Risk
Touches WebSocket subscription retry/logging and orchestration replay recovery paths; mistakes could hide useful diagnostics or impact reconnection stability, but changes are small and covered by new tests.

Overview
Reduces noisy WebSocket disconnect warnings by ensuring WsTransport.subscribe logs transport disconnect only once per reconnect window, resetting once a subscription successfully receives a value.

Hardens environment orchestration recovery by scheduling replay recovery via a wrapper that swallows rejected promises (notably when triggered by onResubscribe or sequence gaps), preventing unhandled rejection noise.

Adds tests covering one-time disconnect logging when multiple subscriptions fail together and ensuring replay recovery failures during resubscribe don’t surface as unhandled rejections.

Reviewed by Cursor Bugbot for commit c61ff7a. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Debounce disconnect logging and swallow replay recovery rejections in WebSocket transport

  • WsTransport.subscribe now emits at most one 'WebSocket RPC subscription disconnected' warning per disconnect event when multiple subscriptions fail together; logging resets after the first successful message is received.
  • Replay recovery rejections in createEnvironmentConnection are now swallowed via .catch(() => undefined), preventing unhandled promise rejections during sequence-gap or resubscribe-triggered recovery.

Macroscope summarized c61ff7a.

- swallow replay recovery errors from resubscribe and sequence-gap retries
- log WebSocket transport disconnects only once per outage
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 9, 2026

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 654d8b18-aecf-4d75-8566-c5a32d303450

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch t3code/fix-reconnect-errors

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:S 10-29 changed lines (additions + deletions). labels Apr 9, 2026
@macroscopeapp
Copy link
Copy Markdown
Contributor

macroscopeapp bot commented Apr 9, 2026

Approvability

Verdict: Approved

This PR makes two small, self-contained improvements: deduplicating WebSocket disconnect warning logs when multiple subscriptions fail together, and properly catching errors from replay recovery to prevent unhandled promise rejections. Both changes are low-risk logging/error-handling fixes with corresponding test coverage.

You can customize Macroscope's approvability policy. Learn more.

@juliusmarminge juliusmarminge merged commit 9bedd71 into main Apr 9, 2026
12 checks passed
@juliusmarminge juliusmarminge deleted the t3code/fix-reconnect-errors branch April 9, 2026 22:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S 10-29 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant