Skip to content

Claude signed thinking blocks can still poison session replay #85781

Description

@shakkernerd

Summary

Claude runs can still fail when session history replays a signed thinking block that the provider rejects.

Observed with github-copilot/claude-opus-4.7:

LLM request rejected: messages.7.content.13: Invalid `signature` in `thinking` block

This appears to be a Claude signed-thinking replay issue, not a generic GitHub Copilot issue. Copilot is one affected route because it exposes Claude models and rejects the replayed signed thinking block.

Actual behavior

Continuing an existing session can fail before producing a reply. The logs show the provider rejects the outbound request payload because a historical assistant thinking block contains a signature that is invalid for this replay path.

This poisons the session for that model/provider path: subsequent turns keep replaying the incompatible block unless history is sanitized.

Expected behavior

OpenClaw should not replay Claude signed thinking blocks to provider paths that cannot safely accept them.

If a provider/model route cannot preserve Claude thinking continuity safely, the outbound replay history should strip those blocks completely before the request is sent.

Notes

The current policy shape also looks suspicious: extensions/github-copilot/replay-policy.ts sets dropThinkingBlocks: true for Claude models, but the shared thinking sanitizer preserves the latest assistant thinking block for native Anthropic continuity. That may be correct for direct Anthropic paths, but it is unsafe for provider routes that reject replayed signed thinking.

Relevant areas:

  • extensions/github-copilot/replay-policy.ts
  • src/agents/pi-embedded-runner/replay-history.ts
  • src/agents/pi-embedded-runner/thinking.ts
  • src/agents/pi-embedded-runner/run/attempt.ts

Acceptance criteria

  • Existing sessions containing Claude signed thinking blocks can continue on affected provider/model routes instead of failing with Invalid signature in thinking block.
  • The replay policy distinguishes paths that may preserve latest thinking from paths that must strip it completely.
  • Direct Anthropic behavior is not regressed if it still requires latest thinking continuity.
  • Add a targeted regression test for the affected Claude replay sanitization path.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1High-priority user-facing bug, regression, or broken workflow.bugSomething isn't workingclawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.impact:auth-providerAuth, provider routing, model choice, or SecretRef resolution may break.impact:session-stateSession, 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.maintainerMaintainer-authored PR

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions