Skip to content

Commit 401c034

Browse files
committed
test(agents): pin native anthropic replay policy
1 parent 03cbc25 commit 401c034

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

src/agents/pi-embedded-runner.sanitize-session-history.test.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1058,7 +1058,23 @@ describe("sanitizeSessionHistory", () => {
10581058
});
10591059

10601060
it("preserves signed thinking turns while repairing legacy tool-result pairing for anthropic", async () => {
1061+
setNonGoogleModelApi();
10611062
const sessionManager = makeMockSessionManager();
1063+
const nativeAnthropicPolicy: TranscriptPolicy = {
1064+
sanitizeMode: "full",
1065+
sanitizeToolCallIds: true,
1066+
toolCallIdMode: "strict",
1067+
preserveNativeAnthropicToolUseIds: true,
1068+
repairToolUseResultPairing: true,
1069+
preserveSignatures: true,
1070+
sanitizeThinkingSignatures: false,
1071+
dropThinkingBlocks: false,
1072+
dropReasoningFromHistory: false,
1073+
applyGoogleTurnOrdering: false,
1074+
validateGeminiTurns: false,
1075+
validateAnthropicTurns: true,
1076+
allowSyntheticToolResults: true,
1077+
};
10621078
const messages: AgentMessage[] = [
10631079
makeUserMessage("Use the gateway"),
10641080
makeAssistantMessage(
@@ -1085,13 +1101,15 @@ describe("sanitizeSessionHistory", () => {
10851101
modelId: "claude-sonnet-4-6",
10861102
sessionManager,
10871103
sessionId: TEST_SESSION_ID,
1104+
policy: nativeAnthropicPolicy,
10881105
});
10891106
const validated = await validateReplayTurns({
10901107
messages: sanitized,
10911108
modelApi: "anthropic-messages",
10921109
provider: "anthropic",
10931110
modelId: "claude-opus-4-6",
10941111
sessionId: TEST_SESSION_ID,
1112+
policy: nativeAnthropicPolicy,
10951113
});
10961114

10971115
expect(sanitized.map((msg) => msg.role)).toEqual(["user", "assistant", "toolResult", "user"]);

0 commit comments

Comments
 (0)