Repository navigation
fix(agents): preserve model errors during thinking recovery - #139295
Conversation
Require a named reasoning parameter before retrying with a different thinking level, preserving model/account failures and configured fallback decisions. Consolidate supported-value parsing. Related: #139246.
|
🦞👀 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: blocked before merge. Reviewed September 5, 2026, 2:59 PM ET / 18:59 UTC. ClawSweeper reviewWhat this changesRestricts thinking-level recovery to reasoning constraints or named thinking parameters, preserving unrelated provider errors and existing model fallback behavior. Merge readiness⛔ Blocked before merge - 1 item remains The fix remains necessary: current main and the latest release still retry unrelated unsupported errors with thinking disabled. No blocking patch defect was found. The related merged lifecycle repair addresses a distinct problem. Priority: P2 Review scores
Verification
How this fits togetherThe embedded agent runner processes failures from model requests, assistant responses, and compaction. Its shared recovery helper decides whether changing the thinking level can help before existing fallback or error handling proceeds. flowchart TD
A[Model request failure] --> D[Shared thinking recovery]
B[Assistant failure] --> D
C[Compaction failure] --> D
D --> E{Thinking parameter or constraint?}
E -->|Yes| F[Choose unattempted thinking level]
E -->|No| G[Existing fallback or original error]
Before merge
Agent review detailsSecurityNone. PR surfaceSource -11, Tests +37, Docs +5. Total +31 across 4 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep thinking recovery in the shared selector and preserve the existing fallback decision whenever the error does not identify a thinking constraint. Do we have a high-confidence way to reproduce the issue? Yes, from source: an account-restricted model error containing “not supported” selects off on current main before prompt handling reaches its fallback/error decision. Runtime reproduction was not executed. Is this the best way to solve the issue? Yes. Gating the shared selector repairs all three callers without duplicating exceptions or changing model-selection policy; the existing normalization helper preserves parsing behavior. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against ac53dc9687ca. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Live proof completed for The recording uses a real isolated Gateway, real Codex app-server, real Control UI, and real OpenAI inference. A loopback provider proxy injects the recorded account/model restriction once; subsequent inference requests go to OpenAI. Only synthetic conversation content appears in the inspected recording and screenshots. Observed request sequence:
There was no intervening thinking retry, no lower-effort request, and no false active-run error. The recording is 7.6 seconds. The empty startup screenshot was excluded from evidence; the attached result captures show the asserted states. Validation: 59 focused tests across the helper, prompt-failure, and assistant-failure suites; final parser cleanup rerun passed all 16 helper tests. New model/account/option and model-identifier regressions failed before their fixes. Independent Codex autoreview is clean at P0–P2. Full Production: +20/-31 (−11 lines). Tests: +42/-5. Docs: +5. No config, schema, protocol, or model-selection policy changes. attachment-646466118.mp4 |
|
Merged via squash.
|
Consolidate repeated classification, decision inputs, retry/log payloads and compaction dispatch while preserving retry policy and failure-mark ordering. Follow-up to #139295.
…#139295) Require a named reasoning parameter before retrying with a different thinking level, preserving model/account failures and configured fallback decisions. Consolidate supported-value parsing. Related: openclaw#139246.
) Consolidate repeated classification, decision inputs, retry/log payloads and compaction dispatch while preserving retry policy and failure-mark ordering. Follow-up to openclaw#139295.


Related: #139246
Additional instructions
Maintainers can edit this branch.
What Problem This Solves
Fixes an issue where a model rejected for the connected account was retried with thinking disabled. That unnecessary retry could replace the useful model-access error with a Codex lifecycle error, or delay configured model fallback. Unrelated provider options advertising values such as
highandlowcould also change thinking.Why This Change Was Made
The shared recovery helper now requires a reasoning constraint or a named thinking/reasoning parameter before selecting a replacement level. Model names containing those words cannot authorize recovery. The same helper serves prompt failures, assistant failures, and compaction. Supported-value parsing and candidate selection are consolidated.
The completed-thread ownership repair in #139246 remains the canonical Codex lifecycle fix. This change repairs the independent retry decision that exposed it. No config, schema, protocol, or fallback-selection policy changes.
User Impact
Model/account restrictions retain their original classification: configured defaults can advance to their existing fallback, while explicit model selections report the real failure. Genuine unsupported-thinking and mandatory-reasoning responses retain their existing recovery behavior.
Evidence
model_not_found, incorrectretry_thinking_level, then misleading active-thread failure. Private identifiers and original chat contents are omitted.pnpm buildpassed in Testbox, and exact-head CI passed all 108 executed checks. Local typechecking rejected the shared dependency symlink; hosted CI supplied complete type/lint/test gates.