Skip to content

Commit 708405f

Browse files
saphidclaude
andcommitted
fix(server): handoff context names every file of a multi-file patch
Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 61c3794 commit 708405f

4 files changed

Lines changed: 45 additions & 2 deletions

File tree

‎apps/server/src/orchestration-v2/ContextHandoffBudget.test.ts‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,19 @@ describe("handoff budget", () => {
137137
assert.equal(command?.kind, "command_execution");
138138
assert.include(command!.text, "Exit code: 1");
139139
assert.include(command!.text, "界".repeat(300));
140+
assert.equal(
141+
historicalMessage({
142+
...base,
143+
type: "file_change",
144+
fileName: "src/a.ts",
145+
changes: [
146+
{ operation: "update", path: "src/a.ts" },
147+
{ operation: "add", path: "src/b.ts" },
148+
{ operation: "update", path: "src/new.ts", oldPath: "src/old.ts" },
149+
],
150+
})?.text,
151+
"File change: src/a.ts, src/b.ts, src/new.ts",
152+
);
140153
assert.isNull(
141154
historicalMessage({
142155
...base,

‎apps/server/src/orchestration-v2/ContextHandoffService.test.ts‎

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,36 @@ it.effect("caps the side chat context block without summarizing discarded parent
210210
});
211211
assert.isTrue(framingOnly.startsWith("You are in a side chat beside the main thread."));
212212
assert.notInclude(framingOnly, "Main thread activity");
213+
214+
const multiFilePatch = ContextHandoffService.makeSideChatContext({
215+
parentThreadId,
216+
digest: [
217+
{
218+
id: TurnItemId.make("turn-item:patch"),
219+
threadId: parentThreadId,
220+
runId: null,
221+
nodeId: null,
222+
providerThreadId: null,
223+
providerTurnId: null,
224+
nativeItemRef: null,
225+
parentItemId: null,
226+
ordinal: 60,
227+
status: "completed",
228+
title: null,
229+
startedAt: null,
230+
completedAt: null,
231+
updatedAt: DateTime.makeUnsafe(0),
232+
type: "file_change",
233+
fileName: "src/a.ts",
234+
changes: [
235+
{ operation: "update", path: "src/a.ts" },
236+
{ operation: "add", path: "src/b.ts" },
237+
{ operation: "update", path: "src/new.ts", oldPath: "src/old.ts" },
238+
],
239+
},
240+
],
241+
});
242+
assert.include(multiFilePatch, "- File change: src/a.ts, src/b.ts, src/new.ts");
213243
}).pipe(Effect.provide(layerTest)),
214244
);
215245

‎apps/server/src/orchestration-v2/ContextHandoffService.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ function summarizeDeltaItem(item: OrchestrationV2TurnItem): string | null {
213213
case "command_execution":
214214
return `- Command: ${compactText(item.input)}`;
215215
case "file_change":
216-
return `- File change: ${item.fileName}`;
216+
return `- File change: ${compactText(item.changes?.map((change) => change.path).join(", ") ?? item.fileName)}`;
217217
case "checkpoint":
218218
return `- Checkpoint: ${item.files.length} files`;
219219
case "handoff":

‎packages/provider-core/src/server/handoffBudget.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ export function historicalMessage(
147147
text = item.message;
148148
break;
149149
case "file_change":
150-
text = `File change: ${item.fileName}`;
150+
text = `File change: ${item.changes?.map((change) => change.path).join(", ") ?? item.fileName}`;
151151
break;
152152
case "proposed_plan":
153153
text = item.markdown;

0 commit comments

Comments
 (0)