@devries-cameron20 / t3code-1 / commits / 4494faa270
Fork 0

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

fix(client-runtime): checking out a pull request refreshes cached branch lists (#29161)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

Alex Southwell committed Nov 3, 2026 at 01:36 UTC 4494faa27053feb67d5469d1e034bfd13da8a389
2 files changed +19 -1
packages/client-runtime/src/state/git.ts
+5 -1
@@ -3,10 +3,12 @@ import { Atom } from "effect/reactivity";
3
4 import { createEnvironmentRpcCommand, createEnvironmentRpcQueryAtomFamily } from "./runtime.ts";
5 import type { EnvironmentRegistry } from "../connection/registry.ts";
6 +import * as Persistence from "../platform/persistence.ts";
7 import { vcsCommandConcurrency, vcsCommandScheduler } from "./vcsCommandScheduler.ts";
8 +import { invalidateCachedVcsRefs } from "./vcsRefInvalidation.ts";
9
10 export function createGitEnvironmentAtoms<R, E>(
9 - runtime: Atom.AtomRuntime<EnvironmentRegistry | R, E>,
11 + runtime: Atom.AtomRuntime<EnvironmentRegistry | Persistence.EnvironmentCacheStore | R, E>,
12 ) {
13 return {
14 pullRequestResolution: createEnvironmentRpcQueryAtomFamily(runtime, {
@@ -18,6 +20,8 @@ export function createGitEnvironmentAtoms<R, E>(
20 tag: WS_METHODS.gitPreparePullRequestThread,
21 scheduler: vcsCommandScheduler,
22 concurrency: vcsCommandConcurrency,
23 + onSettled: ({ environmentId, input }, registry) =>
24 + invalidateCachedVcsRefs(registry, { environmentId, cwd: input.cwd }),
25 }),
26 };
27 }
packages/client-runtime/src/state/vcs.test.ts
+14
@@ -34,6 +34,7 @@ import * as Persistence from "../platform/persistence.ts";
34 import { EnvironmentRpcUnavailableError } from "../rpc/client.ts";
35 import type { WsRpcProtocolClient } from "../rpc/protocol.ts";
36 import type { RpcSession } from "../rpc/session.ts";
37 +import { createGitEnvironmentAtoms } from "./git.ts";
38
39 import {
40 commitVcsRefsRefresh,
@@ -316,6 +317,8 @@ describe("cached VCS refs", () => {
317 const client = {
318 [WS_METHODS.vcsPull]: () => Effect.fail(expectedError),
319 [WS_METHODS.vcsRefreshStatus]: () => Effect.void,
320 + [WS_METHODS.gitPreparePullRequestThread]: () =>
321 + Effect.succeed({ branch: "feature/pr", worktreePath: null }),
322 } as unknown as WsRpcProtocolClient;
323 const supervisor = EnvironmentSupervisor.EnvironmentSupervisor.of({
324 target: TARGET,
@@ -371,6 +374,17 @@ describe("cached VCS refs", () => {
374 expect(AsyncResult.isSuccess(refreshResult)).toBe(true);
375 expect(yield* Ref.get(clears)).toBe(2);
376 expect(registry.get(vcsRefsCacheStateAtom(TARGET)).revision).toBe(2);
377 +
378 + const prepareResult = yield* Effect.promise(() =>
379 + createGitEnvironmentAtoms(runtime).preparePullRequestThread.run(registry, {
380 + environmentId: TARGET.environmentId,
381 + input: { cwd: "/repo", reference: "42", mode: "local" },
382 + }),
383 + );
384 +
385 + expect(AsyncResult.isSuccess(prepareResult)).toBe(true);
386 + expect(yield* Ref.get(clears)).toBe(3);
387 + expect(registry.get(vcsRefsCacheStateAtom(TARGET)).revision).toBe(3);
388 }),
389 ),
390 );