Repository navigation
fix(codex): recover conversations after unused native threads disappear - #167873
davelutztx wants to merge 1 commit into
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 changesThe Codex plugin lets a confirmed missing native conversation thread reach existing recovery instead of stopping during model-request preparation. Example: A user continues a conversation after its unused native thread disappears.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Blocked before merge - 1 item remains Keep this PR open: current main retains the recovery gap, and the companion restart PR does not supersede this useful repair. No actionable introduced defect was found. Priority: P2 Before merge
FindingsNone. Tests
Agent review detailsHow this fits togetherThe Codex plugin prepares model routing and native conversation threads before sending requests to the Codex app-server. Its lifecycle owner restores threads or creates replacements and saves their conversation bindings. flowchart LR
A[Authorized conversation request] --> B[Prepare model routing]
B --> C[Read recorded native thread]
C --> D{Exact missing-thread error?}
D -->|Yes| E[Existing lifecycle recovery]
D -->|No| F[Validate ownership or reject]
E --> G[Create and save replacement]
G --> H[Continue conversation]
Technical reviewBest possible solution: Keep thread replacement in the existing lifecycle owner while preserving exact missing-thread classification and current caller admission. Do we have a high-confidence way to reproduce the issue? Yes at source level: a retained managed-client binding whose native thread and routing entry disappeared receives the verified thread/read error before lifecycle recovery. The reported failing base regression was not executed in this read-only review. Is this the best way to solve the issue? Yes: accepting only the existing typed missing-thread classification at the premature probe is a narrow repair that preserves loaded-thread ownership checks and the existing replacement owner. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against b80da189bd42. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +14, Tests +87. Total +101 across 4 files. Added test files: 0. View PR surface stats
Review metrics
LabelsLabel changes: No label 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 9, 2026, 1:22 PM ET / 17:22 UTC (Revision 2). |
|
Thanks @davelutztx for identifying this recovery gap. The credited replacement is merged in #189900 (e515a09), with regressions for unused missing threads and preserving recorded history. Closing this in favor of that fix. |
Related: #158752
What Problem This Solves
Fixes Codex-backed conversations failing with
thread not loadedwhen native cleanup removes an unused thread but its OpenClaw binding and managed client remain.User Impact
The next authorized request can reach the existing stale-thread recovery and start a replacement thread. Loaded threads with an unowned inference route, ambiguous failures, and revoked or aborted requests still fail closed. No configuration changes or migration are required.
Why This Change Was Made
Inference preparation currently probes the recorded thread before the lifecycle owner's recovery boundary. An exact missing-thread response aborts that preparation even though the later lifecycle already knows how to recover it.
Reuse the existing typed
thread/readmissing-thread classifier, retaining caller admission and post-await revocation checks. Preparation does not mutate the binding or claim the absent thread; the lifecycle owner remains responsible for replacement.This complements #158752's conversation-binding restart recovery: the separate gap here is the managed inference preflight, not its conversation attachment or RPC classifier changes.
Evidence
a956835d020762cb2b570053af06f643a11c0ecc,codex-rs/app-server/src/request_processors/thread_processor.rs(read_thread_view): metadata-only reads return the exact invalid-request error when neither persisted nor live thread exists.startOrResumeThreadregression fails withthread not loaded: old-thread; the direct inference case also fails, while wrong-thread and wrong-code failures stay rejected.HOMEbut inheritedCODEX_HOME; that fixture now isolates both.tsgoand targeted Oxlint. Oxfmt, assertion-safety and line-cap ratchets, andgit diff --checkpass. Full-repository checks/build were not run for this narrow change.openclaw/ci-gate. Thechecks-node-changedjob took 422 seconds (17:05:10–17:12:12 UTC); this is lane wall time, not isolated per-file test cost.reviewer_unavailable, not a clean review verdict.