fix(agents): set preserveSignatures to isAnthropic in resolveTranscriptPolicy (#32813)

Merged via squash.

Prepared head SHA: f522d21ca59a42abac554435a0aa646f6a34698d
Co-authored-by: Sid-Qin <201593046+Sid-Qin@users.noreply.github.com>
Co-authored-by: jalehman <550978+jalehman@users.noreply.github.com>
Reviewed-by: @jalehman
This commit is contained in:
Sid
2026-03-06 03:55:06 +08:00
committed by GitHub
parent 709dc671e4
commit 591264ef52
3 changed files with 46 additions and 1 deletions

View File

@@ -31,6 +31,7 @@ Docs: https://docs.openclaw.ai
- Sessions/daily reset transcript archival: archive prior transcript files during stale-session scheduled/daily resets by capturing the previous session entry before rollover, preventing orphaned transcript files on disk. (#35493) Thanks @byungsker.
- Feishu/group slash command detection: normalize group mention wrappers before command-authorization probing so mention-prefixed commands (for example `@Bot/model` and `@Bot /reset`) are recognized as gateway commands instead of being forwarded to the agent. (#35994) Thanks @liuxiaopai-ai.
- Agents/context pruning: guard assistant thinking/text char estimation against malformed blocks (missing `thinking`/`text` strings or null entries) so pruning no longer crashes with malformed provider content. (openclaw#35146) thanks @Sid-Qin.
- Agents/transcript policy: set `preserveSignatures` to Anthropic-only handling in `resolveTranscriptPolicy` so Anthropic thinking signatures are preserved while non-Anthropic providers remain unchanged. (#32813) thanks @Sid-Qin.
- Agents/schema cleaning: detect Venice + Grok model IDs as xAI-proxied targets so unsupported JSON Schema keywords are stripped before requests, preventing Venice/Grok `Invalid arguments` failures. (openclaw#35355) thanks @Sid-Qin.
- Skills/native command deduplication: centralize skill command dedupe by canonical `skillName` in `listSkillCommandsForAgents` so duplicate suffixed variants (for example `_2`) are no longer surfaced across interfaces outside Discord. (#27521) thanks @shivama205.
- Agents/xAI tool-call argument decoding: decode HTML-entity encoded xAI/Grok tool-call argument values (`&amp;`, `&quot;`, `&lt;`, `&gt;`, numeric entities) before tool execution so commands with shell operators and quotes no longer fail with parse errors. (#35276) Thanks @Sid-Qin.

View File

@@ -76,6 +76,50 @@ describe("resolveTranscriptPolicy", () => {
expect(policy.sanitizeMode).toBe("full");
});
it("preserves thinking signatures for Anthropic provider (#32526)", () => {
const policy = resolveTranscriptPolicy({
provider: "anthropic",
modelId: "claude-opus-4-5",
modelApi: "anthropic-messages",
});
expect(policy.preserveSignatures).toBe(true);
});
it("preserves thinking signatures for Bedrock Anthropic (#32526)", () => {
const policy = resolveTranscriptPolicy({
provider: "amazon-bedrock",
modelId: "us.anthropic.claude-opus-4-6-v1",
modelApi: "bedrock-converse-stream",
});
expect(policy.preserveSignatures).toBe(true);
});
it("does not preserve signatures for Google provider (#32526)", () => {
const policy = resolveTranscriptPolicy({
provider: "google",
modelId: "gemini-2.0-flash",
modelApi: "google-generative-ai",
});
expect(policy.preserveSignatures).toBe(false);
});
it("does not preserve signatures for OpenAI provider (#32526)", () => {
const policy = resolveTranscriptPolicy({
provider: "openai",
modelId: "gpt-4o",
modelApi: "openai",
});
expect(policy.preserveSignatures).toBe(false);
});
it("does not preserve signatures for Mistral provider (#32526)", () => {
const policy = resolveTranscriptPolicy({
provider: "mistral",
modelId: "mistral-large-latest",
});
expect(policy.preserveSignatures).toBe(false);
});
it("keeps OpenRouter on its existing turn-validation path", () => {
const policy = resolveTranscriptPolicy({
provider: "openrouter",

View File

@@ -123,7 +123,7 @@ export function resolveTranscriptPolicy(params: {
(!isOpenAi && sanitizeToolCallIds) || requiresOpenAiCompatibleToolIdSanitization,
toolCallIdMode,
repairToolUseResultPairing,
preserveSignatures: false,
preserveSignatures: isAnthropic,
sanitizeThoughtSignatures: isOpenAi ? undefined : sanitizeThoughtSignatures,
sanitizeThinkingSignatures: false,
dropThinkingBlocks,