Skip to content

fix(codex): recover unused native threads without dropping history - #189900

Merged
roboclaw-bot merged 1 commit into
mainfrom
loop/contributor-pr-167873
Nov 1, 2026
Merged

roboclaw-bot merged 1 commit into
mainfrom
loop/contributor-pr-167873

Conversation

@roboclaw-bot

@roboclaw-bot roboclaw-bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Collaborator

Supersedes #167873, thanks @davelutztx.

What Problem This Solves

Fixes Codex conversations repeatedly failing with thread not loaded after an unused native thread disappears while its managed client and conversation binding remain.

User Impact

The next turn can create a fresh native thread and continue. Bindings with recorded conversation history remain intact when native state is missing, including after a client restart. Loaded threads without an owned inference route still fail closed. No configuration or migration is needed.

Why This Change Was Made

Move the inference ownership check onto the existing lifecycle status read, where exact missing-thread errors already reach recovery and its logged warning. Warm reuse without its inference route takes that same cold path before writes. The existing historyCoveredThrough marker prevents recovery from replacing a conversation with acknowledged history.

This removes the duplicate preflight thread/read: production +18/-22, net −4 lines. Regression tests/support grow by 66 lines; a separate 63-line allocation covers the counted test growth. No new state, dependency, or public contract.

Evidence

  • Reproduced on main edd9cd176a24: the managed unused-thread regression rejects with the exact thread/read error; the recorded-history-after-restart regression incorrectly starts a replacement. Both pass with this repair. Same-client history and loaded-unowned controls remain protected.
  • 168 focused tests passed across inference routing, lifecycle bindings, native configuration, and native-process recovery (51.48s wrapper wall time). The changed native-configuration file has 21 passing cases; its assertions take about 3s within the shared 22.37s database-worker shard.
  • Actual pinned Codex 0.164.0, isolated client and SQLite binding store: native deletion, replacement binding, and subsequent completed turn passed (926ms test time). Model responses use synthetic loopback HTTP. The managed-route regression uses the real client wire against synthetic app-server responses; no live Gateway or external model call is claimed.
  • Scoped typecheck, targeted typed lint, Oxfmt, and git diff --check passed. Hosted changed-node tests passed in 288s; baseline ratchets passed in 305s. These are shared job wall times, not isolated test-file cost. The optional local ratchet run reached its 45s host limit; hosted proof completed it.
  • Canonical autoreview: Codex GPT-6.1 Sol, medium reasoning, P0–P2, final local candidate against edd9cd176a24: scoped-clean, no actionable findings. pr-simplify completed.
  • Personally inspected native read_thread_view at Codex 6851fae57cf7306e1d7a093d334b1116d33ce5ad, codex-rs/app-server/src/request_processors/thread_processor.rs:2333–2388: absent live and persisted state produces the exact missing-thread error.

Contributor source was read with gh pr view / gh pr diff and was never checked out or executed. Human commit credit is preserved as Co-authored-by: Dave Lutz <[email protected]>.

@clawsweeper

clawsweeper Bot commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation extensions: codex size: S labels Nov 1, 2026
@roboclaw-bot
roboclaw-bot marked this pull request as ready for review November 1, 2026 00:36
@roboclaw-bot
roboclaw-bot merged commit e515a09 into main Nov 1, 2026
192 checks passed
@roboclaw-bot
roboclaw-bot deleted the loop/contributor-pr-167873 branch November 1, 2026 00:45
@roboclaw-bot

Copy link
Copy Markdown
Collaborator Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Nov 1, 2026
…ed-backup-search-exports-20261101

* commit 'cde4bfe4f10ce470ded7264c68d9a72ae03594cc':
  fix(ci): keep backup and chat search internals private (#189894)
  fix(codex): recover unused native threads without dropping history (#189900)
  fix(oc-path): use last duplicate JSON key to match runtime parsing (#189855)
  perf(test): parse the Mantis resolver workflow once (#189801)
  fix(agents): revert default hard context admission (#189891)
  refactor(test): use canonical tracked temp paths (#189800)
  chore(ui): refresh control ui locales (#189898)
  improve: show gateway commit and build time on About
  refactor(test): share SDK export fixture JSON writes (#189799)
  fix: restore Files navigation from unavailable previews (#189879)
  refactor(test): share raw ratchet fixture writes (#189798)
  fix(ai): honor Model Studio compatible-mode output limits (#189870)
  fix: hold queued messages through inline edits (#189869)
  perf(test): reuse the baseline fixture Node resolver (#189790)
  test(qa): correlate handoff replies by run identity (#189885)
  fix(ui): normalize canonical Unicode in local search comparisons (#189874)
  fix(ui): explain unsupported browsers without module scripts (#189883)

# Conflicts:
#	ui/src/pages/chat/components/chat-search-highlight.browser.test.ts
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation extensions: codex size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant