The best way to control Claude Code, Codex and more from any computer or phone
fix(web): changed root files with a leading space open in the diff panel (#36606)
Co-authored-by: Julius Marminge <julius0216@outlook.com>
Wout Stiens committed
Nov 14, 2026 at 10:35 UTC
953ce60d12348948ceb12da92cc9271a2cfa9975
5 files changed
+51
-3
apps/web/src/components/DiffPanel.browser.test.tsx
+34
@@ -302,3 +302,37 @@ it("says a turn diff cut off at the server's size limit is incomplete", async ()
302
.element(screen.getByText("This preview exceeds the size limit. Changes shown are incomplete."))
303
.toBeVisible();
304
});
305
+
306
+// Paths as git's numstat reports them; the parsed patch trims the trailing space from its name.
307
+it.each([
308
+ { path: " leading.ts", name: " leading.ts" },
309
+ { path: "src/trailing.ts ", name: "src/trailing.ts" },
310
+])("reveals the turn file $path picked from the changed files", async ({ path, name }) => {
311
+ using context = setup("origin/orphan");
312
+ state.diffFilesCollapsed = true;
313
+ state.checkpoints = [
314
+ {
315
+ runId: "run",
316
+ checkpointTurnCount: 1,
317
+ checkpointRef: "ref",
318
+ status: "ready",
319
+ files: [],
320
+ assistantMessageId: null,
321
+ completedAt: "2026-01-01T00:00:00Z",
322
+ },
323
+ ];
324
+ state.checkpointDiff = {
325
+ diff: `diff --git a/${path} b/${path}\nnew file mode 100644\n--- /dev/null\n+++ b/${path}\t\n@@ -0,0 +1 @@\n+revealed\n`,
326
+ };
327
+ useDiffPanelStore.getState().selectTurn(context.threadRef, RunId.make("run"), path);
328
+ await using screen = await render(
329
+ <RegistryContext.Provider value={context.registry}>
330
+ <div style={{ height: 600, display: "flex", flexDirection: "column" }}>
331
+ <DiffPanel composerDraftTarget={context.threadRef} workspaceMutationId={null} visible />
332
+ </div>
333
+ </RegistryContext.Provider>,
334
+ );
335
+ await expect
336
+ .element(screen.getByRole("button", { name: `Collapse ${name}`, exact: true }))
337
+ .toHaveAttribute("aria-expanded", "true");
338
+});
apps/web/src/components/DiffPanel.tsx
+3
-1
@@ -336,7 +336,9 @@ export default function DiffPanel({
336
diffSelection.kind === "branch" || diffSelection.kind === "commit"
337
? diffSelection.baseRef
338
: null;
339
- const selectedFilePath = diffSelection.kind === "turn" ? diffSelection.filePath : null;
339
+ // @pierre/diffs trims trailing whitespace from parsed file names; leading whitespace survives.
340
+ const selectedFilePath =
341
+ diffSelection.kind === "turn" ? diffSelection.filePath?.trimEnd() || null : null;
342
const selectedFileRevealRequestId =
343
diffSelection.kind === "turn" ? diffSelection.revealRequestId : 0;
344
const selectedTurn =
apps/web/src/diffPanelStore.ts
+1
-1
@@ -105,7 +105,7 @@ export const useDiffPanelStore = create<DiffPanelStoreState>()(
105
[threadKey]: {
106
kind: "turn",
107
turnId,
108
- filePath: filePath?.trim() || null,
108
+ filePath: filePath ?? null,
109
revealRequestId: previous?.kind === "turn" ? previous.revealRequestId + 1 : 1,
110
},
111
},
packages/contracts/src/orchestrationV2.test.ts
+11
@@ -5,6 +5,7 @@ import * as Schema from "effect/Schema";
5
import { NodeId, RunAttemptId, TrimmedNonEmptyString } from "./index.ts";
6
import {
7
latestProviderTurnForAttempt,
8
+ OrchestrationV2CheckpointFileSummary,
9
OrchestrationV2ProviderCapabilities,
10
OrchestrationV2ProviderThread,
11
OrchestrationV2ProviderThreadJson,
@@ -22,6 +23,7 @@ const now = DateTime.makeUnsafe("2026-04-20T00:00:00.000Z");
23
const decodeOrchestrationV2TurnItemJson = Schema.decodeUnknownSync(OrchestrationV2TurnItemJson);
24
const encodeOrchestrationV2TurnItemJson = Schema.encodeSync(OrchestrationV2TurnItemJson);
25
const decodeOrchestrationV2Subagent = Schema.decodeUnknownSync(OrchestrationV2Subagent);
26
+const decodeCheckpointFileSummary = Schema.decodeSync(OrchestrationV2CheckpointFileSummary);
27
const encodeOrchestrationV2SubagentJson = Schema.encodeSync(OrchestrationV2SubagentJson);
28
const decodeOrchestrationV2ProviderThreadJson = Schema.decodeUnknownSync(
29
OrchestrationV2ProviderThreadJson,
@@ -397,6 +399,15 @@ describe("orchestration V2 contracts", () => {
399
},
400
);
401
402
+ it.each([" leading.ts", "src/trailing.ts "])(
403
+ "decodes the checkpoint file path %j exactly",
404
+ (path) => {
405
+ expect(
406
+ decodeCheckpointFileSummary({ path, kind: "added", additions: 1, deletions: 0 }).path,
407
+ ).toBe(path);
408
+ },
409
+ );
410
+
411
it("decodes historical provider-thread JSON without pendingBackgroundTasks as empty roster", () => {
412
const providerThread = decodeOrchestrationV2ProviderThreadJson({
413
id: "provider-thread-1",
packages/contracts/src/orchestrationV2.ts
+2
-1
@@ -1455,7 +1455,8 @@ export const OrchestrationV2PlanArtifact = Schema.Union([
1455
export type OrchestrationV2PlanArtifact = typeof OrchestrationV2PlanArtifact.Type;
1456
1457
export const OrchestrationV2CheckpointFileSummary = Schema.Struct({
1458
- path: TrimmedNonEmptyString,
1458
+ // Exact, as git reports it: file names may start or end with whitespace.
1459
+ path: Schema.NonEmptyString,
1460
kind: TrimmedNonEmptyString,
1461
additions: NonNegativeInt,
1462
deletions: NonNegativeInt,