What: - disable tool-call id sanitization for OpenAI/OpenAI Codex transcript policy - gate id sanitization in image sanitizer to full mode only - keep orphan reasoning downgrade scoped to OpenAI model-switch replay path - update transcript policy, session-history, sanitizer, and reasoning replay tests - document OpenAI model-switch orphan-reasoning cleanup behavior in transcript hygiene reference Why: - OpenAI Responses replay depends on canonical call_id|fc_id pairings for reasoning followers - strict id rewriting in OpenAI path breaks follower matching and triggers rs_* orphan 400s - limiting scope avoids behavior expansion while fixing the identified regression Tests: - pnpm vitest run src/agents/transcript-policy.test.ts src/agents/pi-embedded-runner.sanitize-session-history.test.ts src/agents/openai-responses.reasoning-replay.test.ts - pnpm vitest run --config vitest.e2e.config.ts src/agents/transcript-policy.e2e.test.ts src/agents/pi-embedded-runner.sanitize-session-history.e2e.test.ts src/agents/pi-embedded-helpers.sanitize-session-messages-images.removes-empty-assistant-text-blocks-but-preserves.e2e.test.ts src/agents/pi-embedded-helpers.sanitizeuserfacingtext.e2e.test.ts - pnpm lint - pnpm format:check - pnpm check:docs - pnpm test (fails in current macOS bash 3.2 env at test/git-hooks-pre-commit.integration.test.ts: mapfile not found)
43 lines
1.3 KiB
TypeScript
43 lines
1.3 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { resolveTranscriptPolicy } from "./transcript-policy.js";
|
|
|
|
describe("resolveTranscriptPolicy", () => {
|
|
it("enables sanitizeToolCallIds for Anthropic provider", () => {
|
|
const policy = resolveTranscriptPolicy({
|
|
provider: "anthropic",
|
|
modelId: "claude-opus-4-5",
|
|
modelApi: "anthropic-messages",
|
|
});
|
|
expect(policy.sanitizeToolCallIds).toBe(true);
|
|
expect(policy.toolCallIdMode).toBe("strict");
|
|
});
|
|
|
|
it("enables sanitizeToolCallIds for Google provider", () => {
|
|
const policy = resolveTranscriptPolicy({
|
|
provider: "google",
|
|
modelId: "gemini-2.0-flash",
|
|
modelApi: "google-generative-ai",
|
|
});
|
|
expect(policy.sanitizeToolCallIds).toBe(true);
|
|
});
|
|
|
|
it("enables sanitizeToolCallIds for Mistral provider", () => {
|
|
const policy = resolveTranscriptPolicy({
|
|
provider: "mistral",
|
|
modelId: "mistral-large-latest",
|
|
});
|
|
expect(policy.sanitizeToolCallIds).toBe(true);
|
|
expect(policy.toolCallIdMode).toBe("strict9");
|
|
});
|
|
|
|
it("disables sanitizeToolCallIds for OpenAI provider", () => {
|
|
const policy = resolveTranscriptPolicy({
|
|
provider: "openai",
|
|
modelId: "gpt-4o",
|
|
modelApi: "openai",
|
|
});
|
|
expect(policy.sanitizeToolCallIds).toBe(false);
|
|
expect(policy.toolCallIdMode).toBeUndefined();
|
|
});
|
|
});
|