Repository navigation
fix(agents): detect thinking-block errors in ProviderHttpError.errorBody (fixes #98308) (AI-assisted) - #98334
liuhao1024 wants to merge 1 commit into
Conversation
The recovery predicate in shouldRecoverAnthropicThinkingError only traversed cause, error, rawError, errorMessage, and message fields. ProviderHttpError stores the raw Anthropic response on errorBody, which contains the specific thinking-block signature rejection text, while .message carries a generic user-facing string. Adding errorBody to the error graph traversal lets the recovery path detect the production error shape and fire the non-destructive repair (repairRejectedThinkingReplayInSessionManager) instead of rethrowing the HTTP 400 and bricking the session. Test: added errorBody case to the wrapAnthropicStreamWithRecovery parameterized test suite. Fixes openclaw#98308
|
Thanks for the context here. I swept through the related work, and this is now duplicate or superseded. Close as superseded: #98411 already merged the same ProviderHttpError Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Canonical path: Keep #98411 as the canonical landed fix for So I’m closing this here and keeping the remaining discussion on #98411, #98368, and #100193. Review detailsBest possible solution: Keep #98411 as the canonical landed fix for Do we have a high-confidence way to reproduce the issue? Yes at source level for the pre-fix release: v2026.6.11 lacks the Is this the best way to solve the issue? No for this branch now. The narrow fix shape was correct, but #98411 is already merged on current main and this branch would add duplicate traversal rather than a unique improvement. Security review: Security review cleared: The diff only reads an existing provider error-body field in recovery detection and adds a test; it adds no dependency, logging, secret, network, or supply-chain surface. AGENTS.md: found and applied where relevant. What I checked:
Likely related people:
Codex review notes: model internal, reasoning high; reviewed against 704c58468667; fix evidence: commit 95aced10b08a, main fix timestamp 2026-07-01T08:13:24Z. |
What Problem This Solves
When Anthropic rejects a replayed thinking block with an invalid signature, the recovery wrapper (
wrapAnthropicStreamWithRecovery) should detect the error and retry with stripped thinking blocks. However,ProviderHttpErrorstores the raw Anthropic response on.errorBodywhile.messagecarries a generic user-facing string. The detection predicate only traversedcause,error,rawError,errorMessage, andmessage— missingerrorBodyentirely. This means sessions become permanently bricked by stale thinking signatures even though a non-destructive repair path exists.Why This Change Was Made
The production error shape from
ProviderHttpErroris:.message→"LLM request failed: provider rejected the request schema or tool payload."(generic).errorBody→{"error":{"message":"messages.12.content.3: Invalid \signature` in `thinking` block",...}}` (specific)The
THINKING_BLOCK_ERROR_PATTERNregex correctly matches the error text, buterrorBodywas never fed to it. Addingcurrent.errorBodyto the error graph traversal inshouldRecoverAnthropicThinkingErrorcloses this gap.User Impact
Users on Claude opus-4.x, sonnet-4.x, haiku-4.x, and claude-5+ with native extended thinking enabled will no longer have sessions permanently bricked by stale thinking-block signatures. The recovery path now correctly detects the
ProviderHttpError.errorBodyshape and fires the non-destructive repair.Evidence
ProviderHttpError.errorBodycurrent.errorBodyto the error graph traversal inshouldRecoverAnthropicThinkingError(thinking.ts:549)ProviderHttpError.errorBodyto the existingwrapAnthropicStreamWithRecoverytest suiteProviderHttpError errorBodytest case, which verifies thatwrapAnthropicStreamWithRecoverynow correctly detects thinking-block signature errors stored in.errorBodyand retries with stripped thinking blocksReal behavior proof
ProviderHttpError.errorBodycurrent.errorBodyto the error graph traversal inshouldRecoverAnthropicThinkingError(thinking.ts:549)ProviderHttpError.errorBodyto the existingwrapAnthropicStreamWithRecoverytest suiteProviderHttpError errorBodytest case, which verifies thatwrapAnthropicStreamWithRecoverynow correctly detects thinking-block signature errors stored in.errorBodyand retries with stripped thinking blocks