Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(web): delay transient reconnect warnings #5670

Mergedt3-code-bot[bot](GitHub profile, opens in a new tab)merged 1 commit intomain fromrefs/pull/5670/headmerged by maria-rcks View on GitHub

What Changed

  • wait 2 seconds before showing normal environment connecting or reconnecting warnings
  • keep hard offline, error, and version-skew warnings immediate
  • key the grace state per environment so it cannot leak across environment switches

Why

Returning to a backgrounded npx t3@nightly serve tab can briefly reconnect a stale RPC socket. The socket recovers in about a second, but the yellow unavailable banner currently flashes immediately and looks like a sustained disconnect.

UI Changes

Matched real-app test using a sanitized local project, closing only the active RPC /ws connection:

before and after reconnect warning behavior

Timing proof. The base flashes immediately, while this change suppresses quick recovery and still shows a persistent reconnect after 2 seconds:

https://t3bot-production.up.railway.app/files/lkMCCNkbmkYbuCF5ns8ozEfP/reconnect-warning-grace.mp4

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • I included before/after screenshots for any UI changes
  • I included a video for animation/interaction changes

Verification

  • pnpm exec vp run --filter @t3tools/web typecheck
  • pnpm --filter @t3tools/web test -- src/components/ChatView.logic.test.ts (219 files, 1992 tests)
  • real app workflow above, plus immediate hard-offline warning verification

Built with GPT-5.4 via T3bot.


Note

Low Risk UI-only banner timing in ChatView with small pure helpers and tests; no auth, data, or RPC protocol changes.

Overview Adds a 2-second grace period before showing the yellow environment connecting/reconnecting unavailable banner, so brief RPC blips (e.g. after refocusing a background tab) no longer flash a warning that recovers almost immediately.

ChatView tracks which environment is in connecting/reconnecting, starts a timer via scheduleEnvironmentReconnectWarning, and only treats grace as elapsed when that state matches the same environment id. Banner suppression during reconnect now also waits out grace unless an update is running or the version-skew reconnect fold applies—hard offline/error paths and version-skew messaging stay immediate. Unit tests cover timer firing, cancel on recovery, and per-environment grace keys.

Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit c03372301346f9e656c7319ce3e1f32cf8a74a2f. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).

Note

Delay transient environment reconnect warnings by a 2s grace period

  • Adds a 2-second grace period before showing the environment-unavailable banner during reconnecting states, preventing flicker for brief disconnections.
  • Introduces scheduleEnvironmentReconnectWarning and hasEnvironmentReconnectWarningGraceElapsed in ChatView.logic.ts to schedule and cancel the delayed warning.
  • ChatViewContent tracks a per-environment grace state and resets it on environment change; the banner is suppressed until the grace elapses unless an update is running or a version-skew condition applies.
Macroscope summarized c033723.
    1. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted

    2. Thread transfer impact

      ✅ Thread transfer remains within every enforced ceiling.

      ProviderMetricMain baselineThis PRImpactPR ceiling
      CodexTotal thread wire11.3 KiB11.3 KiB−2 B (−0.0%)15.1 KiB✅
      CodexThread snapshot wire5.5 KiB5.5 KiB−3 B (−0.1%)7.3 KiB✅
      CodexLive turn WebSocket wire5.9 KiB5.9 KiB+1 B (+0.0%)7.8 KiB✅
      CodexLive turn WebSocket decoded49.7 KiB49.7 KiB0 B (0.0%)66.4 KiB✅
      CodexLive turn messages16160 (0.0%)21✅
      ClaudeTotal thread wire11.3 KiB11.3 KiB−17 B (−0.1%)15.1 KiB✅
      ClaudeThread snapshot wire5.5 KiB5.5 KiB−3 B (−0.1%)7.3 KiB✅
      ClaudeLive turn WebSocket wire5.9 KiB5.9 KiB−14 B (−0.2%)7.8 KiB✅
      ClaudeLive turn WebSocket decoded50.6 KiB50.6 KiB0 B (0.0%)66.4 KiB✅
      ClaudeLive turn messages16160 (0.0%)21✅

      Baseline: 31891a1 · PR result: c033723 · Source CI: success

      Scenario and decoded snapshot size

      10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.

      • Codex decoded thread snapshot: 94.6 KiB
      • Claude decoded thread snapshot: 95.4 KiB

      Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.

    3. Approvability

      Verdict: Approved c033723

      This PR adds a 2-second delay before showing reconnection warnings to avoid UI flicker during transient disconnections. The change is self-contained to banner suppression logic, well-tested, and has no backend or security implications.

      You can customize Macroscope's approvability policy. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    4. maria-rcks merged thised886fe

    5. maria-rcks closed this

Sign in to join this conversation.