Skip to content

fix(codex): managed turns use the bundled app-server version - #124124

Merged
fuller-stack-dev merged 1 commit into
openclaw:mainfrom
fuller-stack-dev:fix/codex-managed-pinned-version
Aug 15, 2026
Merged

fuller-stack-dev merged 1 commit into
openclaw:mainfrom
fuller-stack-dev:fix/codex-managed-pinned-version

Conversation

@fuller-stack-dev

Copy link
Copy Markdown
Member

What Problem This Solves

Fixes an issue where ordinary Codex turns could fail their app-server version handshake in packaged installs that contained both the Codex plugin's current pinned binary and an older hoisted @openai/codex binary. The managed resolver selected the stale hoisted command first.

Why This Change Was Made

The Codex plugin now records the authoritative rootDir supplied by OpenClaw's plugin loader and resolves managed binaries from that owning package first. Existing ancestor/package fallbacks remain intact, so missing owner-local binaries still fall through safely; explicit command overrides and macOS desktop-first Computer Use ordering are unchanged.

This keeps bundle-layout policy in plugin discovery instead of reconstructing dist/extensions paths inside the resolver. It restores the ownership contract established by #71808, which assigned the managed app-server version to the Codex plugin.

User Impact

Packaged, upgraded, and fresh installs with mixed Codex dependency versions now start the extension-pinned app-server for ordinary managed turns instead of failing because an unrelated hoisted version is stale. Source installs, separately installed plugins, macOS desktop-first Computer Use, Linux, Windows, explicit overrides, and managed fallback behavior remain compatible.

Release note: Fixed packaged Codex managed turns selecting a stale hoisted app-server binary instead of the bundled plugin's pinned version.

Evidence

  • Exact-base red fixture: with extension-local 0.147.0 and hoisted 0.145.0 present, unmodified main selected the hoisted command and failed the 0.147.0 version requirement.
  • Focused resolver regression: 14/14 tests pass, covering registered bundled owner root, stale hoisted fallback, source and installed layouts, explicit overrides, desktop-first ordering, missing-local fallback, Linux, and Windows codex.cmd paths.
  • Source-blind behavior validation: 6/6 contract clauses pass.
  • Built Linux package proof: Blacksmith Testbox tbx_01m029b7p6eh5t71bak0zxtdtb selected dist/extensions/codex/node_modules/.bin/codex, reported codex-cli 0.147.0, completed initialize as 0.147.0, and never started the stale hoisted launcher. Run
  • Exact-head changed gate: extension production/test typechecks, changed-file lint/format, dependency and patch guards, plugin boundaries, dead exports, database-first guard, runtime sidecars, and import cycles passed on Blacksmith Testbox tbx_01m02a395r2vy4bk3fgf57wpw9. Run
  • Fresh autoreview: 0 findings; patch correct with 0.98 confidence.

@clawsweeper

clawsweeper Bot commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@clawsweeper clawsweeper Bot added merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P1 High-priority user-facing bug, regression, or broken workflow. 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. labels Aug 15, 2026
@clawsweeper

clawsweeper Bot commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 15, 2026, 5:07 AM ET / 09:07 UTC.

ClawSweeper review

What this changes

The PR records the Codex plugin root from the plugin loader and prefers that package’s managed app-server binary over a stale hoisted binary.

Regression provenance

Possible regression — suspected (reviewed change). No predecessor PR is attributed.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

Keep open for maintainer handling: the patch targets a source-proven packaged-layout defect, but the mandatory direct sibling Codex source check is unavailable in this read-only environment and the PR is maintainer-labeled.

Priority: P1
Reviewed head: 8c861aa85574fb1a308d5078826ac2d8d2ee7375
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The patch is focused, net-negative in production code, and paired with targeted regression coverage plus reported package proof; direct dependency inspection remains a maintainer gate.
Proof confidence 🌊 off-meta tidepool Not applicable: The external-contributor proof gate does not apply to this MEMBER-authored PR; its body nevertheless reports a linked real packaged Testbox initialization run.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The external-contributor proof gate does not apply to this MEMBER-authored PR; its body nevertheless reports a linked real packaged Testbox initialization run.
Evidence reviewed 8 items Current-main failure path: Current main derives candidate roots from the executing module location, so a shared bundled chunk can search the hoisted package before the owning plugin package.
Loader-owned root: The plugin registry builds the registration API with the selected record’s root directory, making it the authoritative package-ownership fact.
Proposed owner-boundary repair: The branch records that loader-owned root during plugin registration and uses it before the old inferred root fallback.
Findings None None.
Security None None.

How this fits together

The Codex plugin starts a managed app-server for agent turns. The plugin loader supplies the installed package root, which the binary resolver turns into the executable selected for startup and fallback.

flowchart LR
  A[Plugin loader] --> B[Plugin package root]
  B --> C[Managed binary resolver]
  D[Explicit command override] --> C
  C --> E[Ordered executable paths]
  E --> F[Codex app-server]
  F --> G[Agent turn]
Loading

Decision needed

Question Recommendation
Can a maintainer complete the required direct sibling Codex source check and confirm this exact-head package-selection change is safe to merge? Complete the direct Codex check: Review the matching Codex source and the exact-head package proof, then proceed if the app-server contract matches the resolver assumptions.

Why: Repository policy requires the acting reviewer to inspect the exact Codex source for dependency-backed app-server behavior, which this read-only environment cannot provide.

Before merge

  • Resolve merge risk (P1) - The required direct check of the pinned Codex app-server source cannot be completed because sibling ../codex is unavailable; a maintainer review in an environment with that checkout is needed before merge.
Agent review details

Security

None.

PR surface

Source -13, Tests +47. Total +34 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 2 15 28 -13
Tests 1 51 4 +47
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 66 32 +34

Review metrics

Metric Value Why it matters
Production vs tests production +15/-28 (net -13); tests +51/-4 (net +47) The repair simplifies the resolver while adding focused coverage for the packaged stale-hoist regression and fallback behavior.

Merge-risk options

Maintainer options:

  1. Verify package ownership at the exact head (recommended)
    Confirm the loader root and pinned Codex package contract in a dependency-capable environment before merging the precedence change.

Technical review

Best possible solution:

Keep the loader-provided package root as the canonical selection input, retain explicit overrides and managed fallbacks, and complete the direct Codex contract check against the exact PR head.

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

Yes, from source: a packaged plugin root with both a local and hoisted launcher makes current main search from the inferred module root, while the new focused fixture captures the corrected precedence. This review did not execute the fixture because repository review is read-only.

Is this the best way to solve the issue?

Unclear: using the loader’s authoritative package root is the clean owner-boundary repair rather than reconstructing distribution paths in the resolver, but the required direct Codex dependency check remains unavailable.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 160e368a8902.

Labels

Label changes:

  • add P1: Selecting a stale managed app-server can stop ordinary Codex-backed agent turns during initialization.
  • add merge-risk: 🚨 compatibility: The PR changes managed executable precedence for packaged and upgraded Codex plugin installations.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The external-contributor proof gate does not apply to this MEMBER-authored PR; its body nevertheless reports a linked real packaged Testbox initialization run.

Label justifications:

  • P1: Selecting a stale managed app-server can stop ordinary Codex-backed agent turns during initialization.
  • merge-risk: 🚨 compatibility: The PR changes managed executable precedence for packaged and upgraded Codex plugin installations.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The external-contributor proof gate does not apply to this MEMBER-authored PR; its body nevertheless reports a linked real packaged Testbox initialization run.

Evidence

What I checked:

Likely related people:

  • steipete: Current-main blame attributes the module-root resolver and candidate ordering to the shallow-history base commit. (role: current source contributor; confidence: medium; commits: 9050ff0e9e50; files: extensions/codex/src/app-server/managed-binary.ts, extensions/codex/index.ts)
  • pash-openai: Authored the merged managed app-server ownership work referenced by this PR. (role: original feature author; confidence: medium; commits: edb618c6c4a9; files: extensions/codex/src/app-server/managed-binary.ts)

Rank-up moves

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

  • Complete the required direct sibling Codex source inspection and refresh the exact-head review.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@fuller-stack-dev

Copy link
Copy Markdown
Member Author

Maintainer dependency gate completed for exact head 8c861aa85574fb1a308d5078826ac2d8d2ee7375.

I directly inspected OpenAI Codex tag rust-v0.147.0 (be6e8eac029b183056b7e4402879f15d2c85f61b):

  • codex-cli/bin/codex.js:10-14,79-96,182-198 derives the launcher package root, resolves the target-specific native package/executable, exports CODEX_MANAGED_PACKAGE_ROOT, and spawns that binary.
  • codex-rs/Cargo.toml:135-136 and codex-rs/app-server/Cargo.toml:1-9 establish app-server version 0.147.0.
  • codex-rs/app-server/src/request_processors/initialize_processor.rs:141-147 returns the app-server user agent during initialize, and codex-rs/login/src/auth/default_client.rs:159-170 constructs it with the Cargo package version.
  • OpenClaw pins @openai/codex 0.147.0 in extensions/codex/package.json:10-15 and enforces the reported version in extensions/codex/src/app-server/client.ts:993-1014.

This matches the resolver contract: select the owning plugin package launcher first, then let that launcher select its own native package. The linked packaged Testbox proof initialized the extension-local 0.147.0 app-server while a stale hoisted 0.145.0 was present: https://github.com/openclaw/openclaw/actions/runs/31875116337

Canonical main movement since the PR base (447393dc, 5419a706, 4a6f99c2) touches unrelated tests, gateway history, and agent terminal classification only, so no resolver proof was invalidated.

@fuller-stack-dev
fuller-stack-dev merged commit 40866f3 into openclaw:main Aug 15, 2026
101 checks passed
@fuller-stack-dev

Copy link
Copy Markdown
Member 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 maintainer Maintainer-authored PR merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S 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