@devries-cameron20 / t3code Mirror · read-only / commits / 7931227977
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 24, 01:30 UTC

fix(server): stop refreshing providers on every config subscription (#11811)

Co-authored-by: Bil0000 <bilal.bakr.elsherif@gmail.com> Co-authored-by: Claude Fable 5 <noreply@anthropic.com>

Julius Marminge committed Sep 14, 2026 at 16:01 UTC 7931227977ca3e6f3354a63467caa634ab79796f
2 files changed +15 -41
apps/server/src/server.test.ts
+15 -37
@@ -6327,48 +6327,26 @@ it.layer(NodeServices.layer)("server router seam", (it) => {
6327 }).pipe(Effect.provide(NodeHttpServer.layerTest)),
6328 );
6329
6330 - it.effect("refreshes providers for each subscribeServerConfig connection", () =>
6330 + it.effect("serves config on reconnect without starting provider probes", () =>
6331 Effect.gen(function* () {
6332 - const refreshCalls = yield* Ref.make(0);
6333 - const firstRefreshDone = yield* Deferred.make<void>();
6334 - const secondRefreshDone = yield* Deferred.make<void>();
6335 -
6332 + const refresh = vi.fn(() => Effect.never);
6333 yield* buildAppUnderTest({
6337 - layers: {
6338 - providerRegistry: {
6339 - refresh: () =>
6340 - Ref.updateAndGet(refreshCalls, (count) => count + 1).pipe(
6341 - Effect.tap((count) =>
6342 - Deferred.succeed(
6343 - count === 1 ? firstRefreshDone : secondRefreshDone,
6344 - undefined,
6345 - ).pipe(Effect.ignore),
6346 - ),
6347 - Effect.as([]),
6348 - ),
6349 - },
6350 - },
6334 + layers: { providerRegistry: { refresh } },
6335 });
6336
6337 const wsUrl = yield* getWsServerUrl("/ws");
6354 - yield* Effect.scoped(
6355 - withWsRpcClient(wsUrl, (client) =>
6356 - Effect.gen(function* () {
6357 - yield* client[WS_METHODS.subscribeServerConfig]({}).pipe(Stream.runHead);
6358 - yield* Deferred.await(firstRefreshDone);
6359 - }),
6360 - ),
6361 - );
6362 - yield* Effect.scoped(
6363 - withWsRpcClient(wsUrl, (client) =>
6364 - Effect.gen(function* () {
6365 - yield* client[WS_METHODS.subscribeServerConfig]({}).pipe(Stream.runHead);
6366 - yield* Deferred.await(secondRefreshDone);
6367 - }),
6368 - ),
6369 - );
6370 -
6371 - assert.equal(yield* Ref.get(refreshCalls), 2);
6338 + for (let connection = 0; connection < 2; connection += 1) {
6339 + const event = yield* Effect.scoped(
6340 + withWsRpcClient(wsUrl, (client) =>
6341 + client[WS_METHODS.subscribeServerConfig]({}).pipe(
6342 + Stream.runHead,
6343 + Effect.map(Option.getOrThrow),
6344 + ),
6345 + ),
6346 + );
6347 + assert.equal(event.type, "snapshot");
6348 + }
6349 + assert.equal(refresh.mock.calls.length, 0);
6350 }).pipe(Effect.provide(NodeHttpServer.layerTest)),
6351 );
6352
apps/server/src/ws.ts
-4
@@ -3371,10 +3371,6 @@ const makeWsRpcLayer = (
3371 })),
3372 );
3373
3374 - yield* providerRegistry
3375 - .refresh()
3376 - .pipe(Effect.ignoreCause({ log: true }), Effect.forkScoped);
3377 -
3374 const liveUpdates = Stream.merge(
3375 keybindingsUpdates,
3376 Stream.merge(