Skip to content

fix(codex): let saved conversations recover after a remote failure - #201621

Merged
freeqaz-openai merged 2 commits into
mainfrom
codex/remote-codex-system-error-handoff
Nov 26, 2026
Merged

freeqaz-openai merged 2 commits into
mainfrom
codex/remote-codex-system-error-handoff

Conversation

@freeqaz-openai

@freeqaz-openai freeqaz-openai commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

After a failed turn on a remote Codex app-server, a saved conversation can become stuck when OpenClaw needs to apply a different configuration. The server can retain the failed runtime across WebSocket reconnects, preventing the conversation from resuming with the intended settings.

User Impact

When Codex confirms that the failed runtime has unloaded, OpenClaw asks the user to retry in the same saved conversation. Check the previous turn’s effects before retrying. Recovery does not automatically send another message.

If another subscriber keeps that thread loaded, OpenClaw explains that the competing subscription must end before recovery can proceed. Other conversations sharing the connection can continue.

Why This Change Was Made

OpenClaw unsubscribes from the affected thread and waits for Codex to unload it. After the last subscriber leaves, the idle delay defaults to 60 seconds in Codex 0.172.0 and 30 minutes in 0.164.0. A retained thread alone does not prove another subscriber is present.

The change keeps a bounded 70-second notification wait for remote connections, uses separate status reads to confirm unloading, and imports the shared 10-second teardown timeout.

The next message follows the existing cold-resume path and current policy checks. The protocol still separates reading thread status from resuming, so another subscriber can reload the thread between those operations.

Evidence

  • Tested the resolution at d2eda9c8 against b6a0808d on Node 24.22.1 with one worker. Other installed dependencies predate the lockfile, including fs-safe 0.27.1. Full validation on the current dependencies remains for CI.
  • All four WebSocket recovery fixture cases failed against the base in 149.6 seconds and passed with the fix.
  • All 14 adoption tests and two native handoff tests using a real Codex 0.172.0 app-server passed together in 169.6 seconds. The initial native attempt rejected the historical 0.169 binary before the correct binary was selected.
  • All 11 cancellation tests passed before the final documentation and comment edits.
  • Earlier checks on 49ffed78 included scoped typecheck, lint, format, and failure-renderer validation.
  • Independent native review identified one incorrect claim about the default delay, which was corrected and separately reviewed. Local autoreview could not start because of a host restriction.
  • The repository commit hook and git diff --check passed.

@clawsweeper

clawsweeper Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@freeqaz-openai
freeqaz-openai marked this pull request as ready for review November 19, 2026 04:50
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation extensions: codex size: M labels Nov 19, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 19, 2026
@clawsweeper

clawsweeper Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: passed.

What this changes

This PR unloads failed remote Codex runtimes before asking users to retry their saved conversation.

Example: A saved WebSocket conversation reaches systemError, then its developer instructions change.

  • Before: Repeated sends can fail configuration handoff because the remote server retains the failed runtime.
  • After: OpenClaw releases its subscription, confirms unloading, and asks the user to retry; the next send resumes the saved thread.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The implementation is focused and source-supported, but required proof of the changed behavior through the shipped product is absent.
Proof confidence 🧂 unranked krab (1/6) Real behavior proof is not required for maintainer- or bot-authored pull requests.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: A saved remote Codex conversation can repeatedly reject further messages after a failed turn when its configuration changes.
Reason: Recovering the existing conversation preserves user history, and the host-supplied maintainer-authored direction requires no renewed product approval.

Merge readiness

✅ Ready for maintainer review

Keep this PR open: it addresses a current saved-conversation recovery failure through the existing lifecycle owner, and no definite introduced correctness defect was found.

Reviewed head: d2eda9c8f7cebe2fcd9c49617de4c8588c243e3f

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: The PR author should provide redacted Gateway output or logs showing a real WebSocket systemError, confirmed unload, and an explicit retry completing on the same saved thread with history and changed instructions intact while sibling work continues; redact IPs, keys, phone numbers, and non-public endpoints.
Agent review details

How this fits together

The Codex plugin translates Gateway conversation requests into native app-server operations while preserving thread bindings, history, configuration checks, and sibling work.

flowchart TD
  A[Gateway conversation request] --> B[Codex lifecycle owner]
  B --> C[Saved thread binding]
  B --> D[Remote app-server]
  D --> E[Unload confirmation]
  E --> F[Retry notice]
  F --> B
Loading

Technical review

Best possible solution:

Keep recovery in the existing lifecycle owner, preserve the saved binding, and admit the explicit retry through current configuration and policy checks.

Do we have a high-confidence way to reproduce the issue?

Current-main configuration fencing and the inspected Codex Idle-only reload condition establish the failure path; no target code was executed during this read-only review.

Is this the best way to solve the issue?

The patch uses the existing subscription and resume owners, avoids replaying a potentially effectful message, and preserves unrelated work without adding configuration or persistent state.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 0bea7ecb3029.

Provenance checked

  • Remote configuration handoff keeps the original intent (a3a961b: Support remote unsubscribe-and-resume configuration refresh while preserving the conversation and sole-owner contract.)
  • Failed-thread recovery keeps the original intent (6d410b5: Recover settled failures through confirmed teardown without interrupting siblings or losing history.)
  • Native teardown observation keeps the original intent (90a1481: Wait for completed native closure before resuming changed configuration and preserve bindings when teardown remains uncertain.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit f5f44fa adds extensions/codex/src/app-server/thread-lifecycle-adoption.ts:277 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: f5f44faeca4e; files: extensions/codex/src/app-server/thread-lifecycle-adoption.ts)
  • Vincent Koc: Raw commit 90a1481 adds extensions/codex/src/app-server/thread-lifecycle-adoption.ts:321 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 90a14817215f; files: extensions/codex/src/app-server/thread-lifecycle-adoption.ts)
  • zhuyankarl: Raw commit 73c9e39 adds extensions/codex/src/app-server/thread-lifecycle-adoption.ts:325 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 73c9e39c619a; files: extensions/codex/src/app-server/thread-lifecycle-adoption.ts)

PR surface

Source +114, Tests +149, Docs +10. Total +273 across 7 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 4 144 30 +114
Tests 2 156 7 +149
Docs 1 11 1 +10
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 7 311 38 +273

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Review metrics

Metric Value Why it matters
Production versus test changes Production +144/-30; tests +156/-7 Growth implements remote release and confirmation within the existing owner; the four fixture outcomes protect distinct recovery, notification, activity, and policy behavior.

Labels

Label changes:

No label changes.

Label justifications:

  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Provide the remote failed-runtime recovery evidence described in testingReview.missingE2e.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (1 earlier review cycle)
  • reviewed 2026-11-19T05:07:05.388Z sha 49ffed7 :: needs maintainer review before merge. :: none

Reviewed November 26, 2026, 6:14 AM ET / 11:14 UTC (Revision 2).

@openclaw-barnacle openclaw-barnacle Bot added channel: discord Channel integration: discord channel: googlechat Channel integration: googlechat channel: imessage Channel integration: imessage channel: line Channel integration: line channel: matrix Channel integration: matrix channel: mattermost Channel integration: mattermost channel: msteams Channel integration: msteams channel: nextcloud-talk Channel integration: nextcloud-talk channel: nostr Channel integration: nostr channel: signal Channel integration: signal channel: slack Channel integration: slack channel: telegram Channel integration: telegram labels Nov 26, 2026
@freeqaz-openai

Copy link
Copy Markdown
Contributor Author

@clawsweeper review

@clawsweeper

clawsweeper Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@freeqaz-openai

Copy link
Copy Markdown
Contributor Author

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling app: android App: android app: ios App: ios app: linux app: macos App: macos app: web-ui App: web-ui channel: a2a channel: buzz channel: discord Channel integration: discord channel: feishu Channel integration: feishu channel: googlechat Channel integration: googlechat channel: imessage Channel integration: imessage channel: irc channel: line Channel integration: line channel: matrix Channel integration: matrix channel: mattermost Channel integration: mattermost channel: msteams Channel integration: msteams channel: nextcloud-talk Channel integration: nextcloud-talk channel: nostr Channel integration: nostr channel: qa-channel Channel integration: qa-channel channel: raft Channel integration: Raft channel: reef Channel integration: reef channel: signal Channel integration: signal channel: slack Channel integration: slack channel: sms Channel integration: sms channel: synology-chat channel: telegram Channel integration: telegram channel: tlon Channel integration: tlon channel: twitch Channel integration: twitch channel: voice-call Channel integration: voice-call channel: whatsapp-web Channel integration: whatsapp-web channel: x channel: zalo Channel integration: zalo channel: zalouser Channel integration: zalouser docker Docker and sandbox tooling docs Improvements or additions to documentation extensions: active-memory extensions: admin-http-rpc extensions: advisor extensions: agent-guidance extensions: autoreview AutoReview plugin and integration extensions: codex extensions: copilot-proxy Extension: copilot-proxy extensions: diagnostics-otel Extension: diagnostics-otel extensions: diagnostics-prometheus extensions: llama-cpp extensions: llm-task Extension: llm-task extensions: lobster Extension: lobster extensions: memory-core Extension: memory-core extensions: memory-lancedb Extension: memory-lancedb extensions: memory-wiki extensions: oc-path extensions: policy extensions: qa-lab extensions: tokenjuice Changes to the bundled tokenjuice extension extensions: vault Extension: vault gateway Gateway runtime P2 Normal backlog priority with limited blast radius. plugin: azure-speech Azure Speech plugin plugin: beam Beam session sharing plugin plugin: bonjour Plugin integration: bonjour plugin: celeris plugin: code-mode-quickjs plugin: cua-computer plugin: facetime FaceTime plugin plugin: fastino plugin: file-transfer plugin: gbrain plugin: geolocation Geolocation plugin (IP to coarse city) plugin: google-meet plugin: imap plugin: knowledge plugin: levanto Levanto Sage decision provider plugin: linux-node plugin: logbook Logbook automatic work journal plugin plugin: mcp-events plugin: mcp-relay plugin: migrate-claude plugin: migrate-hermes plugin: muse plugin: mxc plugin: nace plugin: onnx plugin: openclaw-id-access plugin: pixverse plugin: session-share plugin: skill-workshop plugin: slack-huddles plugin: subq SubQ Snap decision provider plugin: team-reports plugin: teams-meetings Teams Meetings plugin plugin: typesafe plugin: visitor-access plugin: workboard plugin: zoom Zoom plugin rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. scripts Repository scripts security Security documentation size: M status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant