Repository navigation
fix(codex): recover failed conversations while sibling work continues - #172287
Conversation
|
🦞👀 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 real behavior proof before merge. What this changesThis PR waits for managed Codex threads to unload before resuming their history with refreshed instructions while sibling work continues. Example: Conversation A fails with HTTP 400 while conversation B remains active, then A receives NEW_POLICY_BETA.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Blocked before merge - 1 item remains This PR addresses a concrete recovery failure still present on main, and both previous findings are resolved; exact-head CI now passes. Priority: P1 Before merge
FindingsNone. Tests
Agent review detailsHow this fits togetherGateway chat sends enter the Codex plugin's thread lifecycle owner, which coordinates subscriptions, native configuration, and persisted bindings before admitting the next native turn. flowchart TD
A[Gateway chat send] --> B[Codex lifecycle owner]
B --> C[Release retained subscription]
C --> D[Confirm exact thread unload]
D --> E[Resume original thread]
E --> F[Apply current policy and start turn]
B --> G[Preserve active sibling ownership]
Technical reviewBest possible solution: Recover through the existing per-thread lifecycle owner, preserving native history and active siblings while retaining guarded whole-client replacement as fallback. Do we have a high-confidence way to reproduce the issue? Current-main sibling vetoes, the existing Gateway refusal scenario, and the personally inspected pinned Codex reload contract establish the failure path; no target code was executed during this review. Is this the best way to solve the issue? The revised implementation fixes the owning lifecycle boundary with an exact-thread unload receipt, bounded cancellation-aware waiting, and existing authority checks rather than interrupting the shared process. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 520302d8ee63. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +57, Tests +154, Docs +10. Total +221 across 13 files. Added test files: 0. View PR surface stats
Review metrics
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:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
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 15, 2026, 2:14 AM ET / 06:14 UTC (Revision 2). |
Wait for healthy and failed managed threads to unload before refreshing configuration, preserving the binding when teardown cannot be confirmed. Keep external/user-home retention and guarded shared-client replacement. Replace the added native test with focused lifecycle regressions and update Gateway recovery controls for same-client recovery and sibling survival. Fixes openclaw#172279. Original fix by @zhuyankarl in openclaw#172287. Proof: changed-file lint/format and isolated P2 autoreview; PR CI owns tests and typechecks per maintainer policy. Live proof intentionally skipped. Co-authored-by: zhuyankarl <[email protected]>
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Merged via squash.
|
73c9e39 (#172287) requires confirmed unloading before managed thread resume. Report an unloaded thread in the startup fixture so the exact overload error and binding/shared-client preservation checks run. 14eee34 (#171218) disables native shell features alongside code mode. Include both flags in the complete bounded-media request expectations. Repair latent red-main failures exposed by PR #172381, CI run 38696213621. Static oxlint, oxfmt, whitespace checks, and isolated P0-P2 review pass. Test and typed-lint proof use PR CI because local preparation timed out.
…openclaw#172287) * fix(codex): recover failed conversations while sibling work continues * fix(codex): coordinate managed thread teardown before recovery Wait for healthy and failed managed threads to unload before refreshing configuration, preserving the binding when teardown cannot be confirmed. Keep external/user-home retention and guarded shared-client replacement. Replace the added native test with focused lifecycle regressions and update Gateway recovery controls for same-client recovery and sibling survival. Fixes openclaw#172279. Original fix by @zhuyankarl in openclaw#172287. Proof: changed-file lint/format and isolated P2 autoreview; PR CI owns tests and typechecks per maintainer policy. Live proof intentionally skipped. Co-authored-by: zhuyankarl <[email protected]> * test(codex): update managed recovery fixtures and clocks --------- Co-authored-by: zhuyankarl <[email protected]> Co-authored-by: Peter Steinberger <[email protected]>
…172947) 96ccbf0 (openclaw#172287) requires confirmed unloading before managed thread resume. Report an unloaded thread in the startup fixture so the exact overload error and binding/shared-client preservation checks run. 323baf4 (openclaw#171218) disables native shell features alongside code mode. Include both flags in the complete bounded-media request expectations. Repair latent red-main failures exposed by PR openclaw#172381, CI run 38696213621. Static oxlint, oxfmt, whitespace checks, and isolated P0-P2 review pass. Test and typed-lint proof use PR CI because local preparation timed out.
…#172287) * fix(codex): recover failed conversations while sibling work continues * fix(codex): coordinate managed thread teardown before recovery Wait for healthy and failed managed threads to unload before refreshing configuration, preserving the binding when teardown cannot be confirmed. Keep external/user-home retention and guarded shared-client replacement. Replace the added native test with focused lifecycle regressions and update Gateway recovery controls for same-client recovery and sibling survival. Fixes #172279. Original fix by @zhuyankarl in #172287. Proof: changed-file lint/format and isolated P2 autoreview; PR CI owns tests and typechecks per maintainer policy. Live proof intentionally skipped. Co-authored-by: zhuyankarl <[email protected]> * test(codex): update managed recovery fixtures and clocks --------- Co-authored-by: zhuyankarl <[email protected]> Co-authored-by: Peter Steinberger <[email protected]> (cherry picked from commit 73c9e39) Co-authored-by: RomneyDa <[email protected]>
Fixes #172279. Follow-up to #149000.
What Problem This Solves
Fixes repeated Codex conversation recovery failures after a provider error when another thread keeps the shared app-server active.
User Impact
A failed conversation can resume its original thread and history with refreshed instructions while sibling work continues. Healthy conversations also wait for asynchronous teardown before resuming. User-owned Codex homes and external proxy/socket connections retain their native retention settings. Provider rate limits still apply.
Why This Change Was Made
OpenClaw already owns warm subscription retention and child-work protection. Managed local agent-home app-servers now launch with
thread_unload_delay_secs=0. The lifecycle owner waits for the matchingnotLoadednotification for up to two seconds, aborting with the run. Missing confirmation preserves the binding; the existing guarded whole-client replacement remains available for settled failures only when no sibling work would be interrupted.Original fix by @zhuyankarl; maintainer cleanup coordinates healthy-thread teardown, preserves external connection behavior, replaces the expensive new native test with focused lifecycle cases, and updates the existing Gateway recovery controls.
Evidence
PR CI is the test and typecheck gate per maintainer policy. Live proof, local tests, local typechecks, and production-revert negative controls were intentionally skipped. No local Gateway or remote lease was started. The first exact-head run 38683475836 exposed fixture typing, stale managed-unload state, and replacement-clock failures. Those PR-caused failures are corrected in the follow-up commit; no inherited-failure exception is claimed. Final-head CI run 38684859899, attempt 2, head
76dca1a1833811b94c600216cd1176347523c256: 37 jobs passed, including production/test typechecks, lint, and the affected extension suites. Four affected test shards passed 663 tests across 36 files (122 binding/lifecycle, 134 auth/startup, 193 run-attempt, 214 extension tests).CI infrastructure blocker: three jobs still failed in Set up job, before checkout or test execution, because GitHub could not download
actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e(HTTP 404): changed tests, job 116260133227, Gateway, job 116260133434, and compact-large-13, job 116260133501. One diagnosed infrastructure retry used the workflow's supported GitHub-hosted fallback; these three downloads still failed. The aggregate gate remains red, so this PR is not yet land-ready. No inherited code-failure exception or maintainer acceptance is claimed.preserves managed $nativeStatus history across $outcome with sibling=$siblingin the existingthread-lifecycle.binding.test.tssuite: failed/healthy unload, unrelated notification rejection, timeout with/without sibling protection, and abort. Uses the real RPC client/lifecycle with synthetic responses and fake timers.owns unload retention only for managed local starts: $transport/$homeScope/proxy=$proxyinauth-bridge.test.ts, including explicit native retention settings and user-home/proxy/WebSocket/Unix exclusions.server.codex-failure-recovery.test.tsnow expects same-thread/same-client recovery, changed instructions, preserved history, and sibling completion. Replacement/cancellation/unconfirmed-exit controls explicitly retain the native cache; no serial config or worker pin was added.oxfmtand staticoxlintpassed. Lint ran from clean trusted main using its rules with only the nonmatchingui/**/*.tsxSolid-plugin override omitted because that unrelated dependency is absent. No install was run.git diff --checkpassed.Native dependency contract
Personally inspected the sibling Codex source at
rust-v0.160.0, commit a956835d020762cb2b570053af06f643a11c0ecc, matching the plugin's@openai/codex0.160.0pin:core/src/config/mod.rs:3911–3919readsthread_unload_delay_secs; the release default is 60 seconds, correcting the issue's 1,800-second description. Zero is supported.thread_processor.rs:4336–4385reloads changed overrides only with no subscribers,Idle, and no running agent; settledSystemErrordoes not qualify.3650–3659rejects a thread whose asynchronous unload is pending.thread_lifecycle.rs:363–394schedules idle unsubscribe teardown;434–457awaits shutdown and removes the thread.thread_status.rs:333–347produces the exact-threadnotLoadednotification, emitted at242–247.Review decisions and scope
ClawSweeper's healthy teardown P1 and outdated Gateway controls P2 are addressed above. Its additional live-proof asks are intentionally deferred: PR CI is the proof per maintainer policy. The managed-server retention policy is the requested fix scope; it adds no OpenClaw option and excludes user-home/external ownership. No separate approval is claimed.
The wait captures the exact physical client, thread ID, binding lease, and initial native status. Current host/run/client authority is checked after the wait and before native writes; the binding remains serialized by its existing owner. Replacement eligibility reads current leases, pending acquisitions, sibling claims, and routes after waiting. Configuration is built after the wait or remains bound to the current turn's existing preparation authority. There is no detached recovery task, new path, or new retention store.
Production is net +57 lines versus main: the bounded notification/abort handoff and shared launch-scope rule need these additions; no unrelated deletion is used to meet the campaign LOC target. Final numstat: production +60/−3 (net +57), tests +239/−85 (net +154), docs +10/−0 (net +10); total +309/−88 (net +221) across 13 files. Compared with the contributor patch, maintainer cleanup removes 142 lines overall.