Repository navigation
fix: validate Codex model references in Docker - #157175
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed September 24, 2026, 10:35 AM ET / 14:35 UTC (Revision 4). ClawSweeper reviewWhat this changesThe 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 provenancePossible 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 Review scores
Verification
How this fits togetherThe 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]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +9, Tests +166, Docs +5. Total +180 across 6 files. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Technical reviewBest 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. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (3 earlier review cycles)
|
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.
5ec9173 to
d39602a
Compare
* 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) ...
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]>
* 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
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]>
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-jsonvalidates 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-*.mjsimport consequently used plain package resolution.Commit 07435fa8ee2259f91b55964761058b4f22fba640 (#155159, September 21) introduced that shortcut between 9.5 and 9.6. The older
.setupsplit 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
--network none: pinned 9.6 browser digestsha256:62832668e3e5e139f745f7d3df892c9251eb53318b7d14a76c410dde1f25d730and plain 9.6 both fail with the missingopenclawpackage; the revised release-profile browser image printsDry 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.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.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.--mode branch --base origin/mainis 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.