fix(web): delay transient reconnect warnings #5670
main fromrefs/pull/5670/head·merged by maria-rcks View on GitHubWhat 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:

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 typecheckpnpm --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.
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
scheduleEnvironmentReconnectWarningandhasEnvironmentReconnectWarningGraceElapsedinChatView.logic.tsto schedule and cancel the delayed warning. ChatViewContenttracks 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.
- 1
github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:M
macroscopeapp[bot](GitHub profile, opens in a new tab) approved these changes
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).maria-rcks merged thised886fe
maria-rcks closed this
Sign in to join this conversation.
Thread transfer impact#
✅ Thread transfer remains within every enforced ceiling.
Baseline:
31891a1· PR result:c033723· Source CI: successScenario 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.
Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.