Skip to content

refactor(commands): consolidate command mutation and reporting paths - #167043

Merged
steipete merged 6 commits into
mainfrom
deslop/d20-commands-20261007
Oct 8, 2026
Merged

steipete merged 6 commits into
mainfrom
deslop/d20-commands-20261007

Conversation

@steipete

@steipete steipete commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

Several command variants repeat installation, mutation, and reporting work that can be maintained in one implementation.

User Impact

No user-visible behavior changes. CLI flags and output, configuration and protocol shapes, persisted data, cancellation, and recovery ordering are preserved.

Why This Change Was Made

Share model fallback/account/auth-order mutation paths, plugin install progress and completion, binding updates, reset/uninstall service teardown, Doctor repair/reporting mechanics, and status projections. Retire the replaced internal helpers and update their callers together.

Measured production reduction: 639 lines, including required CLI caller changes; tests: 18 lines removed net. The commands production inventory is 100,586 lines across 465 files, excluding src/commands/doctor/, tests, fixtures, support, generated code, and declarations. This is the campaign's authorized 500–999-line exception after more than two hours of implementation and a largest-first file pass; it does not meet the 3% target.

Most retained length represents distinct filesystem identity, database admission, state recovery, cancellation, or public output contracts. A model-default projection experiment and restore-report extraction were implemented, measured, and discarded because they reduced clarity or grew code.

Evidence

Validation used the repository test/check owners on AWS with Node v24.19.0 and pnpm 12.5.1. The native source receiver verified the reviewed source tree before execution. The broad focused/full runtime suites and SDK comparison ran on ed587434c75c29efb821e267191f662031e5c54a; final-head checks ran on 7223003e0ea498070880131744c32d80d8ae5b4b. Later corrections restore the original catalog-cloning operation, remove the unused Doctor report-type alias, prepare CLI partial mocks during collection, and keep two status-fixture constants internal; affected checks are repeated on the final head.

  • Focused coverage: 64 files, 1,024 tests passed, including the runtime-backed Doctor E2E cases.
  • Full src/commands directory: 662 files passed; 7,995 tests passed and four skipped under the existing test configuration.
  • Production typecheck and all 27 test type graphs passed. The entire changed-check plan was exercised; its only remaining failure is the inherited script export described below. Targeted lint, scripts lint, all remaining policy checks, and all lane-owned export checks passed.
  • Final follow-up coverage: channel/title repair, three files and 18 tests; CLI registration, 37 tests; cold/lazy CLI contracts, two files and four tests; status-fixture consumers, 13 files and 166 tests. All passed.
  • Runtime import cycles: zero. Madge cycles: zero, matching the clean baseline.
  • Plugin SDK API comparison against the exact starting commit: no API changes.
  • Independent isolated Codex review completed with no actionable findings remaining. Two initial findings were rejected against existing early returns; subsequent corrections and the CLI fixture setup received fresh P2 reviews.

The lint-suppression test on the starting base fails on two untouched logging typescript/unbound-method suppressions. The exact failure reproduces on b300e0edea5e3e1b0aee58a33e188711380d8e22; the same test passes all three cases on main d41d7ff8c8fc8137523232f60f8194d403cfaefa, where #166841 removed those suppressions. This is an inherited defect already fixed on main, not a current-main failure. This PR adds no suppressions and only removes obsolete baseline entries. The dead-export scan also finds the untouched readRecommendedModels script export inherited from the starting base; #165825 has already made it internal on main. The lane-owned unused report alias is removed here. Remaining native changed-check commands are executed separately after the inherited scan failure, with no guard disabled.

A local focused run under severe shared-host contention had 986 passing and 12 failing cases: timeouts in legacy-auth repair, incident-scale transcript repair, session reset, and probe cleanup, plus subsequent registry/session assertions and four MiniMax login failures. Source investigation found unchanged mutation order and a possible timeout/teardown overlap affecting shared fixture state; causation was not established. All five owning files then passed in original in-file order on isolated AWS (87 tests), and the complete focused/full directory runs passed there. The passing replay does not claim to fix the original local failures.

The first partial-mock CLI check exposed worker-bundle preparation inside case timers (223.391 seconds on the contended host). Three narrow imports now initialize the hoisted partial mocks during collection, preserving real exports and the same command spies, assertions, and timeouts. Separate cold/lazy-loading tests retain their existing contracts.

Serialized CI-mode measurements use CI=1 node scripts/run-vitest.mjs <file> --maxWorkers=1. These are standalone AWS wall seconds, including native worker preparation; they are not whole-job hosted-CI totals.

Changed test CI-mode wall seconds (AWS)
src/cli/models-cli.test.ts 30.55
src/commands/doctor-auth-migration-receipts.test.ts 24.52
src/commands/models/accounts.test.ts 36.94
src/commands/models/auth-order.test.ts 24.49
src/commands/models/model-selection.runtime.test.ts 63.36
src/commands/status-overview-surface.test.ts 23.55
Per-file production coverage log

Every listed production owner was read in the largest-first implementation pass. “Changed” identifies retained structural consolidations; “retained” means no clearer behavior-identical consolidation survived inspection. New helper and required caller files are described above and visible in the diff.

File under src/commands Baseline lines Disposition
doctor-auth-flat-profiles.ts 2078 retained
models/list.status-command.ts 1597 changed
doctor-state-integrity.ts 1426 changed
doctor-session-sqlite.ts 1425 retained
agent-via-gateway.ts 1203 retained
models/auth.ts 1128 changed
onboarding-plugin-install.ts 1063 changed
models/list.probe.ts 1021 changed
configure.wizard.ts 755 retained
doctor-gateway-services.ts 754 retained
doctor-lint-runner.ts 725 retained
onboard-guided.ts 722 retained
backup-verify.ts 715 retained
doctor-skill-workshop-collection-backups.ts 707 retained
doctor-session-sqlite-restore.ts 706 retained
daemon-install-helpers.ts 692 retained
doctor-maintenance.ts 691 retained
doctor-heartbeat-scratch-migration.ts 682 changed
doctor-memory-search.ts 674 changed
doctor-config-flow.ts 667 retained
triage.ts 667 retained
doctor-update-schema-guard.ts 660 retained
cleanup-utils.ts 641 retained
onboard.ts 635 retained
doctor-plugin-registry.ts 622 changed
backup-shared.ts 616 retained
onboard-custom-config.ts 604 retained
doctor-heartbeat-task-migration.ts 598 changed
doctor-session-canonical-keys.ts 594 changed
audit.ts 586 retained
doctor-gateway-daemon-flow.ts 575 retained
agents.commands.add.ts 572 retained
doctor-session-transcripts.ts 556 changed
doctor-skill-workshop-relocation.ts 556 retained
doctor-tools-md-migration.ts 537 changed
doctor-auth.ts 533 retained
doctor-session-state-providers.ts 527 retained
doctor-sqlite-nocow.ts 527 retained
doctor-session-sqlite-discovery.ts 526 retained
doctor-sandbox.ts 516 retained
doctor-gateway-health.ts 514 retained
backup-verify-manifest.ts 503 retained
doctor-update-rehearsal-inventory.ts 498 retained
migrate.ts 496 changed
status-all/channels.ts 495 retained
doctor-session-sqlite-retirement.ts 493 retained
status-all/diagnosis.ts 491 changed
doctor-auth-migration-receipts.ts 479 changed
agent-exec.ts 477 retained
doctor-session-sqlite-recovery-inventory.ts 477 retained
onboard-non-interactive/local/auth-choice.plugin-providers.ts 477 retained
doctor-session-sqlite-retained.ts 476 retained
sessions.ts 474 retained
agents.commands.delete.ts 472 retained
doctor-skill-workshop-sqlite.ts 472 retained
onboard-non-interactive/local.ts 467 retained
status.scan.shared.ts 462 retained
doctor-session-sqlite-import.ts 455 retained
triage-update.ts 454 retained
status.command-sections.ts 448 retained
doctor-config-preflight-plugin-migrations.ts 441 retained
onboard-helpers.ts 440 retained
onboard-remote-gateway.ts 440 retained
backup-resource-inventory.ts 432 retained
doctor-security.ts 421 retained
doctor-model-catalog-credentials.ts 418 retained
health.ts 416 retained
models/accounts.ts 412 changed
status.scan-overview.ts 411 retained
sandbox-explain.ts 406 retained
doctor-device-pairing.ts 404 retained
doctor-session-sqlite-recover-report.ts 402 retained
promos/claim.ts 401 retained
models/shared.ts 395 retained
models/auth-logout.ts 393 retained
doctor-workspace.ts 390 changed
models/scan.ts 388 changed
channels/capabilities.ts 386 changed
doctor-config-preflight.ts 383 changed
onboard-custom.ts 380 retained
doctor-config-analysis.ts 379 retained
sessions-lifecycle.ts 373 retained
doctor-session-snapshots.ts 368 retained
doctor-skill-workshop-sidecars.ts 366 retained
health-format.ts 360 retained
doctor-retired-phone-control.ts 359 retained
message-format.ts 358 retained
status-all/format.ts 357 retained
doctor-workspace-status.ts 354 retained
agents.config.ts 353 retained
doctor-maintenance-state.ts 353 retained
channels/add-wizard.ts 351 retained
doctor-session-sqlite-failure.ts 351 retained
migrate/selection.ts 351 retained
doctor.ts 343 retained
doctor-session-sqlite-verification.ts 342 retained
sessions-tail.ts 341 retained
doctor-session-incognito-key-repair.ts 339 retained
onboard-browser-handoff.ts 339 retained
channels/add.ts 336 retained
doctor-telegram-general-topic-conversations.ts 336 changed
sessions-cleanup.ts 334 retained
doctor-session-transcript-headers.ts 331 retained
agents.providers.ts 328 retained
gateway-status/helpers.ts 321 retained
agents.commands.bind.ts 318 changed
configure.gateway.ts 318 retained
channels/list.ts 317 retained
config-preflight-snapshot.ts 308 retained
configure.gateway-auth.ts 306 retained
doctor-maintenance-restoration.ts 306 retained
onboard-skills.ts 303 retained
agents.bindings.ts 301 retained
doctor-skill-workshop-workspaces.ts 295 retained
doctor-heartbeat-main-session-repair.ts 292 retained
onboard-agent-target.ts 292 retained
control-ui-handoff.ts 291 retained
gateway-status/output.ts 287 retained
doctor-session-incognito-key-repair-state.ts 285 retained
doctor-session-delivery-state.ts 284 retained
doctor-migration-backup.ts 283 retained
onboard-non-interactive/local/auth-choice.ts 281 retained
setup.ts 279 retained
doctor-session-transcript-labels.ts 277 retained
status.command.ts 277 changed
doctor-claude-cli.ts 266 changed
backup-remote.ts 265 retained
doctor-platform-notes.ts 265 retained
migrate/output.ts 265 changed
runtime-plugin-install.ts 263 retained
status-overview-rows.ts 261 retained
status-runtime-shared.ts 261 retained
onboard-remote.ts 257 retained
uninstall.ts 257 changed
backup-git.ts 253 retained
channels/status.runtime.ts 252 retained
channels/remove.ts 251 retained
doctor-auth-legacy-paths.ts 249 retained
doctor-completion.ts 247 changed
onboard-non-interactive/local/output.ts 246 retained
dashboard.ts 244 retained
models/list.auth-overview.ts 239 retained
status.update.ts 239 retained
doctor-session-sqlite-targets.ts 237 retained
status.scan.gateway.ts 237 retained
doctor-config-preflight-plugin-verification.ts 236 retained
doctor-session-sqlite-diagnostics.ts 235 retained
doctor-gateway-installation.ts 233 retained
startup-config-preflight.ts 231 retained
doctor-auth-profile-config.ts 230 retained
doctor-sqlite-reclamation.ts 226 retained
doctor-agent-memory-schema.ts 225 retained
doctor-agent-deletion-journal-quarantine.ts 223 retained
doctor-session-sqlite-archive.ts 223 retained
triage-prompt.ts 223 retained
backup-restore.ts 222 retained
doctor-post-upgrade.ts 222 retained
agents.commands.identity.ts 220 retained
sessions-cleanup.runtime.ts 220 retained
backup-sqlite.ts 218 retained
channel-setup/trusted-catalog.ts 218 retained
doctor-memory-recall.ts 217 retained
triage-failure.ts 217 retained
backup-schedule.ts 214 retained
doctor-ui.ts 214 changed
agents.commands.list.ts 213 retained
doctor-session-canonical-candidates.ts 213 retained
doctor-update-refusal.ts 212 retained
models/auth-api-key.ts 209 retained
status-all/report-data.ts 208 changed
onboard-inference.ts 206 retained
doctor-update-run.ts 204 retained
doctor-plugin-manifests.ts 202 retained
doctor-usage-cost-cache.ts 200 retained
migrate/skill-selection-prompt.ts 200 retained
doctor-sqlite-maintenance-lock.ts 199 retained
models/auth-logout-selections.ts 199 retained
doctor-heartbeat-cadence-migration.ts 198 retained
gateway-status/probe-run.ts 198 retained
channels/resolve.ts 192 retained
status-update-restart.ts 191 retained
onboard-agent.ts 188 retained
doctor-plugin-host-links.ts 186 retained
auth-choice-prompt.ts 184 retained
models/auth-model-policy.ts 184 retained
onboard-non-interactive/local/gateway-config.ts 182 retained
agent-exec-input.ts 181 retained
doctor-maintenance-inspection.ts 181 retained
doctor-outbound-delivery.ts 179 retained
gateway-status.ts 179 retained
doctor-session-title-repair.ts 177 changed
gateway-install-token.ts 177 retained
doctor-lint-process.ts 176 retained
export-trajectory.ts 176 retained
doctor-skill-workshop-automations.ts 175 retained
models/fallbacks-shared.ts 175 changed
reset.ts 175 changed
doctor-workspace-alias.ts 174 retained
heartbeat-task-legacy.ts 174 retained
auth-choice.model-check.ts 173 retained
doctor-session-sqlite-transcript-readers.ts 172 retained
models/accounts-gateway.ts 172 retained
onboard-recommendations.ts 171 retained
models/auth-order.ts 164 changed
message.ts 163 retained
doctor-config-preflight-legacy-config.ts 162 retained
doctor-session-sqlite-types.ts 162 retained
gateway-readiness.ts 162 retained
docs.ts 161 retained
doctor-gateway-dueling.ts 160 retained
doctor-lint-output.ts 159 retained
daemon-install-plan.shared.ts 158 retained
doctor-agent-deletion-journal.ts 158 retained
doctor-plugin-generations.ts 158 retained
doctor-sqlite-compact.ts 157 retained
onboard-non-interactive.ts 157 retained
doctor-auth-legacy-oauth.ts 156 retained
status-all/gateway.ts 155 retained
channel-setup/discovery.ts 153 changed
onboard-non-interactive/api-keys.ts 153 retained
doctor-plugin-model-catalog.ts 152 retained
status-all/channels-token-summary.ts 152 retained
auth-choice-options.ts 151 retained
sessions-table.ts 150 retained
doctor-bootstrap-size.ts 148 retained
doctor-session-store-owner.ts 148 retained
doctor-project-clone-shape.ts 147 retained
models/list.list-command.ts 147 retained
sandbox.ts 147 retained
doctor-web-fetch-proxy.ts 145 retained
configure.daemon.ts 142 retained
doctor-skills.ts 141 retained
migrate/apply.ts 139 retained
models/auth-list.ts 139 retained
doctor-maintenance-stale-service.ts 137 retained
doctor-update-snapshots.ts 137 retained
doctor-original-capture.ts 136 retained
telemetry-exporter-summary.ts 135 retained
doctor-node-hosting-preconditions.ts 134 retained
doctor-rehearsal-databases.ts 133 retained
status.scan.bootstrap-shared.ts 133 retained
backup-namespace.ts 132 retained
channels/shared.ts 132 retained
agent-exec-result.ts 131 retained
migrate/memory-import.ts 131 retained
models/aliases.ts 130 retained
doctor-whatsapp-responsiveness.ts 129 retained
triage-automatic-repair.ts 128 retained
systemd-linger.ts 127 retained
status.command-report-data.ts 126 retained
storage.ts 126 retained
channel-setup/channel-plugin-resolution.ts 125 retained
channels/status-config-format.ts 124 retained
doctor-maintenance-foreground.ts 124 retained
sessions-compact.ts 124 retained
doctor-session-sqlite-active.ts 123 retained
onboard-interactive-runner.ts 123 retained
status.format.ts 123 retained
onboard-guided-manual.ts 122 retained
doctor-update.ts 120 retained
channels/logs.ts 119 retained
configure.channels.ts 119 retained
doctor-heartbeat-session-target.ts 119 retained
backup-health.ts 117 retained
doctor-disk-space.ts 117 changed
onboard-config.ts 117 retained
doctor-config-preflight-migrations.ts 116 changed
doctor-format.ts 116 retained
system-agent-with-inference.ts 116 retained
doctor-migration-backup-artifacts.ts 115 retained
doctor-process.ts 115 retained
doctor-service-repair-policy.ts 114 retained
onboard-types.ts 113 retained
doctor-command-owner.ts 112 retained
doctor-gateway-auth-token.ts 112 retained
channel-setup/plugin-install.ts 111 retained
session-store-targets.ts 111 retained
doctor-service-audit.ts 110 retained
onboard-guided-consent.ts 109 retained
status-json-runtime.ts 109 changed
status-usage.runtime.ts 109 retained
config-validation.ts 108 retained
models/model-reference-validation.ts 108 retained
sessions-display-model.ts 107 retained
configure.gateway-health.ts 106 retained
doctor-config-audit-scrub.ts 106 changed
models/auth-credential-import.ts 106 retained
doctor-bun-cli-launcher.ts 105 retained
models/auth-relogin-identity.ts 105 retained
models/provider-aliases.ts 105 retained
backup.ts 103 retained
channels/status.ts 102 retained
doctor-main-session-recovery.ts 102 retained
node-runtime-diagnostics.ts 101 retained
doctor-session-sqlite-missing-index.ts 100 retained
status.agent-local.ts 100 retained
doctor-install.ts 99 retained
onboard-non-interactive/remote.ts 99 retained
sandbox-display.ts 98 retained
auth-choice.apply.ts 96 retained
doctor-session-sqlite-compact.ts 96 retained
doctor-session-exec-policy.ts 95 retained
models/list.probe.cleanup.ts 95 retained
models/list.table.ts 95 retained
doctor-skill-workshop-sources.ts 94 retained
status-overview-values.ts 94 retained
status-all/report-lines.ts 93 retained
channels/dead-letters.ts 92 retained
models/auth-refresh.ts 92 retained
doctor-host-desktop.ts 91 retained
doctor-install-policy.ts 91 retained
onboard-quickstart-host.ts 91 retained
status.scan.fast-json.ts 91 retained
doctor-prompter.ts 90 retained
gateway-status/discovery.ts 90 retained
status.service-summary.ts 90 retained
doctor-plugin-source-captures.ts 87 retained
doctor-database-preflight.ts 86 retained
doctor-update-rehearsal-paths.ts 86 retained
node-daemon-install-helpers.ts 85 retained
configure.shared.ts 84 retained
doctor-foreign-launchd-jobs.ts 84 retained
migrate/context.ts 84 retained
onboard-non-interactive/local/daemon-install.ts 84 retained
status-all.ts 84 retained
gateway-health-auth-diagnostic.ts 81 retained
status-overview-surface.ts 81 changed
doctor-tailscale.ts 79 retained
status-all/report-tables.ts 79 retained
startup-plugin-source-captures.ts 78 retained
daemon-install-auth-profile-env.ts 76 retained
doctor-agent-lease-refusal.ts 76 retained
doctor-session-sqlite-migration-coalesce.ts 76 retained
doctor-db-bloat.read.ts 75 retained
status.command-report.ts 75 retained
status.scan-result.ts 74 retained
doctor-state-sqlite-compact.ts 73 retained
triage-doctor.ts 73 retained
gateway-auth-token.ts 71 retained
doctor-gateway-legacy-services.ts 70 retained
doctor-startup-migration-refusal.ts 70 retained
doctor-update-rehearsal-workshop.ts 70 retained
doctor-original-capture-admission.ts 69 retained
onboard-non-interactive/local/auth-choice-inference.ts 68 retained
models/list.probe.models.ts 67 retained
onboard-options.ts 66 retained
status.node-mode.ts 66 retained
doctor-session-canonical-owner-evidence.ts 65 retained
doctor-config-preflight.cron.ts 64 retained
doctor-session-sqlite-warnings.ts 64 retained
models/list.manifest-catalog.ts 64 retained
status-json-payload.ts 64 retained
triage-handoff.ts 63 retained
onboard-interactive.ts 62 retained
doctor-tools-md-migration-guidance.ts 61 retained
gateway-setup-runtime.ts 61 retained
onboard-first-agent.ts 61 retained
status.scan.ts 60 retained
doctor-lint.worker.ts 59 retained
doctor-secret-runtime-degradation.ts 59 retained
agents.commands.team.ts 57 retained
auth-choice-options.static.ts 57 retained
doctor-unconfigured-agent-databases.ts 57 retained
migrate/providers.ts 57 retained
models/auth-activate.ts 57 retained
models/list.format.ts 57 retained
doctor-skills-core.ts 56 retained
doctor-memory-search-local.ts 55 retained
promos/list.ts 55 retained
status-json-command.ts 55 retained
status.scan-execute.ts 55 retained
gateway-startup-timing.ts 54 retained
gateway-presence.ts 52 retained
onboard-inference-ambient.ts 52 retained
doctor-stale-runtime-build.ts 51 retained
gateway-diagnostic-readiness.ts 51 retained
doctor-browser.ts 50 retained
doctor-maintenance-admission.ts 50 retained
doctor-session-sqlite-restore-report.ts 50 retained
doctor-gateway-runtime-plan.ts 49 retained
doctor-session-worktree-workspace.ts 49 retained
migrate/types.ts 48 retained
doctor-db-bloat.ts 47 retained
doctor-tools-md-migration-budget.ts 47 retained
models/model-selection.runtime.ts 47 retained
status.gateway-connection.ts 47 retained
agent-local-audit.ts 46 retained
cleanup-plan.ts 46 retained
configure.commands.ts 46 retained
doctor-hooks-model.ts 46 retained
doctor-repair-mode.ts 46 retained
backup-record.ts 45 retained
doctor-config-preflight-plugin-index.ts 45 retained
status-all/channels-table.ts 44 retained
auth-choice-legacy.ts 43 retained
models/auth-manual-input.ts 43 retained
models/load-config.ts 43 retained
doctor-agent-database-operation.ts 42 retained
status.daemon.ts 42 retained
auth-choice.apply.api-providers.ts 41 retained
doctor-retained-runtime.ts 41 retained
channel-setup/registry.ts 40 retained
doctor-skill-workshop-read.kernel.ts 40 retained
backup-summary.ts 39 retained
doctor-agent-database-paths.ts 39 retained
non-interactive-prompter.ts 39 retained
doctor.worker.ts 38 retained
status-all/text-report.ts 38 retained
status.scan-memory.ts 38 retained
doctor-maintenance-exit.ts 36 retained
daemon-runtime.ts 34 retained
doctor-backup-scratch.ts 34 retained
gateway-service-setup.ts 34 retained
migrate/item-selection.ts 33 retained
sqlite-wal-health.ts 32 retained
models/refresh.ts 31 retained
triage-claude.ts 31 retained
text-format.ts 30 retained
agents.binding-format.ts 29 retained
doctor-channel-ingress.ts 29 retained
models/list.types.ts 28 retained
channel-setup/config-compatibility.ts 27 retained
channels/plugin-config-persistence.ts 26 retained
models/set.ts 26 retained
onboard-non-interactive/local/skills-config.ts 25 retained
channel-setup/owner.ts 24 retained
doctor-memory-scope.ts 24 retained
onboard-hooks.ts 24 retained
onboard-non-interactive/local/workspace.ts 24 retained
daemon-install-runtime-warning.ts 22 retained
doctor-post-upgrade.types.ts 22 retained
status.gateway-probe.ts 22 retained
auth-choice.apply.types.ts 21 retained
doctor-lint.ts 21 retained
doctor-tools-md-migration-content.ts 21 retained
onboard-non-interactive/config-write.ts 20 retained
doctor-state.worker.ts 19 retained
models/set-image.ts 19 retained
doctor.types.ts 18 retained
status.gateway-probe-budget.ts 18 retained
model-picker.runtime.ts 17 retained
status-json.ts 17 retained
doctor-maintenance-types.ts 16 retained
onboard-non-interactive/local/auth-choice.plugin-providers.runtime.ts 16 retained
configure.prompts.ts 15 retained
doctor-lint-options.ts 14 retained
channels/runtime-label.ts 12 retained
doctor-config-preflight-measure.ts 12 retained
doctor-workspace-suggestions.ts 11 retained
status.command.text-runtime.ts 11 retained
models/alias-name.ts 10 retained
status.scan.runtime.ts 10 retained
channels/account-selector.ts 9 retained
status.scan.deps.runtime.ts 9 retained
channels/channel-selector.ts 8 retained
doctor-state-integrity-format.ts 8 retained
random-token.ts 6 retained
channels.ts 5 retained
codex-runtime-plugin-install.ts 5 retained
status.ts 5 retained
agent.ts 2 retained
agent/session.runtime.ts 2 retained
auth-token.ts 2 retained
daemon-install-auth-profiles-source.runtime.ts 2 retained
daemon-install-auth-profiles-store.runtime.ts 2 retained

Consolidate model, binding, installation, cleanup, Doctor, and status variants while preserving their CLI contracts and lifecycle boundaries. Retire replaced internal helpers and migrate their callers; tests retain behavior assertions and only change removed seams.
@clawsweeper

clawsweeper Bot commented Oct 8, 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 cli CLI command changes commands Command implementations size: XL labels Oct 8, 2026
@steipete
steipete marked this pull request as ready for review October 8, 2026 07:51
@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 8, 2026
@clawsweeper

clawsweeper Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed October 8, 2026, 4:07 AM ET / 08:07 UTC (Revision 2).

ClawSweeper review

What this changes

This PR consolidates repeated CLI mutation, plugin installation, service cleanup, Doctor repair reporting, and status formatting paths while preserving their existing contracts.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Useful consolidation with no actionable finding, supported by broad reported validation but limited shipped-entry evidence across the full scope.
Proof confidence 🦐 gold shrimp (3/6) Not applicable: The supplied MEMBER classification places this internal refactor outside the external-contributor proof gate. Reported isolated Doctor CLI coverage supports part of the change; historical consent screenshots do not prove this head. Persisted representations and write predicates remain compatible, with no migration required.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Refactor · Worth it: Yes
Reason: Repeated internal command paths create maintenance cost, and this consolidation removes duplication without expanding the product surface. Prior merged area history supports the author’s direction.

Merge readiness

✅ Ready for maintainer review

This PR remains useful maintenance work, with no concrete introduced defect found. The supplied maintainer-author classification also prevents automated closure.

Priority: P3
Reviewed head: 7223003e0ea498070880131744c32d80d8ae5b4b

Before merge

None.

Findings

None.

Provenance

  • src/commands/reset.ts and src/commands/uninstall.ts: original intent not found (unknown: The uninstall string-history search could not complete because an older promisor blob fetch returned HTTP 403; available recent history does not establish the original service-teardown introduction.)

Tests

  • Missing end-to-end proof: Reported Doctor coverage reaches the shipped CLI; the remaining consolidated commands have supporting tests rather than a complete shipped-entry execution record. No local runs were performed during this read-only review.
Agent review details

How this fits together

OpenClaw commands translate CLI requests into configuration updates, Gateway operations, installation, and maintenance work. These paths also turn results into human-readable messages and JSON output.

flowchart TD
  A[CLI request] --> B[Command dispatch]
  B --> C[Shared mutation and maintenance paths]
  D[Configuration and saved state] --> C
  C --> E[Existing Gateway and installation owners]
  E --> F[Operation results]
  F --> G[CLI messages and JSON]
Loading

Technical review

Best possible solution:

Keep one internal implementation for equivalent command work while retaining branch-specific output, consent, cancellation, and recovery contracts.

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

Not applicable: this PR proposes behavior-preserving consolidation and reports no product defect requiring reproduction.

Is this the best way to solve the issue?

Yes: the consolidation reuses existing operation owners, removes superseded internal helpers, and preserves distinct caller contracts without adding public configuration or SDK surface.

AGENTS.md: found and applied where relevant.

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

Provenance checked

Testing

Proof path: shipped entry point. Added test files: 6.

Security

None.

Evidence

What I checked:

  • Pinned introduction reviewed: The merge-base-to-head diff contains the command consolidation; endpoint drift was excluded from PR ownership. The checkout remained clean. (7223003e0ea4)
  • Installation boundaries retained: The shared installer retains artifact consent, expected integrity, the lifecycle lease, npm watchdog settlement, archive error propagation, and ClawHub wizard-navigation propagation. The timeout return still uses the same configuration object because next equals params.cfg. (src/commands/onboarding-plugin-install.ts:786, 7223003e0ea4)
  • Existing-state compatibility: Receipt consolidation preserves conditional previous-status predicates, completion fields, and transaction ownership. Session and Telegram repair consolidations retain the same persisted values and repair ordering; no schema or serialized-format change is introduced. (src/commands/doctor-auth-migration-receipts.ts:143, 7223003e0ea4)
  • Base drift distinguished: Raw test-merge records confirm parents 8a31a24 and the exact PR head. Current-main overlap is limited to baselines, separate CLI error-handling hunks, and a separate heartbeat await correction. Direct test-merge blob reads failed with HTTP 403, so those blobs were not independently inspected. (e941f8b04c85)
  • Area history: Available commit history identifies Peter Steinberger's prior maintenance of command, installation, model, and Doctor paths. Supplied merged-feature context also identifies gumadeiras for account-scoped agent bindings. Deeper account and uninstall string-history searches failed because required older blobs could not be fetched through the proxy. (src/commands/agents.commands.bind.ts, 30d563e262aa)
  • Reported validation and continuity: The PR body reports 7,995 passing command tests on ed58743, with affected final-head reruns, typechecks, API comparison, and cycle checks. Supplied exact-head CI includes a successful ci-gate. The previous review examined this same head and listed no findings; no tests or target review helpers were executed here. (7223003e0ea4)

Likely related people:

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

PR surface

Source -639, Tests -18, Other -4. Total -661 across 52 files.

View PR surface stats
Area Files Added Removed Net
Source 43 1035 1674 -639
Tests 7 79 97 -18
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 2 1 5 -4
Total 52 1115 1776 -661

Stored data model

Persistent data-model change detected: migration/backfill/repair: src/commands/doctor-auth-migration-receipts.ts, migration/backfill/repair: src/commands/doctor-claude-cli.ts, migration/backfill/repair: src/commands/doctor-completion.ts, migration/backfill/repair: src/commands/doctor-config-audit-scrub.ts, migration/backfill/repair: src/commands/doctor-config-preflight-migrations.ts, migration/backfill/repair: src/commands/doctor-config-preflight.ts, and 25 more. Migration or upgrade compatibility proof is recorded; maintainers should verify it before merge.

Labels

Label changes:

No label changes.

Label justifications:

  • P3: This is internal maintenance with no intended change to user-facing behavior.
  • 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.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only; repair and merge need explicit maintainer commands such as @clawsweeper autofix or @clawsweeper automerge.

History

Review history (1 earlier review cycle)
  • reviewed 2026-10-08T08:00:25.970Z sha 7223003 :: needs maintainer review before merge. :: none

@steipete
steipete merged commit 60f7030 into main Oct 8, 2026
215 of 216 checks passed
@steipete
steipete deleted the deslop/d20-commands-20261007 branch October 8, 2026 08:20
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 9, 2026
…penclaw#167043)

* refactor(commands): share command mutation and reporting paths

Consolidate model, binding, installation, cleanup, Doctor, and status variants while preserving their CLI contracts and lifecycle boundaries. Retire replaced internal helpers and migrate their callers; tests retain behavior assertions and only change removed seams.

* fix(commands): preserve transcript typing and UI progress text

* test(cli): preserve model handler exports in partial mocks

* refactor(commands): remove unused title repair report alias

* refactor(commands): preserve catalog entry cloning

* test(commands): keep status fixture details internal
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 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