Skip to content

fix: validate Codex model references in Docker - #157175

Merged
steipete merged 2 commits into
mainfrom
upd/docker-codex-setup-host-package
Sep 24, 2026
Merged

steipete merged 2 commits into
mainfrom
upd/docker-codex-setup-host-package

Conversation

@steipete

Copy link
Copy Markdown
Contributor

Fixes #157078

Thanks @sandra-peach for the exact offline Docker reproduction.

What Problem This Solves

Fixes host-package resolution errors when openclaw config set --dry-run --strict-json validates a Codex-backed model reference in the official Docker images.

User Impact

Both official 2026.9.6 Docker variants are affected. A global npm installation of 2026.9.6 is unaffected by this bundled-plugin failure because its package excludes bundled Codex. This fix should ride the next npm release so the next Docker images carry the corrected host loader.

The pre-existing Codex teardown linger noted in the issue remains a separate follow-up: the revised image completes validation, but its retained native process required stopping the test container. The process did not exit on its own.

Why This Change Was Made

The bypass was at src/plugins/provider-discovery.runtime.ts:111: active discovery used loadValidatedPublicSurfaceModule, whose compiled bundled-library path does not bind setup callbacks to their inventory's SDK resolver. The deferred .setup/native-auth-*.mjs import consequently used plain package resolution.

Commit 07435fa8ee2259f91b55964761058b4f22fba640 (#155159, September 21) introduced that shortcut between 9.5 and 9.6. The older .setup split remains valid. Compiled bundled discovery now uses the existing setup loader, and setup instances retain their cache through callbacks and cleanup. Source and external plugins keep their captured-runtime path. No dependency, configuration, schema, or Dockerfile changes are required.

Evidence

  • Exact reporter command with --network none: pinned 9.6 browser digest sha256:62832668e3e5e139f745f7d3df892c9251eb53318b7d14a76c410dde1f25d730 and plain 9.6 both fail with the missing openclaw package; the revised release-profile browser image prints Dry run successful. Codex is included, both host-package links are absent, and a bare setup-chunk import still fails without the loader resolver. The teardown limitation is recorded above.
  • Global npm 9.6 passes the command. The 9.5 image passes with a model shipped in its catalog; the reporter's newer model is unknown there.
  • Standalone pnpm build, with private QA entries enabled for the importer E2E: passed; zero [INEFFECTIVE_DYNAMIC_IMPORT] warnings. Docker build with the release plugin selections and CI settings also passed with zero such warnings.
  • pnpm check:changed --base 5037bd56ba44e0cd99c51586538824b3ca08aba5 -- <six changed files> passed on a Testbox, including all 25 core test typecheck graphs.
  • All 126 importer test files passed across 16 Vitest groups on the revised fix. The new native-Node case took 5.380 seconds in that run. pnpm test src/plugins/provider-discovery.capture-lifetime.test.ts --maxWorkers=1: all three tests passed, 12.672 seconds wall; the new case took 4.074 seconds. The subprocess is necessary to exercise native package resolution without Vitest SDK aliases.
  • Fresh Codex autoreview with --mode branch --base origin/main is scoped-clean at P0/P1.

The unchanged transcript-capture E2E took 45.592 seconds in the initial importer run (36.405 seconds of cold source loading and Gateway startup) and 67.494 seconds in the final run. A coherent compiled/shared warm harness is a follow-up; no assertions, timeouts, or proof tiers were weakened.

Change size: production +14/-5 lines; tests and test support +159; documentation +5.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation size: S labels Sep 24, 2026
@steipete
steipete marked this pull request as ready for review September 24, 2026 09:24
@clawsweeper

clawsweeper Bot commented Sep 24, 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.

@clawsweeper clawsweeper Bot added 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. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 24, 2026
@clawsweeper

clawsweeper Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 24, 2026, 10:35 AM ET / 14:35 UTC (Revision 4).

ClawSweeper review

What this changes

The branch uses the setup inventory to load packaged bundled provider discovery, retains host SDK resolution for deferred callbacks, and adds a native Node regression test and packaging guidance.

Regression provenance

Possible regression — suspected (failure trace). No predecessor PR is attributed.

Merge readiness

✅ Ready for maintainer review

Keep this PR open. Current main and the latest release retain the loader path behind the reported Docker failure, and the branch has focused regression coverage and reported Docker proof. The separately reported process-exit problem has its own PR.

Priority: P2
Reviewed head: d39602ab9036cd66192ee381f146c1d569799c22

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The focused loader repair has convincing Docker-path proof and native-resolution coverage; the known teardown limitation is separately tracked.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): The PR body reports the changed host loader exercised through the offline Docker config dry run: the released image failed resolving the host SDK from Codex's deferred setup chunk, while the revised image printed “Dry run successful.” Process exit remains a separately reported teardown problem. No stored-data contract changes.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The PR body reports the changed host loader exercised through the offline Docker config dry run: the released image failed resolving the host SDK from Codex's deferred setup chunk, while the revised image printed “Dry run successful.” Process exit remains a separately reported teardown problem. No stored-data contract changes.
Evidence reviewed 9 items Current-main behavior: Current main still selects the public-surface loader for a loaded provider-discovery entry without the compiled-bundled guard added by this PR.
Shipped-path check: The latest supplied release tag has the same loader branch reported to fail in the official Docker image.
Introduced loader selection: The PR directs compiled bundled discovery entries to the existing setup loader while retaining the prior path for other entries; the verified test merge carries this production change.
Findings None None.
Security None None.

How this fits together

The config CLI asks provider discovery to validate model references. A bundled plugin's discovery hook can later import OpenClaw SDK code; its result feeds the CLI's validation response.

flowchart LR
A[Config dry run] --> B[Model validation]
B --> C[Provider discovery]
C --> D{Compiled bundled plugin?}
D -->|Yes| E[Setup inventory loader]
D -->|No| F[Existing plugin path]
E --> G[Host SDK import]
F --> G
G --> H[Validation result]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +9, Tests +166, Docs +5. Total +180 across 6 files.

View PR surface stats
Area Files Added Removed Net
Source 3 14 5 +9
Tests 2 166 0 +166
Docs 1 5 0 +5
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 6 185 5 +180

Review metrics

Metric Value Why it matters
Production and test growth production +14/-5 lines; tests and test support +166 lines The narrow loader repair has a larger native-resolution fixture that exercises the failure boundary without Vitest SDK aliases.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #157078
Summary: This PR is the candidate fix for the reported Docker SDK-resolution failure. Native-process teardown is adjacent, distinct work.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Technical review

Best possible solution:

Land the inventory-owned loader fix with its native-resolution regression, and handle native-process teardown through #157323.

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

Yes. The linked report supplies an exact offline official-Docker command and failure, and current main retains the matching loader path; this read-only review did not execute the image.

Is this the best way to solve the issue?

Yes. Reusing the inventory-owned setup loader and its SDK scope addresses the failing import without adding a Docker package link or a parallel SDK contract.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 2701a4929621.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: The official Docker image's Codex-backed config validation is broken, with a limited affected workflow and a focused proposed repair.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The PR body reports the changed host loader exercised through the offline Docker config dry run: the released image failed resolving the host SDK from Codex's deferred setup chunk, while the revised image printed “Dry run successful.” Process exit remains a separately reported teardown problem. No stored-data contract changes.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body reports the changed host loader exercised through the offline Docker config dry run: the released image failed resolving the host SDK from Codex's deferred setup chunk, while the revised image printed “Dry run successful.” Process exit remains a separately reported teardown problem. No stored-data contract changes.

Evidence

What I checked:

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Ayaan Zaidi: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

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.

History

Review history (3 earlier review cycles)
  • reviewed 2026-09-24T09:34:39.528Z sha 4f75506 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-24T13:13:07.381Z sha 13f5c3ad3f231d949a6ff53870065aba7b7077d8 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-24T13:32:49.305Z sha 5ec91733012bc1389a1175fdad4e640cd7040782 :: needs maintainer review before merge. :: none

@steipete
steipete enabled auto-merge (squash) September 24, 2026 09:45
@steipete
steipete disabled auto-merge September 24, 2026 13:05
Restore Docker config model-reference validation by loading compiled bundled discovery through its inventory-owned setup loader and retaining that SDK scope for deferred callbacks. Reported by @sandra-peach in #157078.
@steipete
steipete force-pushed the upd/docker-codex-setup-host-package branch from 5ec9173 to d39602a Compare September 24, 2026 14:28
@steipete
steipete enabled auto-merge (squash) September 24, 2026 14:30
@steipete
steipete merged commit 33a1b08 into main Sep 24, 2026
199 checks passed
@steipete
steipete deleted the upd/docker-codex-setup-host-package branch September 24, 2026 14:50
vincentkoc added a commit that referenced this pull request Sep 24, 2026
* commit '9ccfc7d1bea21e34da48edbd54afd2e1be57db40': (89 commits)
  fix(exec): avoid gateway stalls during background task writes (#157177)
  test(cli): isolate preaction title setter state
  fix(test): synchronize Git backoff cancellation readiness (#157315)
  fix: validate Codex model references in Docker (#157175)
  fix(state): tolerate brief WAL coordinator contention (#157121)
  fix: unblock conversations after recovery preparation fails (#157214)
  test(telegram): avoid wall-clock pacing in HTTP conformance (#157281)
  fix: keep independent database work responsive under load (#157230)
  refactor(sqlite): centralize WAL checkpoint execution (#157263)
  improve(android): show tool outcomes in collapsed work (#156950)
  fix: remove tracked release scratch blocking source capture (#157308)
  test(update): remove legacy probe stream ordering race
  fix: preserve steering across reconnects and show queued input (#157135)
  fix(ui): keep typing focus when the GitHub reader opens (#157202)
  fix(ios): keep screenshot logs outside capture evidence
  test(codex): await startup teardown in lifecycle fixtures
  chore(ui): refresh control ui locales (#157311)
  refactor(memory): deslop memory plugins (#156867)
  refactor(test): share CLI diagnostics fixture setup (#157201)
  fix(release): retry notarization submit/wait on transport failures and name the resume command (#157116)
  ...
obviyus added a commit that referenced this pull request Sep 24, 2026
Closes #157309

## What Problem This Solves

Fixes `openclaw config set --dry-run --strict-json` hanging after successfully validating a Codex-backed model reference.

## User Impact

Successful validation exits normally without writing configuration or leaving the Codex app-server and its stdio pipes alive. Gateway and in-process plugin retirement keep their existing behavior. No configuration, defaults, public API, or Codex pool changes.

## Why This Change Was Made

The CLI cached a harness disposer but did not retain the executable registry resources behind it. Read-only model validation released those resources first, so terminal cleanup tried to call an already-retired plugin and never closed the native process.

The terminal CLI owner now borrows the registry's **existing physical resource claim** alongside the callback. Inspection release still fences ordinary calls. At command completion, the disposer uses existing host cleanup admission, then the CLI releases its physical claim. No admission is restored after physical disposal.

The earlier revision's retirement hook and shared disposal helper have been removed. In particular, retiring an in-process harness does **not** invoke Codex's build-global close-all operation. This avoids closing another live harness's shared client; process-terminal cleanup remains the only changed path.

This does not change the setup loader or overlap #157175, which fixes the independent Docker SDK resolution failure.

## Evidence

Real entry point, isolated state, no credentials:

```sh
openclaw config set agents.defaults.model.fallbacks '["openai/gpt-6-sol"]' --dry-run --strict-json
```

- Before, on `c707fa58`: printed `Dry run successful`, then remained alive until killed at 180 seconds (including a 47.9-second build). A second built-runtime run was still alive at 45 seconds. Stderr: `Codex agent harness dispose hook failed ... Plugin codex was reloaded or disabled; use its current tools.` Active-handle diagnostics identified the Codex app-server child and three stdio sockets. No configuration was written.
- Final terminal-only fix: compiled CLI exited **0 in 5.642 seconds**, with the same success output, **empty stderr**, and **no config file written**.
- Repeated Gateway negative control: isolated Gateway remained healthy with Codex loaded and native app-server children alive; `health` returned `ok: true`, no plugin errors, and a non-degraded model runtime. It exited 0 after explicit stop at 52.1 seconds. No authenticated inference was exercised.
- Regression: removing the terminal custody/admission changes makes the new inspection test fail because physical cleanup runs too early. With the fix, ordinary calls remain rejected after inspection release, terminal disposal executes once, and final physical cleanup completes.
- Shared-client regression: two in-process harness registrations share one close-all client fixture. Retiring one leaves the peer's catalog operation working. This is a deterministic ownership test, not a claim of two live native model turns.
- Focused registry, harness, and captured-package custody suites: **42 tests passed**, 25.67 seconds wall including cold preparation. The new cases took 12 ms and 3 ms. The supported development wrapper rebuilt the runtime successfully and passed its bootstrap import guard.
- Docker was unnecessary because the exact native handle leak reproduced locally. The independent Docker resolution failure is not claimed fixed here.

Co-authored-by: Ayaan Zaidi <[email protected]>
@roboclaw-bot roboclaw-bot mentioned this pull request Sep 24, 2026
2 of 8 tasks
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 25, 2026
* fix(plugins): preserve SDK scope for bundled discovery

Restore Docker config model-reference validation by loading compiled bundled discovery through its inventory-owned setup loader and retaining that SDK scope for deferred callbacks. Reported by @sandra-peach in openclaw#157078.

* test(plugins): statically link packaged discovery probe
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 25, 2026
Closes openclaw#157309

## What Problem This Solves

Fixes `openclaw config set --dry-run --strict-json` hanging after successfully validating a Codex-backed model reference.

## User Impact

Successful validation exits normally without writing configuration or leaving the Codex app-server and its stdio pipes alive. Gateway and in-process plugin retirement keep their existing behavior. No configuration, defaults, public API, or Codex pool changes.

## Why This Change Was Made

The CLI cached a harness disposer but did not retain the executable registry resources behind it. Read-only model validation released those resources first, so terminal cleanup tried to call an already-retired plugin and never closed the native process.

The terminal CLI owner now borrows the registry's **existing physical resource claim** alongside the callback. Inspection release still fences ordinary calls. At command completion, the disposer uses existing host cleanup admission, then the CLI releases its physical claim. No admission is restored after physical disposal.

The earlier revision's retirement hook and shared disposal helper have been removed. In particular, retiring an in-process harness does **not** invoke Codex's build-global close-all operation. This avoids closing another live harness's shared client; process-terminal cleanup remains the only changed path.

This does not change the setup loader or overlap openclaw#157175, which fixes the independent Docker SDK resolution failure.

## Evidence

Real entry point, isolated state, no credentials:

```sh
openclaw config set agents.defaults.model.fallbacks '["openai/gpt-6-sol"]' --dry-run --strict-json
```

- Before, on `fe85844d`: printed `Dry run successful`, then remained alive until killed at 180 seconds (including a 47.9-second build). A second built-runtime run was still alive at 45 seconds. Stderr: `Codex agent harness dispose hook failed ... Plugin codex was reloaded or disabled; use its current tools.` Active-handle diagnostics identified the Codex app-server child and three stdio sockets. No configuration was written.
- Final terminal-only fix: compiled CLI exited **0 in 5.642 seconds**, with the same success output, **empty stderr**, and **no config file written**.
- Repeated Gateway negative control: isolated Gateway remained healthy with Codex loaded and native app-server children alive; `health` returned `ok: true`, no plugin errors, and a non-degraded model runtime. It exited 0 after explicit stop at 52.1 seconds. No authenticated inference was exercised.
- Regression: removing the terminal custody/admission changes makes the new inspection test fail because physical cleanup runs too early. With the fix, ordinary calls remain rejected after inspection release, terminal disposal executes once, and final physical cleanup completes.
- Shared-client regression: two in-process harness registrations share one close-all client fixture. Retiring one leaves the peer's catalog operation working. This is a deterministic ownership test, not a claim of two live native model turns.
- Focused registry, harness, and captured-package custody suites: **42 tests passed**, 25.67 seconds wall including cold preparation. The new cases took 12 ms and 3 ms. The supported development wrapper rebuilt the runtime successfully and passed its bootstrap import guard.
- Docker was unnecessary because the exact native handle leak reproduced locally. The independent Docker resolution failure is not claimed fixed here.

Co-authored-by: Ayaan Zaidi <[email protected]>
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 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: 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.

[Bug]: 2026.9.6 Docker Codex setup cannot resolve host openclaw package

1 participant