Skip to content

Commit 5cc594a

Browse files
t3dotggclaude
andcommitted
fix(evals): trim-capture keeps a capture that has no assistant turn
Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent f982aec commit 5cc594a

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

‎evals/mcp-tool-use/trim-capture.ts‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,9 @@ const keepEntries = (text: string, header: string, keep: ReadonlySet<string>) =>
8080

8181
const trimClaude = (native: Native) => {
8282
const firstAssistant = native.messages.findIndex((message) => message.role === "assistant");
83-
const head = structuredClone(native.messages.slice(0, firstAssistant));
83+
const head = structuredClone(
84+
native.messages.slice(0, firstAssistant === -1 ? undefined : firstAssistant),
85+
);
8486
const [first] = head;
8587
if (!first || !Array.isArray(first.content))
8688
throw new Error("The capture has no first user turn.");

0 commit comments

Comments
 (0)