Skip to content

refactor: consolidate Doctor and update CLI workflows - #166633

Merged
steipete merged 2 commits into
mainfrom
deslop/d07-doctor-update-cli-20261007
Oct 7, 2026
Merged

steipete merged 2 commits into
mainfrom
deslop/d07-doctor-update-cli-20261007

Conversation

@steipete

@steipete steipete commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Doctor and update workflows repeat migration, repair, execution-context, and reporting mechanics across related paths.

User Impact

No intended user-visible behavior changes relative to main. Migration inputs, CLI flags and diagnostics, authority checks, recovery ordering, and persisted shapes remain intact, including July 2026+ inputs.

Why This Change Was Made

Consolidate private Codex compaction repair into its configuration-repair owner; share migration walkers, plugin repair mechanics, and result construction; bind updater context once; and remove single-use forwarding modules and unreachable selected-install states. Real variant policies remain explicit. Tests for the removed stdio helper now assert the actual child spawn and stream-routing boundary.

The audit covers 291 production files; protected PR-tooling closure files remain unchanged. The branch removes 1,512 net production lines, excluding tests, fixtures, generated/declaration files, and the shrink-only assertion baseline—approximately 2.3% of the subsystem, below the campaign's 3% target.

The latest conflict-only rebase preserves main's deferred plugin activation warning, excludes unresolved state work from completion records, and retains main's ClawHub/source identity checks. All seven upstream edits in the two auto-merged plugin modules were verified byte-for-byte.

Evidence

Candidate head: 8a9c9ff705f4ce9263cc1bf8bef2c3659732aa14; source tree: e32567279f102d656dfd534e0b1e50a2904ba8e9; base: 02e2078de7f634af018906abd7a43c3e275d5e25.

  • Rebased ordinary subsystem tests plus affected callers and lint-suppression checks: 4,182 passed, zero failures, 21 existing skips.
  • Changed checks passed, including production/test types, formatting, lint, ratchets, boundaries, and dead-export scans.
  • Runtime import cycles: 0. Madge cycles: 0.
  • Fresh independent review of the rebased candidate: scoped clean through P2, two passes.
  • Linux runtime suites: 275/275 passed across five files. Legacy-config migration and plugin publication authority E2E: 21/21 passed across two files, on the exact published head with Node 24.21.0.
  • Total current-source proof: 4,478 passing tests across 305 files, plus the 21 existing skips above.
  • Controlled comparison against original base 0d06bc0fec0129608ed04ed286e7e1e2c28021e3: parent-git-root-switch, parent-revoked, and parent-retargeted each passed 5/5 on base and 5/5 on current head. Zero failures or invalid runs; minimum pre-run CPU idle was 87.99%.
  • Hosted CI run 37661363774 succeeded on the exact head. The completed check-run census contained 88 successes, 49 skips, one neutral, zero failures, and zero cancellations; all three status contexts succeeded.

Earlier local failures of the three named finalizer cases were not reproduced in the controlled comparisons. Their cause remains unconfirmed; passing replays are not presented as a flake fix.

The two changed test files passed one-worker cost measurement without changing timeouts, retries, or skips:

File Local test time Local command wall time Prior-head hosted Bun case time
update-command-post-core-root.test.ts 0.923s 16.785s 0.618s
update-command.test.ts 0.319s 12.980s 1.456s

Hosted times sum reported case durations and exclude shared shard setup. The opt-in live Node-runtime suite was not run.

CI fixture repair and current status

The previous head's Bun shard failed unchanged Homebrew teardown with an active native database borrower. Both cancelled jobs were replayed successfully. Standalone Node and matching Bun-selection comparisons passed on both main and that head, without establishing an inherited-failure waiver.

The coordinator-approved fixture repair landed separately on main as 02e2078de7f634af018906abd7a43c3e275d5e25: installation-layout and migrated-update teardown now await the existing shared database cleanup owner. Every assertion, timeout, retry, and skip is unchanged. Its proof passed 39 Linux tests, 8 Bun tests, changed checks, zero runtime/Madge cycles, and independent review. These fixture changes are in the base, not this PR diff.

Current-head hosted CI is green. No inherited-failure or admin exception is needed.

@clawsweeper

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

@steipete
steipete marked this pull request as ready for review October 7, 2026 14:58
@openclaw-barnacle openclaw-barnacle Bot added cli CLI command changes commands Command implementations size: XL labels Oct 7, 2026
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. 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 7, 2026
@clawsweeper

clawsweeper Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed October 7, 2026, 12:20 PM ET / 16:20 UTC (Revision 3).

ClawSweeper review

What this changes

The branch consolidates Doctor’s configuration and plugin repairs and simplifies update execution, recovery, and reporting while preserving existing CLI behavior.

Merge readiness

⛔ Blocked before merge - 5 items remain

Keep open: the consolidation remains useful and no concrete introduced bug was found, but the previously requested published-updater compatibility evidence is still missing.

Priority: P3
Reviewed head: a3abdf9d93143bc5c72d6a827a834bec78676c5f

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The patch has useful consolidation and substantial supplemental validation, with confidence limited by the outstanding upgrade-proof gap.
Proof confidence 🦐 gold shrimp (3/6) Not applicable: Real behavior proof is not required for maintainer- or bot-authored pull requests.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: Real behavior proof is not required for maintainer- or bot-authored pull requests.
Evidence reviewed 10 items Pinned introduction and repository identity: The verified origin is openclaw/openclaw. Review used merge-base 23dae69 through the pinned original head, excluding endpoint drift.
Upgrade proof remains applicable: Root policy explicitly requires a published-driver × candidate cell for update and Doctor changes. The captured PR body reports subsystem, migration, and finalizer comparisons but does not identify a published updater installing this candidate against existing state.
Skipped CI cell is expected selection behavior: The selection documentation excludes ordinary PRs from the published-driver CI cell. Its skipped check is therefore not an introduced automation defect, but also supplies no upgrade proof.
Findings None None.
Security None None.

How this fits together

Doctor repairs configuration and installed state; the updater invokes those repairs while replacing OpenClaw and managing Gateway shutdown, recovery, and restart. These workflows consume existing operator state and produce validated configuration, installation records, and update results.

flowchart TD
  A[Existing installation and operator state] --> B[Update admission]
  B --> C[Package or source update]
  C --> D[Doctor and plugin repairs]
  D --> E[Validate updated state]
  E --> F[Gateway restart and update report]
  E --> G[Recovery and rollback]
Loading

Before merge

  • Resolve merge risk (P1) - Compatibility with an already-published updater remains unverified; an existing installation could fail during candidate Doctor, handoff, or recovery despite passing source-tree tests.
  • Complete next step (P2) - Add published-updater compatibility evidence for the pinned candidate against existing isolated operator state.
  • Resolve review confidence - ClawSweeper must reach high confidence before merge readiness is known.
  • Review config compatibility - Confirm compatibility and upgrade impact for the changed config or default surface before merge.
  • Add data-model compatibility proof - Confirm migration or upgrade compatibility proof before merge.
Agent review details

Security

None.

PR surface

PR surface statistics unavailable: the file list is incomplete.

Review metrics

Metric Value Why it matters
Production versus test delta production −1,512 net lines; tests +38 net lines The reduction removes duplicated private mechanics while test coverage moves to the child-spawn and stream-routing boundary.

Stored data model

Persistent data-model change detected: migration/backfill/repair: config/assertion-safety-baseline.txt, migration/backfill/repair: src/cli/update-cli/update-command-fresh-doctor.ts, migration/backfill/repair: src/cli/update-cli/update-command-post-core.ts, migration/backfill/repair: src/commands/doctor/shared/github-preview-upgrade.ts, migration/backfill/repair: src/commands/doctor/shared/hooks-token-reuse-repair.ts, migration/backfill/repair: src/commands/doctor/shared/legacy-config-binding-repair.ts, and 49 more. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Supply published-updater evidence (recommended)
    Record a published driver installing the pinned candidate against existing isolated state, showing completed Doctor, handoff, and applicable recovery outcomes.

Technical review

Best possible solution:

Retain the consolidation with unchanged operator settings, migration outputs, and recovery behavior, backed by published-updater compatibility evidence.

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

Not applicable: this PR proposes internal consolidation rather than fixing a reproduced product bug; no introduced failure was established.

Is this the best way to solve the issue?

Yes in direction: sharing private repair and execution mechanics follows existing ownership boundaries, but upgrade compatibility still needs the required production-boundary evidence.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 947b35844d17.

Labels

Label changes:

No label changes.

Label justifications:

  • P3: This is behavior-preserving internal cleanup, with no demonstrated urgent product regression.
  • merge-risk: 🚨 compatibility: Source-tree validation does not settle compatibility between a published updater and the refactored candidate.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: Real behavior proof is not required for maintainer- or bot-authored pull requests.

Evidence

What I checked:

  • Pinned introduction and repository identity: The verified origin is openclaw/openclaw. Review used merge-base 23dae69 through the pinned original head, excluding endpoint drift. (a3abdf9d9314)
  • Upgrade proof remains applicable: Root policy explicitly requires a published-driver × candidate cell for update and Doctor changes. The captured PR body reports subsystem, migration, and finalizer comparisons but does not identify a published updater installing this candidate against existing state. (AGENTS.md:70, a3abdf9d9314)
  • Skipped CI cell is expected selection behavior: The selection documentation excludes ordinary PRs from the published-driver CI cell. Its skipped check is therefore not an introduced automation defect, but also supplies no upgrade proof. Public docs: docs/ci/scope-and-routing/selection.md. (docs/ci/scope-and-routing/selection.md:89, a3abdf9d9314)
  • Review continuity and captured validation: The previous completed review assessed this same head, had no findings, and requested published-driver/candidate identities and upgrade output. The captured body records 4,437 passing tests, migration E2E results, and controlled negative finalizer cases, while explicitly preserving uncertainty about earlier failures. The native runtime evidence identifies an earlier source tree and does not establish the requested published-driver upgrade. (a3abdf9d9314)
  • Authority checks remain live: Successful lease checks are memoized only within each assertion; subsequent assertions recreate the memoizers and read current parent and receiver authority. The inspected extraction preserves the previous checks rather than granting longer-lived authority. (src/cli/update-cli/update-command-executor-delegated.ts:97, a3abdf9d9314)
  • Persisted-format boundary: Plugin registry migration retains its lifecycle lease, repeats preflight inside that lease, and writes through the same persisted-index owner. Inspected migration changes reorganize existing transformations; no new schema or stored-format contract was identified. (src/commands/doctor/shared/plugin-registry-migration.ts:154, a3abdf9d9314)

Likely related people:

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

Rank-up moves

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

  • Add published-driver and candidate identities with terminal output or logs showing the upgrade outcome; redact credentials, IP addresses, phone numbers, private endpoints, and other private information.
  • Update the PR body with that evidence for automatic re-review; if it does not trigger, ask a maintainer to comment @clawsweeper re-review.

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 (2 earlier review cycles)
  • reviewed 2026-10-07T15:06:16.282Z sha a3abdf9 :: blocked before merge. :: none
  • reviewed 2026-10-07T16:07:24.262Z sha a3abdf9 :: blocked before merge. :: none

@clawsweeper clawsweeper Bot added the merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. label Oct 7, 2026
Share Doctor tool-policy preparation, TTS rule locations, plugin repair
candidate selection, and default/agent model repair mechanics. Reuse update
executor admission/retirement bookkeeping and lineage tuple serialization.
Keep messages, config shapes, CLI behavior, and shipped migrations intact.

Remove 240 net production lines across eight files; no tests changed.

Validation: independent P0-P2 review clean; production and test-graph
typechecks; corrected scoped lint; zero runtime and Madge cycles;
162 original/current lineage hash comparisons; lint-suppression tests.
Plugin dependency-repair integration passes all four cases with inherited
ZAI provider credentials excluded from its synthetic fixture environment.

One focused executor child deadline failure reproduced on the original
base. A broader legacy-finalization run had seven child deadline failures:
four reproduced on the base, three did not reproduce. Full directory proof
remains incomplete; no timeout, retry, assertion, or skip was changed.

Below the campaign's 500-line PR floor: branch handoff only.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI command changes commands Command implementations merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: XL 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