Repository navigation
fix(anthropic): new Claude models lose reasoning and hit 400s until an OpenClaw release - #196459
Conversation
…n OpenClaw release Unknown Claude ids now get the strictest known contract (append-only runtime context, mandatory adaptive thinking, default sampling, no prefill, Claude 5 refusal handling); older generations are closed lists that only shrink, and listed /v1/models capabilities still win. The hand-kept table of which model reads which thinking is replaced by one rule: prefix-bound thinking does not follow a model switch, unbound thinking does, and the API drops what the target cannot read. claude-cli aliases resolve through Claude Code's own model menu instead of a core copy. Co-authored-by: obviyus <[email protected]>
Co-authored-by: obviyus <[email protected]>
…n OpenClaw release OpenClaw-Publication: a0d8ceef-1330-427a-a145-c457ac53815f
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs changes before merge. What this changesThe PR gives unknown Claude models stricter request and replay contracts and derives CLI aliases from Claude Code’s model menu. Example: A claude-fable-5-2 session performs tool loops through a custom Anthropic endpoint.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Needs changes before merge - 1 item remains Keep open: this maintainer-authored PR addresses a verified replay failure, but removing the shared CLI alias lookup leaves command and cron callers with incorrect context budgets. Priority: P1 Before merge
Findings
Tests
Agent review detailsHow this fits togetherThe Anthropic plugin discovers model capabilities and native aliases; shared model contracts turn those facts and conversation history into provider requests, while CLI preparation selects context and compaction budgets. flowchart LR
A[Provider listing and CLI menu] --> B[Prepared model catalog]
B --> C[Shared Claude contracts]
D[Conversation history] --> C
C --> E[Anthropic transport]
B --> F[CLI preparation]
F --> G[Claude Code process]
Technical reviewBest possible solution: Keep the shared Claude contract repair and resolve native aliases through the prepared catalog for every CLI entry point before retiring the old lookup. Do we have a high-confidence way to reproduce the issue? Current main’s predicate and replay-policy consumer establish the missing Fable 5.2 retention path, supported by the author’s recorded live failure; this review ran no target code. Is this the best way to solve the issue? The existing shared contracts are the appropriate owners, and the smaller replay rule removes duplicate policy, but native-alias resolution must reach all CLI callers. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 179529ec9dd8. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceAcceptance criteria:
What I checked:
Likely related people:
PR surfaceSource +274, Tests +1350, Docs +2, Other +484. Total +2110 across 41 files. Added test files: 7. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed November 10, 2026, 12:44 AM ET / 05:44 UTC. |
Rebuilds the branch tree as main plus only this PR's 21 files; an earlier formatting commit accidentally carried unrelated work from the checkout. Also covers unknown Claude ids in the SDK contract test and allocates the added test lines. Co-authored-by: obviyus <[email protected]>
OpenClaw-Publication: cb5ef89a-eb41-4019-9877-cd346fd9012f
|
Merged via explicitly authorized admin squash with attributed pre-existing CI failures.
|
Prefix-bound replay now covers Fable 5.2 (openclaw#196459), so the alias can follow the newest Fable. Explicit fable-5.1 and fable-5 selections are unchanged. Related: openclaw#196248
…n OpenClaw release (openclaw#196459) * fix(anthropic): new Claude models lose reasoning and hit 400s until an OpenClaw release Unknown Claude ids now get the strictest known contract (append-only runtime context, mandatory adaptive thinking, default sampling, no prefill, Claude 5 refusal handling); older generations are closed lists that only shrink, and listed /v1/models capabilities still win. The hand-kept table of which model reads which thinking is replaced by one rule: prefix-bound thinking does not follow a model switch, unbound thinking does, and the API drops what the target cannot read. claude-cli aliases resolve through Claude Code's own model menu instead of a core copy. Co-authored-by: obviyus <[email protected]> * style: format changed files Co-authored-by: obviyus <[email protected]> * fix(anthropic): new Claude models lose reasoning and hit 400s until an OpenClaw release OpenClaw-Publication: a0d8ceef-1330-427a-a145-c457ac53815f * Publish openclaw/mellow-barnacle OpenClaw-Publication: cb5ef89a-eb41-4019-9877-cd346fd9012f --------- Co-authored-by: obviyus <[email protected]>
Align downstream replay expectations with the explicit #196459 owner contract. Keep Fable 5 negative coverage, provider and API matrices, canonical deployment identity, and Bedrock consecutive-turn merging. Actual two-file regression run improves from three failures to 33 passes. Co-authored-by: obviyus <[email protected]>
…7225) Align downstream replay expectations with the explicit openclaw#196459 owner contract. Keep Fable 5 negative coverage, provider and API matrices, canonical deployment identity, and Bedrock consecutive-turn merging. Actual two-file regression run improves from three failures to 33 passes. Co-authored-by: obviyus <[email protected]>
Learn the Claude Code version required by Anthropic and retry OAuth requests once before stream consumption, rebuilding matching headers and billing identity. Persist the learned requirement through existing plugin state. Use the full catalog output cap for Claude 5 requests and honor listed server-compaction capabilities. Include the relevant strict unknown-Claude contract prerequisite: mandatory adaptive thinking, default sampling, no assistant prefill, refusal handling, and prefix-bound replay. Keep released legacy contracts and listed overrides. (cherry picked from commit 5426184) Prerequisite: 25cb583 (#196459) Release adaptation: Adapt both existing SDK and fetch request loops instead of importing the later unified lifecycle. Retain the release replay API, normalization, CLI discovery cache, and plugin-owned keyed-store contract. Exclude unrelated CLI alias migration. Preserve old parity fixtures and add wire-boundary coverage for retry, output, prefill and cross-model replay. Co-authored-by: obviyus <[email protected]> Co-authored-by: RomneyDa <[email protected]> Co-authored-by: vincentkoc <[email protected]> (cherry picked from commit 18ef7c55288d9256cd02f08b83797fbf2d5ff5ec)
…during compaction (#196550) * fix: reduce Gateway heap spikes during long-session compaction OpenClaw-Publication: 3c8ed9c2-cdf2-4a3e-9cfc-cb237d488ace * fix: reuse compaction facts without repeated transcript parsing OpenClaw-Publication: b899f5e4-7fb9-46f0-9b19-635e33a8b99c * Publish openclaw/keen-prawn OpenClaw-Publication: 33dc62a0-c779-4768-97d2-4b3fa2323cdf * Publish openclaw/keen-prawn OpenClaw-Publication: f8c0512a-6354-4487-b291-d85f50f68262 * fix: reconcile compaction regression-test allocation OpenClaw-Publication: 90ea6a98-3750-4df1-8f07-6333b0ba229c * fix(compaction): free the compaction worker during summary model calls * fix: match compaction concurrency test-line credit to its net growth * perf(compaction): check only captured rows before rerendering summary input * test: align worker containment and Claude fallback tests with main contracts main #194473 reworded the file-tool containment hint per source and #196756 compacted tool-result JSON; main #196459 gave unknown Claude ids mandatory adaptive thinking, so the non-reasoning fallback fixture uses a pre-Claude-5 id. * refactor(compaction): keep preflight metadata in its reader Co-authored-by: RomneyDa <[email protected]> * fix(compaction): detach bounded floor facts from transcript payloads Prevent small excerpts and identifier captures from retaining whole source strings while a compaction plan is cached. Add a GC retention regression for the owning producer. Co-authored-by: RomneyDa <[email protected]> * fix(workers): defer slow idle GC logging imports Keep the slow-GC diagnostic behind its own lazy operation boundary so small workers do not eagerly evaluate the logging graph. Preserve collection thresholds and warning fields. The existing production build gate reproduces 240 identity-worker modules on the base and passes at 203 after the repair (budget 220 unchanged). Full and sourcePerformance builds, 11 focused worker tests, infra typecheck, lint, and format checks pass. Independent native review found no actionable P0/P1/P2 findings; local autoreview was unavailable because Codex was not installed. Co-authored-by: RomneyDa <[email protected]> * fix: complete compaction wrapper inventory Co-authored-by: RomneyDa <[email protected]> --------- Co-authored-by: RomneyDa <[email protected]>
…during compaction (openclaw#196550) * fix: reduce Gateway heap spikes during long-session compaction OpenClaw-Publication: 3c8ed9c2-cdf2-4a3e-9cfc-cb237d488ace * fix: reuse compaction facts without repeated transcript parsing OpenClaw-Publication: b899f5e4-7fb9-46f0-9b19-635e33a8b99c * Publish openclaw/keen-prawn OpenClaw-Publication: 33dc62a0-c779-4768-97d2-4b3fa2323cdf * Publish openclaw/keen-prawn OpenClaw-Publication: f8c0512a-6354-4487-b291-d85f50f68262 * fix: reconcile compaction regression-test allocation OpenClaw-Publication: 90ea6a98-3750-4df1-8f07-6333b0ba229c * fix(compaction): free the compaction worker during summary model calls * fix: match compaction concurrency test-line credit to its net growth * perf(compaction): check only captured rows before rerendering summary input * test: align worker containment and Claude fallback tests with main contracts main openclaw#194473 reworded the file-tool containment hint per source and openclaw#196756 compacted tool-result JSON; main openclaw#196459 gave unknown Claude ids mandatory adaptive thinking, so the non-reasoning fallback fixture uses a pre-Claude-5 id. * refactor(compaction): keep preflight metadata in its reader Co-authored-by: RomneyDa <[email protected]> * fix(compaction): detach bounded floor facts from transcript payloads Prevent small excerpts and identifier captures from retaining whole source strings while a compaction plan is cached. Add a GC retention regression for the owning producer. Co-authored-by: RomneyDa <[email protected]> * fix(workers): defer slow idle GC logging imports Keep the slow-GC diagnostic behind its own lazy operation boundary so small workers do not eagerly evaluate the logging graph. Preserve collection thresholds and warning fields. The existing production build gate reproduces 240 identity-worker modules on the base and passes at 203 after the repair (budget 220 unchanged). Full and sourcePerformance builds, 11 focused worker tests, infra typecheck, lint, and format checks pass. Independent native review found no actionable P0/P1/P2 findings; local autoreview was unavailable because Codex was not installed. Co-authored-by: RomneyDa <[email protected]> * fix: complete compaction wrapper inventory Co-authored-by: RomneyDa <[email protected]> --------- Co-authored-by: RomneyDa <[email protected]>
What Problem This Solves
Fixes: Claude Fable 5.2 sessions hit a 400 (
Invalid signature in thinking block) on every tool loop, then lose their earlier reasoning, when the session runs through a proxy or custom Anthropic base URL. Any Claude model released after an OpenClaw version had the same problem until a release added its name.User Impact
User impact: a newly released Claude model works correctly with no OpenClaw update. Fable 5.2 keeps its reasoning across tool loops and model switches on every route, with no rejected requests.
temperature/top_p/top_k, no assistant prefill, and streamed-refusal handling. Older generations are a closed list that only ever shrinks. Live/v1/modelscapabilities still override the fallback where Anthropic lists them.claude-clialiases such asfable,opus, andsonnetnow resolve through Claude Code's own model menu. OpenClaw no longer keeps a copy of that alias table.Why This Change Was Made
Each fact now comes from the place that owns it:
/v1/modelscapabilities, Claude Code's initialize menu, or a closed list of released generations. A model name list no longer has to grow with every release. The table of every model-name branch, its origin, and its fact source is under Evidence.Evidence
Wire captures from a recording proxy in front of
api.anthropic.com. Each run was one real OpenClawagent --localsession with tool loops, using the model sequence Fable 5.2 ×2, Opus 5.5, Fable 5.2, Fable 5.1, Fable 5.2. The direct route keeps OpenClaw's realapi.anthropic.compath, sodrop_blockis sent. The custom route uses a configured base URL, as proxies do. "Strict" means the proxy forcesprefix_mismatch_behavior: "error", so any edit to earlier turns becomes a 400.prefix_binding_mismatchmodel_binding_mismatchinput_transformationsis[]on every request.cache_read_input_tokensgrows within each model stretch, for example 16,221 → 19,013 → 19,141 → 19,328 on Fable 5.2. It restarts only on a model switch, because the prompt cache is per model.claude-clisessions, routed through the same proxy before and after, strict mode: 0 × 400,input_transformations: [], growing cache reads. Claude Code owns that history, so OpenClaw was not the cause there.claude-fable-5-2by id and still mapsfable→claude-fable-5-1. OpenClaw now follows whatever the menu says.Tests:
claude-zzz-9-9, including the Bedrock and canonical-deployment forms, gets the strict contract. Released generations keep their answers.packages/ai, transport transform, replay helpers, and the anthropic, bedrock, vertex, foundry, and copilot extensions.main:provider-runtime.contract.test.tsdoctor hintsrc/agents/cli-runnerhistory/auth testscheck:changed: typecheck, lint, boundary, and import-cycle lanes pass. The formatting failure is fixed on this branch. Two lanes still fail, and the cause is outside this diff:625945b7ae01reports identical numbers, so this PR changes none of them.Inventory of Claude model-name branches
bindsClaudeThinkingPrefix)model_binding_mismatch)/v1/modelsthinking.types, fallback closed list/v1/modelsthinking.types.adaptive, fallback closed listclaude-clialiasesvalue→resolvedModel/v1/modelseffort(already)max_input_tokensandcontext_management)fable→ 5.1)