-
-
Notifications
You must be signed in to change notification settings - Fork 80.7k
Bug: anthropic-transport-stream overwrites signature_delta instead of appending, causing permanent session corruption #87574
Copy link
Copy link
Closed
Labels
P1High-priority user-facing bug, regression, or broken workflow.High-priority user-facing bug, regression, or broken workflow.clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.ClawSweeper found an open linked pull request for this issue.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:auth-providerAuth, provider routing, model choice, or SecretRef resolution may break.Auth, provider routing, model choice, or SecretRef resolution may break.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.Session, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.
Description
Metadata
Metadata
Assignees
Labels
P1High-priority user-facing bug, regression, or broken workflow.High-priority user-facing bug, regression, or broken workflow.clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.ClawSweeper found an open linked pull request for this issue.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:auth-providerAuth, provider routing, model choice, or SecretRef resolution may break.Auth, provider routing, model choice, or SecretRef resolution may break.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.Session, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.
Type
Fields
Priority
None yet
Summary
The
anthropic-transport-stream.ts(used by the embedded agent runner) overwritesthinkingSignatureon eachsignature_deltaevent instead of appending to it. Since Anthropic sends the thinking block signature across multiplesignature_deltastreaming chunks, only the last chunk survives. The truncated signature is persisted to the session JSONL, and all subsequent replay attempts fail with:This permanently bricks the session with no user recovery path other than
/reset.Root Cause
File:
src/agents/anthropic-transport-stream.ts:1289Correct implementation (same repo):
src/llm/providers/anthropic.ts:629-634Failure Mechanism
signature_deltachunks (base64 is long)Secondary Issue (Non-blocking follow-up)
src/agents/anthropic-transport-stream.ts:1125does not set adisplayfield when initializing thinking blocks, whilesrc/llm/providers/anthropic.ts:987setsdisplay: "summarized".Note: After analysis, this is a separate concern from the signature corruption bug:
displayis a request-level parameter (params.thinking.display), not a content block fieldTransportContentBlocktype does not include adisplayfieldRecovery for Already-Corrupted Sessions
Existing sessions with truncated signatures are handled by
wrapAnthropicStreamWithRecovery(thinking.ts:482):THINKING_BLOCK_ERROR_PATTERNmatches the error messageUsers do NOT need to
/reset— the recovery mechanism handles this automatically on the next request.Real-World Observation
Observed on a production Mac Mini gateway (OpenClaw 0.6.0-dev) with
claude-opus-4-6:/resetembedded run failover decision: decision=surface_error reason=formatRelated Issues
Invalid signature in thinking blockerror reaching users. ThewrapAnthropicStreamWithRecovery(Bug: Empty thinking-block signatures poison Anthropic Messages sessions (fix from #70054 not applied to standard Anthropic transport) #86886) single-retry cannot help because the signature is fundamentally truncated at storage time.Why Existing Fixes Are Insufficient
Fix
Acceptance Criteria
Non-blocking Follow-up
displayparameter alignment (separate from content block storage; does not affect signature integrity)