Skip to content

fix(client): use lightweight connection probe#4137

Merged
juliusmarminge merged 2 commits into
pingdotgg:mainfrom
eeinarsson:fix/lightweight-connection-probe
Jul 19, 2026
Merged

fix(client): use lightweight connection probe#4137
juliusmarminge merged 2 commits into
pingdotgg:mainfrom
eeinarsson:fix/lightweight-connection-probe

Conversation

@eeinarsson

@eeinarsson eeinarsson commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

Fixes #3553.

Related to #3911, which addresses initial server.getConfig latency. This PR is narrower: foreground connection health checks no longer invoke configuration hydration at all.

What Changed

  • Add a dedicated server.probe RPC that returns immediately and uses the existing orchestration-read authorization scope.
  • Use that endpoint for client-runtime connection health checks instead of server.getConfig.
  • Keep server.getConfig for initial session configuration hydration.
  • Add focused coverage verifying that initialization loads configuration while subsequent probes use the lightweight endpoint.

Why

When the application becomes active, the connection supervisor currently probes the session through server.getConfig.

That RPC performs configuration and provider discovery work, which can become slow on busy or resource-constrained Windows systems. If it exceeds the 15-second foreground probe timeout, the client treats an otherwise live WebSocket as unavailable, enters reconnecting state, and temporarily disables the composer.

A dedicated no-work RPC separates connection liveness from configuration hydration. This reduces false reconnects without changing initial configuration loading, authorization requirements, or the existing timeout and reconnect policy.

Testing

  • vp test packages/client-runtime/src/rpc/session.test.ts packages/client-runtime/src/connection/supervisor.test.ts — 28 tests passed
  • vp check — passed with 10 unrelated existing web lint warnings
  • vp run typecheck — passed
  • git diff --check — passed

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • UI screenshots are not applicable because there is no UI change
  • An interaction video is not applicable because there is no motion or interaction change

Note

Low Risk
Behavior change is limited to probe RPC selection; initial config loading and auth scopes stay the same, with backward compatibility for servers missing the new capability.

Overview
Introduces server.probe, a no-op RPC for liveness checks, and advertises it via the optional connectionProbe capability on the execution environment descriptor.

Client-runtime still hydrates the session with server.getConfig on connect, but RpcSession.probe now calls server.probe when the capability is present; older servers without it keep using server.getConfig for probes. The WebSocket server wires the handler with the same orchestration-read scope as other read RPCs.

Tests cover probe vs initial config traffic, legacy fallback, and supervisor behavior on application activation (probe without reconnect).

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

Note

Add lightweight server.probe RPC for connection health checks

  • Adds a new server.probe RPC contract (WsServerProbeRpc) with an empty payload and empty success response, authorized under AuthOrchestrationReadScope.
  • RpcSession.probe now calls server.probe when the server reports capabilities.connectionProbe: true, falling back to server.getConfig for legacy servers.
  • The server advertises connectionProbe: true in the ExecutionEnvironmentDescriptor.capabilities returned by ServerEnvironment.make.
  • Behavioral Change: connection probes on capable servers now send a lightweight server.probe request instead of the heavier server.getConfig call.

Macroscope summarized da511a9.

@coderabbitai

coderabbitai Bot commented Jul 18, 2026

Copy link
Copy Markdown

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: 39b38847-d334-4044-971c-70b4c8e2dd11

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

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:S 10-29 changed lines (additions + deletions). labels Jul 18, 2026

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Want fixes drafted automatically? Bugbot Autofix can create code changes for findings. A team admin can enable Autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit f0e42d6. Configure here.

Comment thread packages/client-runtime/src/rpc/session.ts Outdated
@macroscopeapp

macroscopeapp Bot commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved

This PR adds a lightweight serverProbe RPC for connection checking instead of using the heavier serverGetConfig. The change is backwards compatible, well-tested, and introduces no significant behavioral changes - the new endpoint simply returns an empty response to verify connectivity.

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

@juliusmarminge
juliusmarminge merged commit 2640e6d into pingdotgg:main Jul 19, 2026
16 checks passed
cursor Bot pushed a commit to aaditagrawal/t3code that referenced this pull request Jul 20, 2026
pingdotgg#4112, pingdotgg#4132, pingdotgg#4134, pingdotgg#4006, pingdotgg#4137) (#171)

* [codex] Route OpenCode missing-session errors through Effect (pingdotgg#3608)

Co-authored-by: Codex <codex@openai.com>
Co-authored-by: Julius Marminge <julius0216@outlook.com>
(cherry picked from commit d0b9f8d)

* [codex] canonicalize client timestamps (pingdotgg#4112)

(cherry picked from commit da3c203)

* fix: increase OpenCode server startup timeout from 5s to 30s (pingdotgg#4132)

(cherry picked from commit 398140a)

* fix(shared): delete unused agentAwareness phase predicates (pingdotgg#4134)

(cherry picked from commit e8ff6bc)

* perf(client): defer active thread cache writes (pingdotgg#4006)

(cherry picked from commit 765e1b5)

* fix(client): use lightweight connection probe (pingdotgg#4137)

(cherry picked from commit 2640e6d)

* fix(client): adapt deferred thread cache tests for fork warm-cache

Fork warm-cache seeding stays on synchronizing and must not re-persist
active turns. Gate the seed persistence write with shouldPersistThread
and drive the pingdotgg#4006 regression test to live via a socket snapshot.

Co-authored-by: aaditagrawal <aaditagrawal@users.noreply.github.com>

---------

Co-authored-by: Wout Stiens <71498452+StiensWout@users.noreply.github.com>
Co-authored-by: Codex <codex@openai.com>
Co-authored-by: Julius Marminge <julius0216@outlook.com>
Co-authored-by: Maxwell Young <maxtheyoung@gmail.com>
Co-authored-by: Utkarsh Patil <73941998+UtkarshUsername@users.noreply.github.com>
Co-authored-by: Kriday Dave <technocratix902@gmail.com>
Co-authored-by: Chris Michael Guzman <67719167+Chrrxs@users.noreply.github.com>
Co-authored-by: eeinarsson <128746408+eeinarsson@users.noreply.github.com>
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: aaditagrawal <aaditagrawal@users.noreply.github.com>
cursor Bot pushed a commit to aaditagrawal/t3code that referenced this pull request Jul 20, 2026
…ingdotgg#3749, pingdotgg#4159) (#172)

* [codex] Route OpenCode missing-session errors through Effect (pingdotgg#3608)

Co-authored-by: Codex <codex@openai.com>
Co-authored-by: Julius Marminge <julius0216@outlook.com>
(cherry picked from commit d0b9f8d)

* [codex] canonicalize client timestamps (pingdotgg#4112)

(cherry picked from commit da3c203)

* fix: increase OpenCode server startup timeout from 5s to 30s (pingdotgg#4132)

(cherry picked from commit 398140a)

* fix(shared): delete unused agentAwareness phase predicates (pingdotgg#4134)

(cherry picked from commit e8ff6bc)

* perf(client): defer active thread cache writes (pingdotgg#4006)

(cherry picked from commit 765e1b5)

* fix(client): use lightweight connection probe (pingdotgg#4137)

(cherry picked from commit 2640e6d)

* fix(client): adapt deferred thread cache tests for fork warm-cache

Fork warm-cache seeding stays on synchronizing and must not re-persist
active turns. Gate the seed persistence write with shouldPersistThread
and drive the pingdotgg#4006 regression test to live via a socket snapshot.

Co-authored-by: aaditagrawal <aaditagrawal@users.noreply.github.com>

* feat(web): themed sidebar header art for nightly and dev builds (pingdotgg#4130)

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: Julius Marminge <julius0216@outlook.com>
Co-authored-by: Julius Marminge <jmarminge@gmail.com>
(cherry picked from commit 53e3c98)

* feat: add headless `t3 connect` setup for SSH hosts (pingdotgg#3749)

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: Julius Marminge <julius0216@outlook.com>
Co-authored-by: codex <codex@users.noreply.github.com>
(cherry picked from commit 7a820ab)

* Refine T3 Connect authorization surfaces (pingdotgg#4159)

Co-authored-by: codex <codex@users.noreply.github.com>
(cherry picked from commit 2b180a2)

---------

Co-authored-by: Wout Stiens <71498452+StiensWout@users.noreply.github.com>
Co-authored-by: Codex <codex@openai.com>
Co-authored-by: Julius Marminge <julius0216@outlook.com>
Co-authored-by: Maxwell Young <maxtheyoung@gmail.com>
Co-authored-by: Utkarsh Patil <73941998+UtkarshUsername@users.noreply.github.com>
Co-authored-by: Kriday Dave <technocratix902@gmail.com>
Co-authored-by: Chris Michael Guzman <67719167+Chrrxs@users.noreply.github.com>
Co-authored-by: eeinarsson <128746408+eeinarsson@users.noreply.github.com>
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: aaditagrawal <aaditagrawal@users.noreply.github.com>
Co-authored-by: maria <maria@kuuro.net>
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: Julius Marminge <jmarminge@gmail.com>
Co-authored-by: Theo Browne <me@t3.gg>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: codex <codex@users.noreply.github.com>
adamfgr pushed a commit to agriffiths-bots/t3code that referenced this pull request Jul 20, 2026
* Add isolated app testing workflow (pingdotgg#4121)

Co-authored-by: codex <codex@users.noreply.github.com>

* feat(web): themed sidebar header art for nightly and dev builds (pingdotgg#4130)

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: Julius Marminge <julius0216@outlook.com>
Co-authored-by: Julius Marminge <jmarminge@gmail.com>

* feat: add headless `t3 connect` setup for SSH hosts (pingdotgg#3749)

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: Julius Marminge <julius0216@outlook.com>
Co-authored-by: codex <codex@users.noreply.github.com>

* Refine T3 Connect authorization surfaces (pingdotgg#4159)

Co-authored-by: codex <codex@users.noreply.github.com>

* fix: increase OpenCode server startup timeout from 5s to 30s (pingdotgg#4132)

* fix(shared): delete unused agentAwareness phase predicates (pingdotgg#4134)

* fix(mobile): Stabilize native stack option updates (pingdotgg#4037)

Co-authored-by: codex <codex@users.noreply.github.com>

* Make test-t3-app skill discoverable by Claude Code (pingdotgg#4162)

Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>

* fix(web): improve dev sidebar backdrop contrast & remove version pills (pingdotgg#4166)

* Fix draft banner stack overlap (pingdotgg#4164)

Co-authored-by: codex <codex@users.noreply.github.com>

* Add portable mobile app testing guidance (pingdotgg#4165)

Co-authored-by: codex <codex@users.noreply.github.com>

* fix(client): use lightweight connection probe (pingdotgg#4137)

---------

Co-authored-by: Julius Marminge <julius0216@outlook.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: maria <maria@kuuro.net>
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: Julius Marminge <jmarminge@gmail.com>
Co-authored-by: Theo Browne <me@t3.gg>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: Utkarsh Patil <73941998+UtkarshUsername@users.noreply.github.com>
Co-authored-by: Kriday Dave <technocratix902@gmail.com>
Co-authored-by: eeinarsson <128746408+eeinarsson@users.noreply.github.com>
@eeinarsson
eeinarsson deleted the fix/lightweight-connection-probe branch July 20, 2026 07:31
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:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Local desktop environment enters reconnecting after foreground health check timeout

2 participants