Repository navigation
fix(doctor): prevent Codex registration failures during checks - #170445
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. |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Codex review: needs maintainer review before merge. What this changesPrepare runtime config before Doctor contributions register plugins. Example: Run openclaw doctor --fix --non-interactive with the bundled Codex plugin enabled.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR fixes a current Doctor failure with a focused change; no actionable defects remain, and the earlier review requests are satisfied. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherDoctor passes its inspected configuration through the existing runtime snapshot owner before runtime-backed plugin checks consume it. flowchart LR
A[Doctor CLI] --> B[Config inspection and repair]
B --> C[Runtime snapshot preparation]
C --> D[Doctor contributions]
D --> E[Plugin registration]
E --> F[Doctor findings and exit status]
Technical reviewBest possible solution: Use Doctor’s existing runtime-config owner to prepare plugin checks while preserving strict runtime reads. Do we have a high-confidence way to reproduce the issue? The strict getter and Doctor ordering establish the failure path, supported by the contributor’s observed base/candidate CLI comparison; no target code was executed during this review. Is this the best way to solve the issue? The change repairs missing preparation at the Doctor owner, preserves the intended strict reader, and avoids plugin-specific fallbacks. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against d70a7e7300cd. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +2, Tests +47. Total +49 across 2 files. Added test files: 0. View PR surface stats
Review metrics
LabelsLabel changes:
Label justifications:
Rating scale6/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. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (1 earlier review cycle)
Reviewed October 12, 2026, 9:40 PM ET / October 13, 2026, 01:40 UTC (Revision 2). |
|
Marked ready for review (no landing requested). Added redacted observed base/candidate Doctor output, exit codes, and candidate Gateway @clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Landed in 5043798. Thanks for the review! The isolated Doctor reproduction now completes without Codex registration errors, and Gateway Codex registration remains healthy. |
The equivalent runtime preparation fix and regression landed in #170445. Remove this branch’s overlapping implementation and test so the PR only adds its standalone Doctor documentation clarification. Keep the original update proof in the PR body.
* fix(doctor): prepare runtime config before plugin health checks Publish the prepared Doctor config through the existing runtime snapshot owner before health contributions register plugins. Preserve an existing process snapshot and keep strict runtime readers intact. Fixes the regression from #169714 exposed by standalone Doctor after updates. Add real plugin-registration regression coverage and document the standalone update flow. * docs(doctor): retain post-update guidance after runtime fix The equivalent runtime preparation fix and regression landed in #170445. Remove this branch’s overlapping implementation and test so the PR only adds its standalone Doctor documentation clarification. Keep the original update proof in the PR body. Co-authored-by: Peter Steinberger <[email protected]>
…law#170445) ## What Problem This Solves Fixes: `openclaw doctor --fix --non-interactive` exits with a Codex plugin registration error when runtime config has not yet been prepared. ## User Impact Doctor can inspect enabled Codex tools without reporting `Runtime config is not prepared` as a plugin failure. No configuration, schema, permissions, defaults, or plugin API changes. ## Why This Change Was Made Doctor already owns the repaired configuration, but its contribution checks can register plugins before publishing that configuration for runtime readers. Prepare it through the existing async runtime-config owner after the config flow and before contributions. This preserves the strict runtime reader introduced in openclaw#169714 rather than adding a fallback to Codex or the plugin runtime. No overlap with Pash/Sarah changes in the changed files. ## Evidence - Built base `71a78573e336` and candidate `ddd777e2c8c9` with `pnpm build`. - Real `pnpm openclaw --profile <isolated-profile> doctor --fix --non-interactive --no-workspace-suggestions`: base reported Codex registration failures and exited **1**; candidate completed with no plugin load error and exited **0**. Each run confirmed its own config, state, and database paths first. The fixture uses an enabled bundled Codex plugin and a local static model definition; no live user state. - Started a separate candidate Gateway. Its live `plugins.list` RPC reported Codex runtime state **active**. Stopped the Gateway afterward. - Regression test fails before the fix (plugin status `error`), then all **3 tests pass** in `pnpm test src/flows/doctor-health.plugin-load.test.ts --maxWorkers=1` (29.19s runner wall time, 25.23s Vitest duration). Targeted Oxfmt and Oxlint pass. - Simplification pass: one existing publication owner, no fallback or new abstraction. Production **+2/-0** lines; tests **+47/-0**. The two production lines are the import and required preparation call. - No model request or channel-delivery path changed; real-provider/channel checks are not applicable. The separate `update repair` wrapper was not exercised; its Doctor checks use this same flow. <details> <summary>Observed terminal evidence (paths redacted; unrelated warnings omitted)</summary> Base `71a78573e336`, after the initial legacy fixture was repaired and a local static model definition was configured so tool-schema inspection runs: ```text $ pnpm openclaw --profile pdoctorcodexbase doctor --fix --non-interactive --no-workspace-suggestions [plugins] codex failed during register from <worktree>/dist/extensions/codex/index.js: Error: Runtime config is not prepared. Await captureRuntimeConfigAsyncReader()() first. [error] core/doctor/workspace-status plugins.entries.codex - Plugin codex: plugin failed during register: Error: Runtime config is not prepared. Await captureRuntimeConfigAsyncReader()() first. (<worktree>/dist/extensions/codex/index.js) └ Doctor finished with plugin load errors. EXIT_CODE=1 ``` Candidate `ddd777e2c8c9`, same configuration with separate state, home, workspace and port: ```text $ pnpm openclaw --profile pdoctorcodexcand doctor --fix --non-interactive --no-workspace-suggestions └ Doctor complete. EXIT_CODE=0 ``` Candidate Gateway, started with `pnpm openclaw --profile pdoctorcodexcand gateway run --port 19644 --bind loopback`: ```text [gateway] ready $ pnpm openclaw --profile pdoctorcodexcand gateway call plugins.list --json ``` Codex entry excerpt from the live RPC response: ```json {"id":"codex","runtime":{"state":"active"}} ``` ```text [gateway] received SIGTERM; shutting down [shutdown] completed cleanly in 120ms ``` </details> Merge danger: **two-way door**; a revert fully removes this change. No new persisted representation or migration. Blast radius is Doctor's runtime-backed plugin checks; Gateway startup is unchanged and was smoke-tested with Codex enabled. Co-authored-by: Ayaan Zaidi <[email protected]>
* fix(doctor): prepare runtime config before plugin health checks Publish the prepared Doctor config through the existing runtime snapshot owner before health contributions register plugins. Preserve an existing process snapshot and keep strict runtime readers intact. Fixes the regression from openclaw#169714 exposed by standalone Doctor after updates. Add real plugin-registration regression coverage and document the standalone update flow. * docs(doctor): retain post-update guidance after runtime fix The equivalent runtime preparation fix and regression landed in openclaw#170445. Remove this branch’s overlapping implementation and test so the PR only adds its standalone Doctor documentation clarification. Keep the original update proof in the PR body. Co-authored-by: Peter Steinberger <[email protected]>
What Problem This Solves
Fixes:
openclaw doctor --fix --non-interactiveexits with a Codex plugin registration error when runtime config has not yet been prepared.User Impact
Doctor can inspect enabled Codex tools without reporting
Runtime config is not preparedas a plugin failure. No configuration, schema, permissions, defaults, or plugin API changes.Why This Change Was Made
Doctor already owns the repaired configuration, but its contribution checks can register plugins before publishing that configuration for runtime readers. Prepare it through the existing async runtime-config owner after the config flow and before contributions. This preserves the strict runtime reader introduced in #169714 rather than adding a fallback to Codex or the plugin runtime.
No overlap with Pash/Sarah changes in the changed files.
Evidence
f9d5447c5946and candidateddd777e2c8c9withpnpm build.pnpm openclaw --profile <isolated-profile> doctor --fix --non-interactive --no-workspace-suggestions: base reported Codex registration failures and exited 1; candidate completed with no plugin load error and exited 0. Each run confirmed its own config, state, and database paths first. The fixture uses an enabled bundled Codex plugin and a local static model definition; no live user state.plugins.listRPC reported Codex runtime state active. Stopped the Gateway afterward.error), then all 3 tests pass inpnpm test src/flows/doctor-health.plugin-load.test.ts --maxWorkers=1(29.19s runner wall time, 25.23s Vitest duration). Targeted Oxfmt and Oxlint pass.update repairwrapper was not exercised; its Doctor checks use this same flow.Observed terminal evidence (paths redacted; unrelated warnings omitted)
Base
f9d5447c5946, after the initial legacy fixture was repaired and a local static model definition was configured so tool-schema inspection runs:Candidate
ddd777e2c8c9, same configuration with separate state, home, workspace and port:Candidate Gateway, started with
pnpm openclaw --profile pdoctorcodexcand gateway run --port 19644 --bind loopback:Codex entry excerpt from the live RPC response:
{"id":"codex","runtime":{"state":"active"}}Merge danger: two-way door; a revert fully removes this change. No new persisted representation or migration. Blast radius is Doctor's runtime-backed plugin checks; Gateway startup is unchanged and was smoke-tested with Codex enabled.