The best way to control Claude Code, Codex and more from any computer or phone
perf(client): a repository identity refresh keeps unchanged projects identical (#20730)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Julius Marminge committed
Oct 16, 2026 at 21:05 UTC
3cb13308eb27b612378ac5a536b810903e481f45
2 files changed
+25
packages/client-runtime/src/state/shellReducer.test.ts
+16
@@ -226,6 +226,22 @@ describe("applyShellStreamEvent", () => {
226
expect(afterEnrichment.threads[0]?.title).toBe("Server thread");
227
});
228
229
+ it("keeps the project object when an enrichment re-resolves an unchanged identity", () => {
230
+ const project = { ...v2Project, repositoryIdentity };
231
+ const previous = { ...v2ShellSnapshot, snapshotSequence: 5, projects: [project] };
232
+ const next = mergeShellSnapshotProjects(
233
+ previous,
234
+ {
235
+ ...v2ShellSnapshot,
236
+ snapshotSequence: 5,
237
+ projects: [{ ...v2Project, repositoryIdentity: { ...repositoryIdentity } }],
238
+ },
239
+ { resolvedRepositoryIdentityRoots: [v2Project.workspaceRoot] },
240
+ );
241
+
242
+ expect(next.projects[0]).toBe(project);
243
+ });
244
+
245
it("takes identity from a lower-sequence enrichment without reverting live thread state", () => {
246
const previous = {
247
...v2ShellSnapshot,
packages/client-runtime/src/state/shellReducer.ts
+9
@@ -1,5 +1,6 @@
1
import {
2
OrchestrationV2ThreadShell,
3
+ RepositoryIdentity,
4
ThreadPullRequestLink,
5
type OrchestrationProjectShell,
6
type OrchestrationV2ShellSnapshot,
@@ -9,6 +10,9 @@ import * as Schema from "effect/Schema";
10
11
const sameThreadShell = Schema.toEquivalence(OrchestrationV2ThreadShell);
12
const sameLinks = Schema.toEquivalence(Schema.UndefinedOr(Schema.Array(ThreadPullRequestLink)));
13
+const sameRepositoryIdentity = Schema.toEquivalence(
14
+ Schema.UndefinedOr(Schema.NullOr(RepositoryIdentity)),
15
+);
16
17
export function sameThreadPullRequests(
18
left: OrchestrationV2ThreadShell["pullRequests"],
@@ -96,6 +100,11 @@ export function mergeShellSnapshotProjects(
100
return project;
101
}
102
if (resolvedRootSet?.has(project.workspaceRoot) === true) {
103
+ // Refreshes re-resolve every root; an unchanged identity keeps the project's identity
104
+ // so every subscriber (each pull request row, the sidebar) skips re-rendering.
105
+ if (sameRepositoryIdentity(project.repositoryIdentity, candidate.repositoryIdentity)) {
106
+ return project;
107
+ }
108
return { ...project, repositoryIdentity: candidate.repositoryIdentity };
109
}
110
if (project.repositoryIdentity == null && candidate.repositoryIdentity != null) {