Skip to content

refactor(doctor): route plugin config repairs through one executor - #162641

Merged
steipete merged 5 commits into
mainfrom
deslop/l271-arch-small-doctor-dispatch
Oct 1, 2026
Merged

steipete merged 5 commits into
mainfrom
deslop/l271-arch-small-doctor-dispatch

Conversation

@steipete

@steipete steipete commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Plugin config repairs used separate execution loops in setup registration, Doctor contracts, legacy channel preview, and interactive channel repair. Those loops disagreed on failed-hook isolation and warning-only results.

User Impact

Repairs now preserve the last successful config when a plugin hook mutates then returns no changes or throws, keep warnings visible, and continue with remaining repairs. Public registerConfigMigration, setup-before-Talk/model ordering, disabled/unavailable selection, state-free previews, and the existing backup/write owner remain intact. No configuration shape, schema, protocol, or SDK surface changes.

Why This Change Was Made

All four paths execute through the existing Doctor compatibility owner. Selection and phase adapters remain because they carry existing contracts. Interactive channel hooks keep their merged-adapter receiver. The six bundled setup registrations remain in their established phase.

Measured reduction: 23 production lines. New isolation regressions live in a focused sibling. During conflict resolution, main's simplified registry suite and intentional retirement of old cases were preserved.

Fixes found along the way

  • Warning-only Doctor contract results were discarded.
  • A null-returning setup hook could leak mutations into later repairs; throwing setup/channel hooks aborted the sequence.
  • A receiver regression introduced during consolidation was caught and fixed before publication.

Evidence

Final reviewed head: d1dbec8adc92b8c5cbc9ea4e5d0133a0491eeea9, integrating main 0689d93557e1. The only conflict was in registry tests; production merged cleanly. Fresh independent review was scoped-clean. A source-tree-verified AWS recheck passed 1,190 tests (including 1,132 current plugin contracts) in 177.97 seconds wall including runtime preparation. Both cycle checks again report zero. Hosted CI for this new head is pending.

  • Four new regression cases failed for the intended reasons on base 347b627f9c0c; the receiver regression also failed on the unbound intermediate candidate.
  • 1,324 broader tests passed, including 1,130 plugin contracts. Subsequent focused runs passed 57 cases after the receiver/test-split changes and 41 cases on the final tree after the lint-only accumulator correction.
  • Changed checks passed through ratchets, docs, production and all test-type shards, boundaries, and dead-export scans. The final parameter-reassignment lint finding was fixed; the exact focused lint stage then passed.
  • Both import-cycle checks: zero. SDK API comparison 347b627f9c0c → e4f49bdc0685: no changes.
  • Independent Codex reviews through P2 completed with no remaining actionable findings.
  • Linux proof used Blacksmith for the failing baseline, then sanitized AWS lease cbx_31e7faf5ddad through Crabbox's pinned SSH command after broker/sync failures. The approved bootstrap verified no instance-role credentials, pinned Node/pnpm, and installed frozen dependencies. Git bundles and the final source tree were verified before proof. Final focused wall time: 27.91s.
  • An intermediate integration failure from a removed main-branch warning collector was corrected before publication; the full migration suite then passed.
Production coverage (baseline sizes)
Lines File Read / result
809 src/plugins/setup-registry.ts READ: delegate execution; preserve public registration and relevant-plugin selection.
760 src/plugins/doctor-contract-registry.ts READ: use the shared executor; preserve installed-owner selection, deferred owners, inventory and backup admission.
409 src/commands/doctor/shared/channel-doctor.ts READ: share execution, preserving disabled-channel selection, adapter precedence and receiver.
402 src/commands/doctor/repair-sequencing.ts READ: retain dependency order and the existing final backup/write owner.
310 src/plugins/doctor-contract-module.ts READ: retain state-migration contracts; represent existing optional warning output.

Also read the legacy bridge/core entry points, compatibility base, executor, artifact loader, bootstrap adapters, and all six named bundled setup registrations. Removing the registrations would alter phase order or introduce a new phase policy, so they remain.

@clawsweeper

clawsweeper Bot commented Oct 1, 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.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime commands Command implementations size: L labels Oct 1, 2026
@steipete
steipete enabled auto-merge (squash) October 1, 2026 11:19
@clawsweeper

clawsweeper Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed October 1, 2026, 8:05 AM ET / 12:05 UTC (Revision 2).

ClawSweeper review

What this changes

Doctor, OpenClaw’s repair command, routes plugin config repairs through one executor that isolates failed hooks, preserves warnings, and continues subsequent repairs.

Merge readiness

⛔ Blocked before merge - 3 items remain

The PR remains useful: current main and the latest release lack its isolation and warning-preservation fixes. No actionable patch defect was found, but the previously identified upgrade-proof gap remains.

Priority: P2
Reviewed head: d1dbec8adc92b8c5cbc9ea4e5d0133a0491eeea9

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The focused patch has no identified correctness defect, while confidence in update behavior remains limited by the outstanding required upgrade evidence.
Proof confidence 🌊 off-meta tidepool Not applicable: Verified trusted-author status exempts ordinary external-contributor proof. Reported final-head tests exercise repair isolation and warning preservation, but do not establish the separately required published-updater upgrade boundary. No stored-data format or schema changes were introduced.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: Verified trusted-author status exempts ordinary external-contributor proof. Reported final-head tests exercise repair isolation and warning preservation, but do not establish the separately required published-updater upgrade boundary. No stored-data format or schema changes were introduced.
Evidence reviewed 10 items Pinned introduced change: The verified base-to-head diff consolidates four compatibility execution paths. Caller-owned selection remains intact, and interactive channel hooks retain their merged-adapter receiver through explicit binding.
Still necessary on current main: Fetched main retains the single-hook executor, which discards warning-only results. Its setup registry still passes the active candidate directly into migration hooks without exception isolation.
Latest release comparison: The executor in v2026.9.7 also discards warning-only results; the central improvement is not already present in the latest release.
Findings None None.
Security None None.

How this fits together

Doctor combines existing operator configuration with plugin-owned repair hooks to prepare corrected configuration. Its existing validation, backup, and publication owners decide whether that configuration can be saved or activated during an update.

flowchart TD
  A[Operator configuration] --> B[Caller selects repair hooks]
  B --> C[Shared repair executor]
  C --> D[Private config candidate]
  D --> E{Hook reports changes?}
  E -->|Yes| F[Advance repaired configuration]
  E -->|No or failure| G[Preserve previous configuration]
  F --> H[Existing validation and backup write flow]
  G --> H
Loading

Before merge

  • Resolve merge risk (P1) - Published-updater × candidate evidence is still needed to establish that existing operator settings survive the changed repair execution and warning handling through update-time validation and publication.
  • Complete next step (P2) - Add the repository-required published-updater × candidate upgrade evidence with existing operator configuration before merge.
  • Add data-model compatibility proof - Confirm migration or upgrade compatibility proof before merge.
Agent review details

Security

None.

PR surface

Source -23, Tests +165, Docs +5, Other -1. Total +146 across 13 files.

View PR surface stats
Area Files Added Removed Net
Source 7 99 122 -23
Tests 4 206 41 +165
Docs 1 5 0 +5
Config 0 0 0 0
Generated 0 0 0 0
Other 1 0 1 -1
Total 13 310 164 +146

Review metrics

Metric Value Why it matters
Production versus test growth production -23 lines; tests +165 lines The introduced delta reduces production code while adding focused failure-isolation coverage.

Stored data model

Persistent data-model change detected: migration/backfill/repair: config/assertion-safety-baseline.txt, migration/backfill/repair: src/commands/doctor/shared/channel-doctor.ts, migration/backfill/repair: src/commands/doctor/shared/channel-legacy-config-migrate.ts, migration/backfill/repair: src/commands/doctor/shared/legacy-config-core-migrate.ts, migration/backfill/repair: src/plugins/doctor-compatibility-migration.ts, migration/backfill/repair: src/plugins/doctor-contract-module.ts, and 5 more. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Establish upgrade compatibility (recommended)
    Supply published-updater × candidate evidence showing existing configuration passes through the consolidated repair owner without losing settings or bypassing backup and publication safeguards.

Technical review

Best possible solution:

Retain the shared executor with verified preservation of existing settings, backup ownership, and recovery behavior during published-updater upgrades.

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

Yes, from source: current main’s setup loop allows a hook to mutate the active candidate before returning null or throwing, and its compatibility executor drops warning-only output. No runtime reproduction was executed.

Is this the best way to solve the issue?

Yes: extending the existing compatibility executor preserves caller-owned selection and ordering while removing competing execution loops; update compatibility still needs the required boundary evidence.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 3ad238cc0696.

Labels

Label changes:

  • add P2: This is a bounded Doctor reliability improvement addressing source-supported mutation isolation and warning preservation.
  • add merge-risk: 🚨 compatibility: The changed executor participates in existing-config updates, whose required published-updater compatibility evidence remains outstanding.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; 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: Verified trusted-author status exempts ordinary external-contributor proof. Reported final-head tests exercise repair isolation and warning preservation, but do not establish the separately required published-updater upgrade boundary. No stored-data format or schema changes were introduced.

Label justifications:

  • P2: This is a bounded Doctor reliability improvement addressing source-supported mutation isolation and warning preservation.
  • merge-risk: 🚨 compatibility: The changed executor participates in existing-config updates, whose required published-updater compatibility evidence remains outstanding.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; 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: Verified trusted-author status exempts ordinary external-contributor proof. Reported final-head tests exercise repair isolation and warning preservation, but do not establish the separately required published-updater upgrade boundary. No stored-data format or schema changes were introduced.

Evidence

What I checked:

  • Pinned introduced change: The verified base-to-head diff consolidates four compatibility execution paths. Caller-owned selection remains intact, and interactive channel hooks retain their merged-adapter receiver through explicit binding. (src/plugins/doctor-compatibility-migration.ts:7, d1dbec8adc92)
  • Still necessary on current main: Fetched main retains the single-hook executor, which discards warning-only results. Its setup registry still passes the active candidate directly into migration hooks without exception isolation. (src/plugins/doctor-compatibility-migration.ts:15, 3ad238cc0696)
  • Latest release comparison: The executor in v2026.9.7 also discards warning-only results; the central improvement is not already present in the latest release. (src/plugins/doctor-compatibility-migration.ts:15, c074824a27c9)
  • Meaningful regression coverage: The added setup cases exercise successful repairs surrounding a mutate-then-null or mutate-then-throw hook. Channel and registry cases separately protect receiver binding, continuation, and warning-only isolation. The captured body reports intended baseline failures and final-head test passes; this read-only review did not execute tests. (src/plugins/setup-registry.config-migrations.test.ts:58, d1dbec8adc92)
  • Upgrade boundary and intentional refusal: The unchanged plugin-update preparation owner calls the changed registry executor and refuses migration warnings before publication. The merged listener-update work at fix: preserve listener settings when plugins update #160682 establishes this existing lifecycle and provides useful earlier upgrade evidence, but covers a different production revision. Inspected Signal warning-only results identify pending transport repair, so their propagation does not establish a concrete introduced defect. (src/commands/doctor/shared/plugin-update-config-migration.ts:58, d1dbec8adc92)
  • Required upgrade proof remains outstanding: Fully read root policy requires published-driver × candidate evidence for Doctor changes. The complete captured body, source revision e2d6f4822b55c38c75068b8259e1d877dd9c0a868023f71f74accc81063bf554, reports regression and contract tests but identifies no such upgrade run for this candidate. This is the same concrete gap retained from the previous completed review. (AGENTS.md:84, d1dbec8adc92)

Likely related people:

  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; confidence: low)

Rank-up moves

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

  • Add published-updater × candidate evidence for existing configuration passing through the consolidated repair owner.

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 (1 earlier review cycle)
  • reviewed 2026-10-01T11:22:04.672Z sha e4f49bd :: blocked before merge. :: none

@steipete
steipete disabled auto-merge October 1, 2026 11:30
@steipete
steipete enabled auto-merge (squash) October 1, 2026 11:59
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 1, 2026
@steipete
steipete merged commit 55bbbf9 into main Oct 1, 2026
142 of 144 checks passed
@steipete
steipete deleted the deslop/l271-arch-small-doctor-dispatch branch October 1, 2026 12:09
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 2, 2026
…penclaw#162641)

Run registered setup migrations, Doctor contracts, legacy channel previews and interactive channel compatibility hooks through one executor. Preserve migration phases, public registration and adapter receivers while isolating failed candidates and retaining warning-only results.

Regression failures were reproduced on the base; focused and plugin-contract tests, changed checks, both cycle checks, SDK API comparison and independent reviews completed successfully.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

commands Command implementations docs Improvements or additions to documentation gateway Gateway runtime merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: M 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