Repository navigation
fix(codex): stop model fallback when native threads are active - #181204
Conversation
Classify claimed-thread refusals as global harness preflight failures and reuse the existing adoption authority check instead of its plain-error duplicate. Preserve actionable guidance and native thread ownership. Extend existing lifecycle coverage through the model fallback runner. Local test/lint execution is deferred to PR CI per maintainer host policy. Fixes #181046. Typed-error idea also appears in #176177 by @Stronggenetics. Co-authored-by: Stronggenetics <[email protected]>
|
🦞👀 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 SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b96e5b61a6
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
Codex review: needs maintainer review before merge. What this changesClassifies busy Codex thread refusals as global preflight failures so model fallback stops. Example: The native thread warm-background-policy-thread has active work when plugin policy changes.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR narrowly fixes a current-main fallback bug. No actionable findings remain, and exact-head CI passes. Priority: P2 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherThe Codex plugin prepares native threads before agent execution; its errors reach the core model-fallback runner, which decides whether another model should be attempted. flowchart TD
A[Agent turn] --> B[Codex thread preparation]
B --> C[Existing ownership guards]
C --> D[Global preflight refusal]
D --> E[Model fallback stops]
C --> F[Compatible thread reuse]
Technical reviewBest possible solution: Use the existing global preflight error at busy-thread refusals while preserving the binding and ownership guards. Do we have a high-confidence way to reproduce the issue? Current-main source establishes the protected-thread trigger, plain-error refusal, and fallback continuation; this read-only review ran no target code. Is this the best way to solve the issue? The producer-side classification is the smallest complete correction: the fallback owner already supports global preflight errors, and manual adoption already has the required typed claim check. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 5dce97b1362f. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource 0, Tests +8, Docs +5. Total +13 across 7 files. Added test files: 0. View PR surface stats
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. 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 HistoryReview history (1 earlier review cycle)
Reviewed October 22, 2026, 11:08 PM ET / October 23, 2026, 03:08 UTC (Revision 2). |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Merged via squash.
|
…law#181204) * fix(codex): stop model fallback when native threads are active Classify claimed-thread refusals as global harness preflight failures and reuse the existing adoption authority check instead of its plain-error duplicate. Preserve actionable guidance and native thread ownership. Extend existing lifecycle coverage through the model fallback runner. Local test/lint execution is deferred to PR CI per maintainer host policy. Fixes openclaw#181046. Typed-error idea also appears in openclaw#176177 by @Stronggenetics. Co-authored-by: Stronggenetics <[email protected]> * test(codex): keep active-thread regression on the public contract --------- Co-authored-by: Stronggenetics <[email protected]>
* fix(codex): stop model fallback when native threads are active Classify claimed-thread refusals as global harness preflight failures and reuse the existing adoption authority check instead of its plain-error duplicate. Preserve actionable guidance and native thread ownership. Extend existing lifecycle coverage through the model fallback runner. Local test/lint execution is deferred to PR CI per maintainer host policy. Fixes #181046. Typed-error idea also appears in #176177 by @Stronggenetics. Co-authored-by: Stronggenetics <[email protected]> * test(codex): keep active-thread regression on the public contract --------- Co-authored-by: Stronggenetics <[email protected]> (cherry picked from commit 20aecc9) Co-authored-by: Stronggenetics <[email protected]> Co-authored-by: RomneyDa <[email protected]> (cherry picked from commit e7cb8efb85614e20e168c2060229b17955cfe475)
Fixes #181046
Related: #176177 (broader change that also includes this typed error; it can drop that hunk after this lands)
What Problem This Solves
Fixes unnecessary model fallback when a Codex thread is still claimed by active work and a policy change needs to release it.
User Impact
OpenClaw preserves the thread and stops the fallback chain instead of attempting another model against the same busy thread. Wait for or stop the active work before retrying. The actionable diagnostic remains available under the existing error-detail settings; this change does not add public channel copy. No configuration or migration is required.
Why This Change Was Made
Use the existing global
AgentHarnessPreflightErrorcontract at the refusal producer, as the fallback owner already treats it as a coordination failure. Apply the same classification to the session-retirement sibling and remove manual adoption's duplicate plain-error check so its existing typed authority check owns the refusal. The warm-thread and retirement messages are unchanged; adoption retains the canonical wait-for-completion guidance.Thanks to @Stronggenetics for the typed-error idea in #176177. This separates that narrow correction from its broader native-tool catalog changes, following the coordination-error approach in #179347.
Evidence
Source/history confirmation on main
718bd3d69d293d992212bf1c4cc685d9551ddfc2:thread-lifecycle-warm.ts:215throws an ordinaryError; the fallback runner advances unknown failures but stops global harness preflight errors.The real warm-thread lifecycle regression requires an unscoped
AgentHarnessPreflightError, the original message, unchanged binding, and successful reuse under the original policy. Existing core fallback tests own the one-attempt/no-fallback contract for this public error type. Adoption and session-retirement cases now require typed refusals too.Local execution gap: host Node 26.12.0 is below the required 26.12.1, so
pnpm installwas refused. Per maintainer policy, local tests (including red/green runs), lint, formatting, and typecheck are deferred to PR CI. No local passing-test or timing claim. Live Gateway/channel e2e was skipped per maintainer policy.git diff --checkpasses. Simplification removed a duplicate claim check without adding new error classes, codes, fallback policy, or state. Exact numstat: production +9/-9 (net 0), tests +11/-3, docs +5/-0.Independent Codex branch autoreview through P2 completed
scoped-clean: no actionable findings. This is static review, not runtime proof.Merged fresh main
08b5a12ddd5173d2ef5e3e4668c94f748c77efb5without conflicts. The corrected patch is unchanged after integration; current head is498bb5772caa1fc09dadcf0d4103465a1599a763. Fresh full-candidate P0–P2 autoreview isscoped-cleanwith no actionable findings.Initial-head CI (
b96e5b6) passed the composed lifecycle-to-fallback regression (96 ms) and the adoption/retirement suites, but rejected its direct core import from an extension test. The follow-up keeps the regression on the public preflight contract; production is unchanged. The failed boundary job is 120203614256.Review scope: main already returns generic copy for this ordinary ownership error when external error details are disabled (
agent-runner-failure-reply.tsandrenderCodexAppServerFailureCopy). Curated non-verbose channel copy is a separate improvement; this PR preserves the existing diagnostic-disclosure behavior while fixing fallback classification.Current-head CI is green: run 39891710031 completed successfully on
498bb5772caa1fc09dadcf0d4103465a1599a763(28 successful jobs, 29 skipped). Lint, formatting, production/test types, boundary checks, and the CI gate pass. All 110 cases in the three changed suites pass; key CI case timings are 53 ms (warm refusal/reuse), 131 ms (claimed manual adoption), and 22 ms (retirement refusal). No local wall-time measurement is claimed under the host policy.