Keep core doctor health in contribution order#86627
Conversation
|
@clawsweeper review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
ClawSweeper review: did not complete due to Codex infrastructure failure. Reviewed June 20, 2026, 1:57 PM ET / 17:57 UTC. Summary PR surface: Source -91, Tests +664, Docs +2, Other +1. Total +576 across 14 files. Reproducibility: unclear. The review failed before ClawSweeper could establish a reproduction path. Review metrics: none identified. Stored data model Merge readiness This is a ClawSweeper/Codex infrastructure failure, not a PR readiness or patch-quality verdict. Risk before merge
Maintainer options:
Next step before merge
Review detailsBest possible solution: Retry the Codex review after fixing the execution failure. Do we have a high-confidence way to reproduce the issue? Unclear. The review failed before ClawSweeper could establish a reproduction path. Is this the best way to solve the issue? Unclear. Retry the review first so ClawSweeper can evaluate the actual issue and fix direction. AGENTS.md: unclear because the file could not be read completely. Codex review notes: model internal, reasoning high; reviewed against e1fc4683bb9d. Label changesLabel changes:
Evidence reviewedPR surface: Source -91, Tests +664, Docs +2, Other +1. Total +576 across 14 files. View PR surface stats
What I checked:
Likely related people:
How this review workflow works
|
|
ClawSweeper PR egg ✨ Hatched: 🥚 common Neon Test Hopper Hatch commandComment Hatchability rules:
Rarity: 🥚 common. What is this egg doing here?
|
4df9d7e to
5102ad1
Compare
581f965 to
3d02e2c
Compare
|
@clawsweeper review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
3d02e2c to
71b8c16
Compare
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
Maintainer acceptance for final landing: I accept the ordered-core doctor health boundary in this PR, including reserving the |
|
@clawsweeper re-review Rebased #86627 onto current Maintainer compatibility acceptance is recorded above for the reserved Local validation after this rebase:
Please let exact-head GitHub checks gate final merge. |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
@clawsweeper re-review Rebased #86627 again onto current Local validation on this exact head:
Earlier after today's rebase loop, |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
@clawsweeper re-review Rebased #86627 onto current Validation after this final rebase:
Earlier today in the same rebase loop, |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
@clawsweeper re-review Rebased #86627 onto current Validation after this rebase:
Focused doctor Vitest passed earlier in this same rebase loop, and the prior exact head reached |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
@clawsweeper re-review Rebased #86627 onto current Validation after this rebase:
Maintainer compatibility acceptance for the reserved |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
@clawsweeper re-review Rebased #86627 onto current Validation after this rebase:
Maintainer compatibility acceptance for the reserved |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
@clawsweeper re-review Rebased #86627 onto current Validation after this rebase:
Maintainer compatibility acceptance for the reserved |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
Merged via squash.
Thanks @giodl73-repo! |
Summary
This PR integrates structured health checks with the ordered core doctor checks. The goal is to make it cheap and safe to add structured findings, dry-run previews, and diff/effect reporting to existing doctor rules without moving those rules out of the doctor order that already works.
The model is:
resolveDoctorHealthContributions()/createDoctorHealthContribution(...), which remains the source of truth foropenclaw doctorandopenclaw doctor --fixorderinghealthChecksdirectly; for a single inline check the factory derivesid,kind: "core",source: "doctor", andhealthCheckIdsrun, that legacy path remains authoritative for normaldoctorand realdoctor --fixmutationrunis still present, the structured health check should usually adddetect; any structuredrepair/ structuredrunshould be preview-only for dry-run, diff, and effect reportingrunis deliberately removed; then the old repair behavior is called from the structured health check andhealthChecksowns the contribution execution pathdoctor --lintruns structured core checks in contribution order first, then appends non-core bundled/plugin registry checksThat gives us the migration ladder we wanted: keep existing doctor repair behavior in place while adding structured lint/dry-run/diff data, then move the old repair behavior behind
healthChecksonly when that specific core contribution is ready for full structured ownership. It also keeps the ownership boundary clear: core doctor ordering lives in contributions, while the shared health registry remains the extension point for bundled/plugin checks.Concrete Example: #85566
#85566 is the first small rule migration that shows why this PR exists.
The merged bridge shape registered
core/doctor/shell-completionas structuredhealth while keeping real repair in the existing positional Doctor path. That
was the safe first step: lint/dry-run data could exist without moving real
doctor --fixbehavior.This PR makes the target shape available for follow-up migrations:
That lets
doctor --lintreportcore/doctor/shell-completionthrough theordered core contribution path, while
openclaw doctor --fixcan keep thelegacy shell-completion repair path in its original Doctor slot until that rule
intentionally moves fully behind
healthChecks.Merged bridge example: #85566, merge commit
dc17412.
Real Behavior Proof
Behavior or issue addressed:
This PR changes the doctor health execution boundary: ordered core doctor
contributions supply core lint checks first, while bundled/plugin registry
checks remain the extension surface after core checks.
Real environment tested:
WSL Ubuntu 24.04 durable OpenClaw worktree at
/root/src/openclaw-86627-core-order, behavior-proof worktree head0b64c4ebda2c4610994b3eb46e1012c71ad28d22, with latest PR head0928476673c7323bd7a3fba51b5a565b4fbe5d07pending refreshed hosted checks after rebase; prior head9b06037369ac463a914fb82702edc3e31a38fe26was covered by green CI and ClawSweeper review,isolated
OPENCLAW_STATE_DIR,OPENCLAW_CONFIG_PATH,HOME, and workspaceunder
/tmp/openclaw-86627-proof-refresh-node.Proof 1: real command-path ordering with a registered non-core health check.
The proof enabled the bundled Policy plugin, then used the same sequence as
doctor --lint: read config, register bundled health checks, resolve orderedcore contribution checks, then append non-core registry checks.
Output:
{"orderedSubset":["core/doctor/gateway-config","core/doctor/command-owner","policy/policy-jsonc-missing"],"coreCount":19,"extensionCount":52}This shows the registered non-core Policy check is appended after the ordered
core Doctor checks.
Proof 2: real source-entry
doctor --lint --jsonwith selected core andregistered non-core checks.
Command shape:
Output:
{"ok":false,"checksRun":3,"checksSkipped":68,"findings":[{"checkId":"core/doctor/gateway-config","severity":"warning","message":"gateway.mode is unset; gateway start will be blocked.","path":"gateway.mode","fixHint":"Run `openclaw configure` and set Gateway mode (local/remote), or `openclaw config set gateway.mode local`."},{"checkId":"policy/policy-jsonc-missing","severity":"warning","message":"policy.jsonc is missing for the enabled Policy plugin.","source":"policy","path":"policy.jsonc","fixHint":"Restore policy.jsonc or add the policy artifact for this workspace."},{"checkId":"core/doctor/command-owner","severity":"info","message":"No command owner is configured. Owner-only commands (/diagnostics, /export-trajectory, /config, exec approvals) have no allowed sender.","path":"commands.ownerAllowFrom","fixHint":"Set commands.ownerAllowFrom to your channel user id, e.g. `openclaw config set commands.ownerAllowFrom '[\"telegram:123456789\"]'`."}]}Exit code:
1, expected because the selected checks intentionally reportfindings.
What was not tested:
No plugin package was installed. The non-core registry proof uses the bundled
Policy plugin as the registered extension-health surface.
How A Core Rule Upgrades
Before an upgrade, a rule is just an ordered doctor contribution:
For the safe in-place upgrade, the rule keeps its old
runand adds one inline health check beside it. Legacyrunstill owns real doctor behavior;healthChecks.detectsupplies structured lint findings:If the rule can provide dry-run/diff/effect detail before the full switchover, it can add structured repair as a preview-only path while legacy
runstill owns real mutation:When the rule is ready to be fully structured, remove legacy
runand call the old repair behavior from the structured check. At that pointhealthChecksowns the contribution execution path:When one fully structured contribution owns multiple structured checks, each check names its own ID explicitly:
If a check has repair behavior, it is expected to honor the existing dry-run/diff/effects conventions.
Validation
origin/mainat1bdf210b438.0928476673c7323bd7a3fba51b5a565b4fbe5d07. This is a clean rebase of the previously reviewed head9b06037369ac463a914fb82702edc3e31a38fe26; refreshed hosted checks are running.listExtensionHealthChecksForDoctor(...), sodoctor --lintand structured extension repair use the same boundary helper.openai/gpt-5.5.git diff --checkpnpm exec oxfmt --check src/auto-reply/heartbeat.ts src/commands/doctor-heartbeat-template-repair.test.ts src/agents/tools/pdf-tool.model-config.test.tspnpm exec oxfmt docs/cli/doctor.md src/commands/doctor-lint.ts src/commands/doctor-lint.test.ts src/flows/doctor-core-checks.ts src/flows/doctor-core-checks.test.ts src/flows/doctor-health-contributions.ts src/flows/doctor-health-contributions.test.ts src/flows/doctor-repair-flow.ts src/flows/health-check-registry.tspnpm exec oxlint src/flows/health-check-registry.ts src/commands/doctor-lint.ts src/commands/doctor-lint.test.ts src/flows/doctor-core-checks.ts src/flows/doctor-core-checks.test.ts src/flows/doctor-health-contributions.ts src/flows/doctor-health-contributions.test.ts src/flows/doctor-repair-flow.ts src/auto-reply/heartbeat.ts src/commands/doctor-heartbeat-template-repair.test.ts src/agents/workspace-templates.test.ts src/agents/tools/pdf-tool.model-config.test.tspnpm exec vitest run --project commands src/commands/doctor-lint.test.ts src/commands/doctor-heartbeat-template-repair.test.ts(19 tests)pnpm exec vitest run src/agents/workspace-templates.test.ts(10 tests acrossagents-coreandagents-support)pnpm exec vitest run src/agents/tools/pdf-tool.model-config.test.ts(24 tests acrossagents-coreandagents-tools)pnpm exec node scripts/run-oxlint-shards.mjs --threads=8pnpm exec vitest run src/crestodian/rescue-message.test.ts(10 tests)pnpm exec vitest run src/tasks/task-flow-registry.store.test.ts(8 tests)pnpm exec vitest run --project unit-fast src/flows/doctor-health-contributions.test.ts src/pairing/setup-code.test.ts(74 tests)pnpm exec vitest run --project unit src/flows/doctor-core-checks.test.ts(13 tests)pnpm tsgo:corepnpm tsgo:test:srcUpdated In-Place Upgrade Stack
These are the doctor PRs in the in-place upgrade series. Each one keeps the existing contribution order and preserves legacy real repair unless that PR explicitly removes the legacy run path.
The remaining older doctor repair drafts should be rebased onto this PR and reduced to this same in-place shape before they are presented as part of the series.