mirror of
https://github.com/openclaw/openclaw.git
synced 2026-06-06 05:51:15 +08:00
Pre-compaction assistant messages carry thinkingSignature values bound to the original conversation prefix. After compaction the prefix changes (summarized content is replaced by the compaction summary), so Anthropic rejects those signatures with "Invalid signature in thinking block", permanently stalling the session through gateway restarts. stripInvalidThinkingSignatures only catches absent/blank signatures; this adds stripStaleThinkingSignaturesForCompactionReplay (thinking.ts) which identifies pre-compaction assistant messages by timestamp comparison against the latest compaction summary and strips their signature fields. Called in sanitizeSessionHistory (replay-history.ts) before stripInvalidThinkingSignatures for all signed-thinking providers (Anthropic, Bedrock, Vertex). Also fixes buildSuccessorEntries (compaction-successor-transcript.ts) to strip only pre-compaction kept entries when writing the rotation successor JSONL; uses strict < timestamp boundary so same-instant post-compaction messages are not affected. Docs: update transcript-hygiene.md Anthropic and Bedrock sections. Tests: 8 new cases for stripStaleThinkingSignaturesForCompactionReplay; 1 new case for buildSuccessorEntries verifying pre/post-compaction signature boundary. Fixes #90108