Skip to content

fix(codex): keep remote workers when only the OpenClaw version changes - #206231

Merged
freeqaz-openai merged 2 commits into
mainfrom
fix/codex-remote-worker-upgrade
Nov 30, 2026
Merged

freeqaz-openai merged 2 commits into
mainfrom
fix/codex-remote-worker-upgrade

Conversation

@freeqaz-openai

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

Copy link
Copy Markdown
Contributor

What Problem This Solves

After an OpenClaw update, resume_agent can find a saved remote worker but send_input refuses its next task. Codex echoes the OpenClaw version in its user agent. That change alone can replace the native parent.

User Impact

An ordinary chat on the same authenticated remote WSS connection can reuse its worker. Pending assignments survive a later tool change that replaces the parent. Submission receipts stay with their original parent.

Why This Change Was Made

Rebuild the connection fingerprint from the live runtime with only the saved OpenClaw version substituted. Reuse the saved bytes only on a complete match. Supervision, restricted bindings and local connections keep their existing rules. See #206089 for local connections.

Evidence

The lifecycle regression reproduced the unwanted replacement on the parent commit. All 65 focused tests passed on the first commit (259.31 s). After correcting two indexed reads in the test for strict typechecking, the 22-case file passed again with one worker (163.24 s, 609 ms for the new case). Production code is unchanged. Formatting and type-aware lint passed. Local checks reused older dependencies.

Real Codex 0.164.0 with synthetic inference and a TLS-verified test hostname routed to loopback. Both builds included #193024 and identical packaging patches. Simulated the earlier client by changing only the version in its initialize request. Each forward comparison began with two completed worker turns.

Case Parent Next task Completed worker turns
Unchanged Same Completed 3
Client version changed, no repair Replaced Refused 2
Client version changed, repaired Same Completed 3
Return to previous client version Same Completed 4
New version and endpoint Replaced Refused 2
New version and credential Replaced Refused 2

After one Resume, the parent used the third answer and completed the goal in 9.14 s. The return started from that saved state.

Data-model compatibility with v2026.11.10

Built the release tag (6ea542fd) and this PR (b917e9cb) from unmodified source with cached dependencies. Both report 2026.11.10. These runs check previous-release data separately from the version change above. No runtime patches or edits to the handshake.

  • Gateway upgrade. Real Codex 0.164.0, remote WSS and synthetic inference. The release saved two completed turns on one worker and a paused goal. Both runs used tools.gatewayPolicy.allow set to get_goal, create_goal and update_goal. The candidate opened the copied settings, chat and worker history. One Resume kept the original native parent, verified both answers, used the same worker's third answer and completed the original goal in 8.24 s.
  • SQLite upgrade. A separate release process wrote two pending assignments, an unmatched submission receipt and a remote binding through the production stores. After the candidate's offline Agent database migration (schema 42 to 45 under the maintenance lease), the second process read the same owner, model, sandbox, approval settings and records. A wrong turn left the receipt intact. Exact consumption succeeded once, replay failed and both assignments remained.
  • Limits. With the broader tool policy, the release and PR advertised eight different declarations. The parent changed and the old worker refused new input. In a separate trial the parent completed the same saved goal using a fresh child. After that write, the release Gateway exited 78 on shared schema 42 (supports 40). Use a compatible recovery build. This PR changes neither tool-catalog checks nor database schemas.

Risks

An identical address and credential cannot prove physical server continuity. This trial did not qualify a deployment or a pair of release images. No new privileges, configuration options or migrations.

@clawsweeper

clawsweeper Bot commented Nov 26, 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 26, 2026 23:38
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. impact:session-state Session, memory, transcript, context, or agent state can drift or corrupt. clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 26, 2026
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 27, 2026
@clawsweeper

clawsweeper Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: passed.

What this changes

Preserve remote Codex parents and worker ownership when only the echoed OpenClaw version changes.

Example: A remote WSS worker has completed two turns when the OpenClaw client version changes.

  • Before: The parent is replaced and the worker refuses its third task.
  • After: The original parent resumes and the same worker completes its third task.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A worthwhile, focused repair with production-path comparisons and stable-release compatibility evidence; no blocking findings remain.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): The body records real Codex 0.164.0 through a Gateway over TLS-verified WSS with synthetic inference, showing worker reuse after a version-only change and rejection after endpoint or credential changes. Separate unmodified v2026.11.10-to-candidate Gateway and production-store upgrades preserve the saved parent, worker history, settings, assignments and exactly-once receipt consumption, resolving the prior upgrade-proof request.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: After an OpenClaw update, a saved remote worker can be found but cannot accept its next task because its native parent was replaced.
Reason: Preserving usable workers across a client-version-only update has clear value, and the supplied maintainer-authored direction authorizes this bounded compatibility repair.

Merge readiness

✅ Ready for maintainer review

Keep this PR open for landing: current main retains the reported failure, the repair is narrowly scoped, and the updated upgrade evidence resolves the previous review’s blocker. No actionable introduced defects were found.

Reviewed head: b917e9cb787428642ecb154147fc2a558335b606

Before merge

None.

Findings

None.

Agent review details

How this fits together

The Codex plugin compares live connection identity with saved thread bindings before resuming or replacing a parent; those bindings also identify pending worker assignments and submission receipts.

flowchart TD
  A[Gateway conversation] --> B[Live Codex runtime identity]
  B --> C[Remote version matcher]
  D[Saved thread binding] --> C
  C --> E[Existing thread lifecycle]
  E --> F[Resume or replace parent]
  F --> G[Assignment and receipt stores]
Loading

Technical review

Best possible solution:

Land the narrow version matcher while retaining existing lifecycle, assignment and receipt ownership rules.

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

Current main includes the echoed client version in remote binding identity and rotates on mismatch; the reported real-Codex control matches that source path, though this read-only review executed no target code.

Is this the best way to solve the issue?

The focused matcher fixes the version-only mismatch without rewriting stored ownership hashes or weakening unrelated connection and policy comparisons.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 5c815265d528.

Provenance checked

  • Remote runtime mismatch rotation changes intended behavior with a stated reason (bc5081c: Remote app-server support introduced initialized runtime identity to prevent reuse across different connections and runtimes.)
  • Assignment and receipt retention keeps the original intent (fix(codex): preserve native assignments across parent rotation #160952: Pending assignments must survive ordinary same-connection parent rotation while connection changes discard incompatible recovery ownership.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

  • Current-main failure remains: The runtime fingerprint includes the complete user agent, and remote identity mismatches trigger parent rotation; the fingerprint builder and lifecycle file are unchanged between the pinned merge base and fetched main. (extensions/codex/src/app-server/plugin-app-cache-key.ts:71, 5c815265d528)
  • Whole-fingerprint compatibility check: The matcher reconstructs the saved fingerprint by substituting only the OpenClaw version suffix; endpoint, credential fingerprint, Codex version, home, platform and workspace must still match. (extensions/codex/src/app-server/thread-remote-runtime.ts:69, b917e9cb7874)
  • Existing custody rules preserved: Assignments survive only matching connection ownership, while submission receipts additionally require the same native parent; retaining the original fingerprint bytes uses these existing owners. (extensions/codex/src/app-server/session-binding-record.ts:232, b917e9cb7874)
  • Upgrade evidence resolves prior blocker: The updated body describes unmodified v2026.11.10-to-candidate Gateway and SQLite upgrades preserving settings, native parent, worker history, pending assignments and receipt semantics; exact receipt consumption succeeds once and replay fails. Broader tool-catalog changes and rollback limitations are explicitly distinguished from this repair. (b917e9cb7874)
  • Production-path comparison and accepted limitation: The body reports real Codex 0.164.0 over TLS-verified WSS with synthetic inference, successful worker reuse, and endpoint/credential negative controls. It credits fix: goals stop after native child-result handoffs #193024 as a shared trial prerequisite and accepts that identical endpoint and credentials cannot establish physical-server continuity. (b917e9cb7874)
  • Authoritative dependency contract inspected: This patch depends on Codex initialize behavior: the sibling source formats the initializing client name and version as a user-agent suffix, and returns that user agent in InitializeResponse. (codex-rs/app-server/src/request_processors/initialize_processor.rs:128, 3d86e43b075a)

Likely related people:

  • Peter Steinberger: Raw commit 5367527 adds extensions/codex/src/app-server/thread-lifecycle.assignment-rotation.test.ts:39 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 5367527c2717; files: extensions/codex/src/app-server/thread-lifecycle.assignment-rotation.test.ts)

PR surface

Source +89, Tests +102. Total +191 across 3 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 2 89 0 +89
Tests 1 109 7 +102
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 198 7 +191

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.

Labels

Label changes:

No label changes.

Label justifications:

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

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-27T00:08:48.429Z sha b917e9c :: blocked before merge. :: none

Reviewed November 26, 2026, 8:01 PM ET / November 27, 2026, 01:01 UTC (Revision 2).

@freeqaz-openai

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Nov 27, 2026
@freeqaz-openai
freeqaz-openai merged commit 4666164 into main Nov 30, 2026
122 of 124 checks passed
@freeqaz-openai
freeqaz-openai deleted the fix/codex-remote-worker-upgrade branch November 30, 2026 08:53
@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

extensions: codex impact:session-state Session, memory, transcript, context, or agent state can drift or corrupt. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. 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