The best way to control Claude Code, Codex and more from any computer or phone
fix(server): preserve config changes while the initial snapshot loads (#18406)
Co-authored-by: SAPHID <saphid@users.noreply.github.com> Co-authored-by: GPT-6.1 Sol <noreply@openai.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Julius Marminge <julius0216@outlook.com>
Alex Southwell committed
Oct 20, 2026 at 02:49 UTC
6518c8243dfa7f54476eff902f1197fd1203ffe8
3 files changed
+344
-3
apps/server/src/keybindings.ts
+10
@@ -227,6 +227,13 @@ export class Keybindings extends Context.Service<
227
228
readonly streamChanges: Stream.Stream<KeybindingsChangeEvent>;
229
230
+ /** Acquire before reading a snapshot to buffer changes until the stream starts. */
231
+ readonly subscribeChanges: Effect.Effect<
232
+ Stream.Stream<KeybindingsChangeEvent>,
233
+ never,
234
+ Scope.Scope
235
+ >;
236
+
237
/**
238
* Writes config atomically and enforces the max rule count by truncating
239
* oldest entries when needed.
@@ -639,6 +646,9 @@ const make = Effect.gen(function* () {
646
get streamChanges() {
647
return Stream.fromPubSub(changesPubSub);
648
},
649
+ get subscribeChanges() {
650
+ return PubSub.subscribe(changesPubSub).pipe(Effect.map(Stream.fromSubscription));
651
+ },
652
upsertKeybindingRule: (input) =>
653
upsertSemaphore.withPermits(1)(
654
Effect.gen(function* () {
apps/server/src/ws.test.ts
+328
@@ -1,8 +1,13 @@
1
+import * as NodeServices from "@effect/platform-node/NodeServices";
2
import { assert, it } from "@effect/vitest";
3
import {
4
ORCHESTRATION_PROTOCOL_VERSION,
5
+ AuthSessionId,
6
+ EnvironmentId,
7
ProjectId,
8
ThreadId,
9
+ WS_METHODS,
10
+ WsSubscribeServerConfigRpc,
11
type OrchestrationV2StoredEvent,
12
type OrchestrationProjectShell,
13
type ServerConfig,
@@ -21,9 +26,84 @@ import * as PubSub from "effect/PubSub";
26
import * as Queue from "effect/Queue";
27
import * as Stream from "effect/Stream";
28
import * as TestClock from "effect/testing/TestClock";
29
+import { Headers } from "effect/http";
30
+import { RpcGroup, RpcMessage, RpcServer } from "effect/rpc";
31
import { ChildProcessSpawner } from "effect/process";
32
import * as SqlClient from "effect/sql/SqlClient";
33
34
+import * as PreviewAutomationBroker from "./mcp/PreviewAutomationBroker.ts";
35
+import * as ServerBrowser from "./preview/ServerBrowser.ts";
36
+import * as AcpRegistryRuntimeCoordinator from "@t3tools/provider-acp-registry/server/AcpRegistryRuntimeCoordinator";
37
+import * as AcpRegistrySupport from "@t3tools/provider-acp-registry/server/AcpRegistrySupport";
38
+import * as AgentSessionImporter from "./project/AgentSessionImporter.ts";
39
+import * as AgentSessionScanner from "./project/AgentSessionScanner.ts";
40
+import * as AnalyticsService from "./telemetry/AnalyticsService.ts";
41
+import * as AntigravityInstallation from "./provider/AntigravityInstallation.ts";
42
+import * as BackgroundPolicy from "./background/BackgroundPolicy.ts";
43
+import * as CheckpointDiffQuery from "./checkpointing/CheckpointDiffQuery.ts";
44
+import * as CommandOutputHub from "./orchestration-v2/CommandOutputHub.ts";
45
+import * as CodexInstallation from "./provider/CodexInstallation.ts";
46
+import * as DeviceService from "./device/DeviceService.ts";
47
+import * as DirectEndpoints from "./environment/DirectEndpoints.ts";
48
+import * as EnvironmentAuth from "./auth/EnvironmentAuth.ts";
49
+import * as EnvironmentTheme from "./environmentTheme.ts";
50
+import * as GitWorkflowService from "./git/GitWorkflowService.ts";
51
+import * as HostResources from "./resourceTelemetry/HostResources.ts";
52
+import * as ManagedProjectFolders from "./project/ManagedProjectFolders.ts";
53
+import * as McpAppRequests from "./mcpApps/McpAppRequests.ts";
54
+import * as ModelManifest from "./provider/ModelManifest.ts";
55
+import * as Orchestrator from "./orchestration-v2/Orchestrator.ts";
56
+import * as OtlpEndpointCheck from "./observability/OtlpEndpointCheck.ts";
57
+import * as PairingGrantStore from "./auth/PairingGrantStore.ts";
58
+import * as PortScanner from "./preview/PortScanner.ts";
59
+import * as PreviewManager from "./preview/Manager.ts";
60
+import * as ProcessDiagnostics from "./diagnostics/ProcessDiagnostics.ts";
61
+import * as ProcessResourceMonitor from "./diagnostics/ProcessResourceMonitor.ts";
62
+import * as ProjectCloneTracker from "./project/ProjectCloneTracker.ts";
63
+import * as ProjectSetupScriptRunner from "./project/ProjectSetupScriptRunner.ts";
64
+import * as ProviderAuthService from "./provider/ProviderAuthService.ts";
65
+import * as ProviderInstanceRegistry from "./provider/ProviderInstanceRegistry.ts";
66
+import * as ProviderLatestVersions from "@t3tools/provider-core/server/ProviderLatestVersions";
67
+import * as ProviderMaintenanceRunner from "./provider/providerMaintenanceRunner.ts";
68
+import * as ProviderRegistry from "./provider/ProviderRegistry.ts";
69
+import * as ProviderSessionManager from "./orchestration-v2/ProviderSessionManager.ts";
70
+import * as PullRequestReviewGuideService from "./pullRequest/PullRequestReviewGuideService.ts";
71
+import * as PullRequestService from "./pullRequest/PullRequestService.ts";
72
+import * as PullRequestSyncReactor from "./orchestration-v2/PullRequestSyncReactor.ts";
73
+import * as RelayClient from "@t3tools/shared/relayClient";
74
+import * as RemoteOpenTargets from "./environment/RemoteOpenTargets.ts";
75
+import * as RepositoryIdentityResolver from "./project/RepositoryIdentityResolver.ts";
76
+import * as ResourceTelemetry from "./resourceTelemetry/ResourceTelemetry.ts";
77
+import * as ReviewService from "./review/ReviewService.ts";
78
+import * as ScheduledTasks from "./scheduledTasks/ScheduledTaskService.ts";
79
+import * as SecretRequests from "./secrets/SecretRequests.ts";
80
+import * as ServerEnvironment from "./environment/ServerEnvironment.ts";
81
+import * as ServerLifecycleEvents from "./serverLifecycleEvents.ts";
82
+import * as ServerRuntimeStartup from "./serverRuntimeStartup.ts";
83
+import * as ServerSelfUpdate from "./cloud/selfUpdate.ts";
84
+import * as SessionStore from "./auth/SessionStore.ts";
85
+import * as SourceControlDiscovery from "./sourceControl/SourceControlDiscovery.ts";
86
+import * as SourceControlRepositoryService from "./sourceControl/SourceControlRepositoryService.ts";
87
+import * as StorageCleanup from "./storageCleanup.ts";
88
+import * as DatabaseStorage from "./persistence/DatabaseStorage.ts";
89
+import * as TerminalManager from "./terminal/Manager.ts";
90
+import * as ThreadLaunchService from "./orchestration-v2/ThreadLaunchService.ts";
91
+import * as ThreadSearch from "./orchestration-v2/ThreadSearch.ts";
92
+import * as UsageLimitSources from "./usage/UsageLimitSources.ts";
93
+import * as UsageService from "./usage/UsageService.ts";
94
+import * as VcsProvisioningService from "./vcs/VcsProvisioningService.ts";
95
+import * as VcsStatusBroadcaster from "./vcs/VcsStatusBroadcaster.ts";
96
+import * as WorkspaceEntries from "./workspace/WorkspaceEntries.ts";
97
+import * as WorkspaceFileSystem from "./workspace/WorkspaceFileSystem.ts";
98
+import * as WorktreeSetupTracker from "./project/WorktreeSetupTracker.ts";
99
+import * as ProjectFaviconResolver from "./project/ProjectFaviconResolver.ts";
100
+import * as TraceDiagnostics from "./diagnostics/TraceDiagnostics.ts";
101
+import * as WorkspacePaths from "./workspace/WorkspacePaths.ts";
102
+import * as ServerSecretStore from "./auth/ServerSecretStore.ts";
103
+import * as ServerConfigModule from "./config.ts";
104
+import * as Keybindings from "./keybindings.ts";
105
+import * as ServerSettings from "./serverSettings.ts";
106
+
107
import * as EventStore from "./orchestration-v2/EventStore.ts";
108
import * as ProjectionMaintenance from "./orchestration-v2/ProjectionMaintenance.ts";
109
import * as ProjectionStore from "./orchestration-v2/ProjectionStore.ts";
@@ -36,10 +116,12 @@ import * as ProjectEnrichment from "./project/ProjectEnrichmentService.ts";
116
import * as ProjectService from "./project/ProjectService.ts";
117
import {
118
hasCompatibleOrchestrationProtocol,
119
+ layerWsRpc,
120
resolveAvailableEditorsForConfig,
121
shouldUseBoundedThreadSnapshot,
122
subscribeOrchestrationV2Shell,
123
subscribeOrchestrationV2Thread,
124
+ WS_RPC_SERVER_OPTIONS,
125
withLateEditorConfig,
126
} from "./ws.ts";
127
@@ -363,6 +445,252 @@ it.live.each(["thread", "shell"] as const)(
445
}).pipe(Effect.scoped, Effect.provide(ReplayTestLayer)),
446
);
447
448
+// Build the production RPC layer; unrelated capabilities fail if this test calls them.
449
+const layerUnusedConfigRpcServices = Layer.mergeAll(
450
+ Layer.mock(ServerSecretStore.ServerSecretStore)({}),
451
+ Layer.mock(WorkspacePaths.WorkspacePaths)({}),
452
+ Layer.mock(TraceDiagnostics.TraceDiagnostics)({}),
453
+ Layer.mock(ProjectFaviconResolver.ProjectFaviconResolver)({}),
454
+ Layer.mock(ProjectEnrichment.ProjectEnrichmentService)({}),
455
+ Layer.mock(AcpRegistryRuntimeCoordinator.AcpRegistryRuntimeCoordinator)({}),
456
+ Layer.mock(AcpRegistrySupport.AcpRegistryCatalog)({}),
457
+ Layer.mock(AgentSessionImporter.AgentSessionImporter)({}),
458
+ Layer.mock(AgentSessionScanner.AgentSessionScanner)({}),
459
+ Layer.mock(AnalyticsService.AnalyticsService)({}),
460
+ Layer.mock(AntigravityInstallation.AntigravityInstallation)({ managedDirectory: "/unused" }),
461
+ Layer.mock(BackgroundPolicy.BackgroundPolicy)({}),
462
+ Layer.mock(CheckpointDiffQuery.CheckpointDiffQuery)({}),
463
+ Layer.mock(CommandOutputHub.CommandOutputHub)({}),
464
+ Layer.mock(CodexInstallation.CodexInstallation)({ managedDirectory: "/unused" }),
465
+ Layer.mock(DeviceService.DeviceService)({}),
466
+ Layer.mock(EnvironmentTheme.EnvironmentThemeService)({}),
467
+ Layer.mock(GitWorkflowService.GitWorkflowService)({}),
468
+ Layer.mock(HostResources.HostResources)({}),
469
+ Layer.mock(McpAppRequests.McpAppRequests)({}),
470
+ Layer.mock(ModelManifest.ModelManifest)({}),
471
+ Layer.mock(OrchestrationEventStore.OrchestrationEventStore)({}),
472
+ Layer.mock(Orchestrator.OrchestratorV2)({}),
473
+ Layer.mock(OtlpEndpointCheck.OtlpEndpointCheck)({}),
474
+ Layer.mock(PairingGrantStore.PairingGrantStore)({}),
475
+ Layer.mock(PortScanner.PortDiscovery)({}),
476
+ Layer.mock(PreviewManager.PreviewManager)({}),
477
+ Layer.mock(ProcessDiagnostics.ProcessDiagnostics)({}),
478
+ Layer.mock(ProcessResourceMonitor.ProcessResourceMonitor)({}),
479
+ Layer.mock(ProjectCloneTracker.ProjectCloneTracker)({}),
480
+ Layer.mock(ProjectService.ProjectService)({}),
481
+ Layer.mock(ProjectSetupScriptRunner.ProjectSetupScriptRunner)({}),
482
+ Layer.mock(ProjectStore.ProjectStoreV2)({}),
483
+ Layer.mock(ProviderAuthService.ProviderAuthService)({}),
484
+ Layer.mock(ProviderInstanceRegistry.ProviderInstanceRegistry)({}),
485
+ Layer.mock(ProviderLatestVersions.ProviderLatestVersions)({}),
486
+ Layer.mock(ProviderMaintenanceRunner.ProviderMaintenanceRunner)({}),
487
+ Layer.mock(ProviderSessionManager.ProviderSessionManagerV2)({}),
488
+ Layer.mock(PullRequestReviewGuideService.PullRequestReviewGuideService)({}),
489
+ Layer.mock(PullRequestService.PullRequestService)({}),
490
+ Layer.mock(PullRequestSyncReactor.PullRequestSyncReactor)({}),
491
+ Layer.mock(RelayClient.RelayClient)({}),
492
+ Layer.mock(RepositoryIdentityResolver.RepositoryIdentityResolver)({}),
493
+ Layer.mock(ResourceTelemetry.ResourceTelemetry)({}),
494
+ Layer.mock(ReviewService.ReviewService)({}),
495
+ Layer.mock(ScheduledTasks.ScheduledTaskService)({}),
496
+ Layer.mock(SecretRequests.SecretRequests)({}),
497
+ Layer.mock(ServerLifecycleEvents.ServerLifecycleEvents)({}),
498
+ Layer.mock(ServerRuntimeStartup.ServerRuntimeStartup)({}),
499
+ Layer.mock(ServerSelfUpdate.ServerSelfUpdate)({}),
500
+ Layer.mock(SessionStore.SessionStore)({ cookieName: "config-test", legacyCookieName: undefined }),
501
+ Layer.mock(SourceControlDiscovery.SourceControlDiscovery)({}),
502
+ Layer.mock(SourceControlRepositoryService.SourceControlRepositoryService)({}),
503
+ Layer.mock(StorageCleanup.StorageCleanup)({}),
504
+ Layer.mock(DatabaseStorage.DatabaseStorage)({}),
505
+ Layer.mock(TerminalManager.TerminalManager)({}),
506
+ Layer.mock(ThreadLaunchService.ThreadLaunchService)({}),
507
+ Layer.mock(ThreadManagement.ThreadManagementService)({}),
508
+ Layer.mock(ThreadSearch.ThreadSearch)({}),
509
+ Layer.mock(UsageService.UsageService)({}),
510
+ Layer.mock(VcsProvisioningService.VcsProvisioningService)({}),
511
+ Layer.mock(VcsStatusBroadcaster.VcsStatusBroadcaster)({}),
512
+ Layer.mock(WorkspaceEntries.WorkspaceEntries)({}),
513
+ Layer.mock(WorkspaceFileSystem.WorkspaceFileSystem)({}),
514
+ Layer.mock(WorktreeSetupTracker.WorktreeSetupTracker)({}),
515
+);
516
+
517
+const layerConfigSources = Layer.mergeAll(
518
+ Keybindings.layer,
519
+ ServerSettings.layer.pipe(Layer.provide(ServerSecretStore.layer)),
520
+).pipe(
521
+ Layer.provideMerge(Layer.fresh(SqlitePersistence.layerMemory)),
522
+ Layer.provideMerge(
523
+ Layer.fresh(
524
+ ServerConfigModule.layerTest(process.cwd(), { prefix: "t3-config-subscription-test-" }),
525
+ ),
526
+ ),
527
+ Layer.provideMerge(NodeServices.layer),
528
+);
529
+
530
+it.effect(
531
+ "preserves settings during discovery and keybindings during snapshot ACK at the config RPC boundary",
532
+ () =>
533
+ Effect.gen(function* () {
534
+ const keybindings = yield* Keybindings.Keybindings;
535
+ const settings = yield* ServerSettings.ServerSettingsService;
536
+ const keybindingsSubscribed = yield* Deferred.make<void>();
537
+ const settingsSubscribed = yield* Deferred.make<void>();
538
+ const keybindingsChanges = keybindings.subscribeChanges.pipe(
539
+ Effect.tap(() => Deferred.succeed(keybindingsSubscribed, undefined)),
540
+ );
541
+ const settingsChanges = settings.subscribeChanges.pipe(
542
+ Effect.tap(() => Deferred.succeed(settingsSubscribed, undefined)),
543
+ );
544
+ const initialKeybindings = (yield* keybindings.getSnapshot).keybindings;
545
+ const discoveryStarted = yield* Deferred.make<void>();
546
+ const finishDiscovery = yield* Deferred.make<void>();
547
+ const responses = yield* Queue.unbounded<ServerConfigStreamEvent>();
548
+ const configRpcServices = Layer.mergeAll(
549
+ layerUnusedConfigRpcServices,
550
+ Layer.mock(ExternalLauncher.ExternalLauncher)({
551
+ resolveAvailableEditors: () =>
552
+ Deferred.succeed(discoveryStarted, undefined).pipe(
553
+ Effect.andThen(Deferred.await(finishDiscovery)),
554
+ Effect.as([]),
555
+ ),
556
+ resolveFileManagerRevealKind: () => Effect.succeed(undefined),
557
+ }),
558
+ Layer.mock(ProviderRegistry.ProviderRegistry)({
559
+ getProviders: Effect.succeed([]),
560
+ streamChanges: Stream.never,
561
+ }),
562
+ Layer.mock(UsageLimitSources.UsageLimitSources)({ streamChanges: Stream.make([]) }),
563
+ Layer.mock(RemoteOpenTargets.RemoteOpenTargets)({
564
+ resolveTargets: () => Effect.succeed([]),
565
+ }),
566
+ Layer.mock(DirectEndpoints.DirectEndpoints)({ resolve: () => Effect.succeed([]) }),
567
+ Layer.mock(ManagedProjectFolders.ManagedProjectFolders)({
568
+ scratchRoot: Effect.succeedNone,
569
+ namedProjectsRoot: process.cwd(),
570
+ }),
571
+ Layer.mock(ServerEnvironment.ServerEnvironment)({
572
+ getDescriptor: Effect.succeed({
573
+ environmentId: EnvironmentId.make("config-test"),
574
+ label: "Config test",
575
+ platform: { os: "linux", arch: "x64" },
576
+ serverVersion: "0.0.0",
577
+ capabilities: { repositoryIdentity: false },
578
+ }),
579
+ }),
580
+ Layer.mock(EnvironmentAuth.EnvironmentAuth)({
581
+ getDescriptor: () =>
582
+ Effect.succeed({
583
+ policy: "loopback-browser",
584
+ bootstrapMethods: [],
585
+ sessionMethods: ["browser-session-cookie"],
586
+ sessionCookieName: "config-test-session",
587
+ }),
588
+ }),
589
+ // Signal subscription on either accessor so the test also fails, rather
590
+ // than hangs, against a handler that subscribes after the snapshot.
591
+ Layer.succeed(Keybindings.Keybindings, {
592
+ ...keybindings,
593
+ streamChanges: Stream.unwrap(keybindingsChanges),
594
+ subscribeChanges: keybindingsChanges,
595
+ }),
596
+ Layer.succeed(ServerSettings.ServerSettingsService, {
597
+ ...settings,
598
+ streamChanges: Stream.unwrap(settingsChanges),
599
+ subscribeChanges: settingsChanges,
600
+ }),
601
+ );
602
+ const server = yield* RpcServer.makeNoSerialization(
603
+ RpcGroup.make(WsSubscribeServerConfigRpc),
604
+ {
605
+ ...WS_RPC_SERVER_OPTIONS,
606
+ onFromServer: (response) =>
607
+ response._tag === "Chunk"
608
+ ? Effect.forEach(response.values, (event) => Queue.offer(responses, event), {
609
+ discard: true,
610
+ })
611
+ : Effect.void,
612
+ },
613
+ ).pipe(
614
+ Effect.provide(
615
+ layerWsRpc(
616
+ {
617
+ sessionId: AuthSessionId.make("config-test"),
618
+ subject: "config-test",
619
+ method: "browser-session-cookie",
620
+ scopes: [],
621
+ },
622
+ {},
623
+ {},
624
+ yield* PreviewAutomationBroker.PreviewAutomationBroker,
625
+ yield* ServerBrowser.ServerBrowser,
626
+ ).pipe(Layer.provide(configRpcServices)),
627
+ ),
628
+ );
629
+ const requestId = RpcMessage.RequestId("config");
630
+ const acknowledge = server.write(0, { _tag: "Ack", requestId });
631
+ yield* server.write(0, {
632
+ _tag: "Request",
633
+ id: requestId,
634
+ tag: WS_METHODS.subscribeServerConfig,
635
+ payload: {},
636
+ headers: Headers.empty,
637
+ });
638
+ yield* Deferred.await(discoveryStarted);
639
+
640
+ const duringDiscovery = yield* settings.updateSettings({ defaultAutoPull: true });
641
+ yield* Deferred.succeed(finishDiscovery, undefined);
642
+ const snapshot = yield* Queue.take(responses);
643
+ assert.equal(snapshot.type, "snapshot");
644
+ if (snapshot.type !== "snapshot") return yield* Effect.die("Missing initial snapshot");
645
+ assert.isFalse(snapshot.config.settings.defaultAutoPull);
646
+ assert.deepEqual(snapshot.config.keybindings, initialKeybindings);
647
+ const duringAck = yield* keybindings.upsertKeybindingRule({
648
+ key: "mod+alt+y",
649
+ command: "terminal.toggle",
650
+ });
651
+ yield* acknowledge;
652
+ yield* Deferred.await(keybindingsSubscribed);
653
+ yield* Deferred.await(settingsSubscribed);
654
+
655
+ // Later updates expose a dropped buffered event as a value mismatch, not a timeout.
656
+ const latestSettings = yield* settings.updateSettings({ enableProviderUpdateChecks: false });
657
+ const latestKeybindings = yield* keybindings.upsertKeybindingRule({
658
+ key: "mod+alt+z",
659
+ command: "terminal.split",
660
+ });
661
+ const expectedSettings = [duringDiscovery, latestSettings].map(
662
+ ServerSettings.redactServerSettingsForClient,
663
+ );
664
+ const expectedKeybindings = [duringAck, latestKeybindings];
665
+ // The two sources can interleave, but each must retain its own publication order.
666
+ for (let i = 0; i < 4; i++) {
667
+ const event = yield* Queue.take(responses);
668
+ if (event.type === "settingsUpdated") {
669
+ assert.deepEqual(event.payload.settings, expectedSettings.shift());
670
+ } else {
671
+ assert.equal(event.type, "keybindingsUpdated");
672
+ if (event.type !== "keybindingsUpdated")
673
+ return yield* Effect.die("Unexpected config event");
674
+ assert.deepEqual(event.payload.keybindings, expectedKeybindings.shift());
675
+ assert.deepEqual(event.payload.issues, []);
676
+ }
677
+ yield* acknowledge;
678
+ }
679
+ assert.isEmpty(expectedSettings);
680
+ assert.isEmpty(expectedKeybindings);
681
+ yield* server.write(0, { _tag: "Interrupt", requestId, interruptors: [] });
682
+ }).pipe(
683
+ Effect.provide(
684
+ Layer.mergeAll(
685
+ Layer.fresh(layerConfigSources),
686
+ Layer.mock(PreviewAutomationBroker.PreviewAutomationBroker)({}),
687
+ Layer.mock(ServerBrowser.ServerBrowser)({}),
688
+ ),
689
+ ),
690
+ Effect.scoped,
691
+ ),
692
+);
693
+
694
// Compaction keeps the oldest and newest event per message, so a cursor older
695
// than the deleted rows still replays each message where the client would
696
// first have seen it (reducers append on first sight) and reaches the same
apps/server/src/ws.ts
+6
-3
@@ -1153,7 +1153,7 @@ export const subscribeOrchestrationV2Shell = Effect.fn("ws.orchestrationV2.subsc
1153
},
1154
);
1155
1156
-const layerWsRpc = (
1156
+export const layerWsRpc = (
1157
currentSession: EnvironmentAuth.AuthenticatedSession,
1158
clientOrigin: OrchestrationClientOrigin,
1159
clientAnalyticsProps: Readonly<Record<string, unknown>>,
@@ -2908,8 +2908,11 @@ const layerWsRpc = (
2908
Stream.unwrap(
2909
Effect.gen(function* () {
2910
const usageLimitsCommand = input.usageLimitsCommand === true;
2911
+ // Buffer changes through discovery and the initial snapshot's RPC ACK wait.
2912
+ const keybindingsChanges = yield* keybindings.subscribeChanges;
2913
+ const settingsChanges = yield* serverSettings.subscribeChanges;
2914
const config = yield* loadServerConfig({ usageLimitsCommand });
2912
- const keybindingsUpdates = keybindings.streamChanges.pipe(
2915
+ const keybindingsUpdates = keybindingsChanges.pipe(
2916
Stream.map((event) => ({
2917
version: 1 as const,
2918
type: "keybindingsUpdated" as const,
@@ -2975,7 +2978,7 @@ const layerWsRpc = (
2978
})),
2979
)
2980
: Stream.empty;
2978
- const settingsUpdates = serverSettings.streamChanges.pipe(
2981
+ const settingsUpdates = settingsChanges.pipe(
2982
Stream.map((settings) => ServerSettings.redactServerSettingsForClient(settings)),
2983
Stream.map((settings) => ({
2984
version: 1 as const,