Skip to content

Commit 6e45427

Browse files
Radu028claude
andcommitted
test(acp): the replay helper counts a recorded notes block as the current model's
Recorders normalize the notes they keep for another model, so their text never matches the generated notes exactly. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 1cc7db1 commit 6e45427

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

‎apps/server/src/orchestration-v2/testkit/ReplayRuntimeInstructions.test.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,8 @@ describe("materializeReplayTranscriptRuntimeInstructions", () => {
207207
prompt("on A"),
208208
promptAnswer,
209209
selectModel("model-b"),
210-
prompt("on B"),
210+
// As the Kiro recorder keeps another model's notes: normalized, not the exact text.
211+
prompt("on B", "<runtime_info>\n<any>\n</runtime_info>"),
211212
promptAnswer,
212213
prompt("again on B"),
213214
promptAnswer,
@@ -217,7 +218,6 @@ describe("materializeReplayTranscriptRuntimeInstructions", () => {
217218
]);
218219
expect(onA).toMatch(/^<runtime_info>/);
219220
expect(onB).toMatch(/^<runtime_info>/);
220-
expect(onB).toContain("model-b");
221221
expect(againOnB).toBe("again on B");
222222
expect(backOnA).toBe(onA);
223223
});

‎apps/server/src/orchestration-v2/testkit/ReplayRuntimeInstructions.ts‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,9 @@ export function materializeReplayTranscriptRuntimeInstructions(
2828
};
2929
// Grok's flavor sets `supportsCompaction`; Kiro compacts through its own request instead.
3030
const compactsThroughPrompt = runtime.driver === "grok";
31-
// The ACP adapter resends the runtime notes until a prompt that carried that exact text
32-
// succeeds. Cancelled, refused, and failed prompts do not establish delivery. A new runtime and
33-
// a compaction reset it. Copilot's compaction events and compactions routed to a child session
34-
// are not mirrored here; no recording has them yet.
31+
// Like the adapter: notes go out until a prompt carrying that text succeeds, and a new runtime
32+
// or compaction resets that. Not mirrored, as no recording has them: Copilot compaction events,
33+
// child-session compactions, and ACP v2 prompts that settle through an idle `state_update`.
3534
const deliveredNotes = new Map<unknown, string>();
3635
// A prompt's success records delivery only if no compaction completed after it was sent.
3736
const compactionCounts = new Map<unknown, number>();
@@ -204,7 +203,8 @@ export function materializeReplayTranscriptRuntimeInstructions(
204203
recordedNotes === undefined && deliveredNotes.get(promptSessionId) !== expected;
205204
pendingPrompt = {
206205
sessionId: promptSessionId,
207-
notes: recordedNotes ?? (resend ? expected : undefined),
206+
// Recorders normalize the notes they keep, so a recorded block stands for this model's.
207+
notes: recordedNotes !== undefined || resend ? expected : undefined,
208208
compact: false,
209209
compactionsAtSend: compactionCounts.get(promptSessionId) ?? 0,
210210
};

0 commit comments

Comments
 (0)