perf(client-runtime): halve server config bootstrap traffic - #8367
perf(client-runtime): halve server config bootstrap traffic#8367Adamulek123 wants to merge 5 commits into
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Comment |
8aa0532 to
7459715
Compare
ApprovabilityVerdict: Not approved Macroscope's review found this PR not approvable — This changes production connection bootstrap and ongoing server-config delivery by introducing a shared replaying stream with buffering, folding, and new lifecycle/error semantics. The performance gain is well targeted and tested, but the stateful cross-cutting runtime behavior is substantial enough to require human review. Notes:
You can add or adjust custom eligibility rules. Learn more. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 12efd16. Configure here.

What changed
Client sessions now open
subscribeServerConfigonce and use its first snapshot for initial configuration. The same stream continues to deliver later configuration updates.Why
Session startup previously called
serverGetConfigand then subscribed to server configuration. The subscription's first frame repeated the same full payload, so every connection paid for two bootstrap exchanges. This change keeps configuration fresh without relying on a cache.Measured impact
Compared with
main-latest.jsonfrom main commit230c5d4a:The general thread-transfer measurements remain within 0.2% wire variance. Every enforced ceiling passes.
Validation
vp test run packages/client-runtime/src/rpc/session.test.ts packages/client-runtime/src/rpc/client.test.ts packages/client-runtime/src/state/server.test.ts, 28 tests passedvp exec tsc -p packages/client-runtime/tsconfig.json --noEmitChecklist
Generated with GPT-5.6 Sol through the Codex harness.
Note
Reuse session
serverConfigEventsstream forsubscribeServerConfigto halve bootstrap trafficRpcSessionFactory.makenow bootstraps initial config from a streamingsubscribeServerConfigsnapshot instead of a unaryserverGetConfigcall, then publishes subsequent updates through a session-levelserverConfigEventsstream.subscribeDynamicin client.ts detects thesubscribeServerConfigtag and reuses the existing session stream, avoiding a duplicate RPC subscription.applyServerConfigEventhelper incrementally derives updatedServerConfigfrom snapshot,keybindingsUpdated,providerStatuses, andsettingsUpdatedevents;mapSessionRpcErrormaps subscription errors toConnectionAttemptError.remote-unavailableerror instead of falling back toserverGetConfig.Macroscope summarized 66ee0d2.
Note
Medium Risk
Changes environment connection bootstrap and readiness timing (initial config waits on the first stream snapshot); mistakes could break config sync or duplicate subscriptions, though behavior is heavily covered by tests.
Overview
Session connect now bootstraps configuration from a single
subscribeServerConfigsubscription instead ofserverGetConfigplus a second subscribe, cutting duplicate full-config traffic on connect.RpcSessionforks that subscription once, resolvesinitialConfigfrom the first snapshot, and exposesserverConfigEventsas a shared stream (PubSub + replay) that foldskeybindingsUpdated,providerStatuses, andsettingsUpdatedinto live config and emits synthetic snapshots when subscribers miss revisions.subscribeDynamicroutessubscribeServerConfigthrough the session stream when present so callers do not open another websocket subscription. Tests cover no duplicate subscribe, multi-subscriber broadcast/replay, and updated bootstrap expectations.Reviewed by Cursor Bugbot for commit 66ee0d2. Bugbot is set up for automated code reviews on this repo. Configure here.