Skip to content

refactor(cli): deslop CLI and Doctor command flows - #164669

Merged
steipete merged 2 commits into
mainfrom
deslop/l358-cli-commands2-simplify
Oct 4, 2026
Merged

steipete merged 2 commits into
mainfrom
deslop/l358-cli-commands2-simplify

Conversation

@steipete

@steipete steipete commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

CLI and Doctor flows retain duplicate decision paths, unused internal options, and a sandbox-registry importer whose last JSON writer predates the supported migration window.

User Impact

Normal CLI output, flags, exit codes, and July-or-later migration behavior stay unchanged. Doctor now reports retained pre-July sandbox JSON registries and refuses repair without changing their bytes; operators must upgrade through 2026.9.7 and run openclaw doctor --fix on the original host first. Current SQLite sandbox registries remain supported.

Repairing a subagent allowlist containing both a stale agent ID and malformed values no longer crashes. Doctor preserves malformed values for the existing config validator.

Why This Change Was Made

This second pass follows the merged file inventories from #163840 and #164159. It removes 1,000 net production lines in one batch. The open deslop PR overlap check was refreshed before validation; audit, cron, heartbeat/Automations, and PR-tooling ownership remains untouched.

  • Retire the pre-July sandbox JSON importer, keeping existence-only diagnostics and the canonical intermediate-upgrade refusal. Commit ce015cef577 removed the writers on June 7; none of the 189 published versions lacking that cutover was published on or after July 1. Supported July and extended-stable writers use SQLite, and 2026.9.7 retains the importer.
  • Remove snapshot inspection and dashboard readiness test-only injection hooks while preserving lazy imports and testing the real command boundaries.
  • Keep one model-runtime repair sequence and direct fixed runtime descriptors, replacing factories and duplicated caller coordination.
  • Carry one selected sandbox runtime list and session-tail watermarks directly, removing impossible parallel state and intermediate projections.
  • Remove redundant downstream onboarding admission and already-narrowed auth branches.
  • Reuse the updater's continuously held plugin lifecycle lease, its guaranteed delegated database authority, one config-source comparison, and the existing deferred owner. Remove the unused plugin-requirements input and its unreachable assessment variants.
  • Execute web migrations directly, share context-budget traversal and vLLM target handling, simplify Claude alias matching and sandbox inheritance, and derive plugin replacement IDs without an unused candidate map.
  • Use the existing terminal theme, option inheritance, channel Doctor adapters, and normalization owners instead of forwarding layers and repeated policy.

Fixes Found Along the Way

maybeRepairStaleSubagentAllowlists skipped non-string values while scanning but called .trim() on them during repair. Its repair now removes only stale string IDs and preserves malformed entries and the original input. The regression exercises the repair boundary without a new production seam.

Evidence

  • Linux AWS Crabbox: 55 selected files passed (1,169 tests; one existing skip). The additional sandbox registry suite passed 13 tests. Final channel-doctor and retired-registry confirmations also passed.
  • The malformed-allowlist regression fails against the original owner with entry.trim is not a function, then passes with the fix.
  • Required changed-file components passed across the recorded runs: ratchets, formatting, core and all core-test typechecks, Knip, native lint, and the remaining storage/protocol guards. The final continuation used the repository planner and its ordinary changed-file policy; four untouched max-line violations remain warnings. Both import-cycle checks report zero.
  • The candidate includes the required three-entry assertion-baseline shrink. All 62 candidate source hashes matched the prepared worktree/candidate patch before final proof. New retired-registry file: 7 tests, 9.60s wrapper wall time (6.62s Vitest, predominantly transformation); allowlist file: 4 tests, 2.27s wrapper wall time (565ms Vitest). No sleeps, retries, skipped assertions, or new production testing seams were introduced.
  • Independent P2 review completed. Findings were checked against the option-inheritance owner, the existing empty-provider guard, and the vLLM variadic signature plus passing typechecks; none remained actionable.
  • Applied the approved shrink-only assertion baseline update. Fresh main merges without conflicts, so no history rewrite was needed. All 62 recorded candidate hashes were rechecked against the final committed tree, with complete coverage of changed files. The completed cycle/type/test proof is reused for identical inputs; a redundant fresh AWS run stalled during sync before executing checks. Hosted CI validates the published head.

Retire pre-July sandbox JSON registry imports with preserved-source upgrade guidance. Simplify CLI, model runtime, update, and Doctor owners while retaining supported output and migration contracts. Preserve malformed subagent allowlist values during stale-target repair.
@clawsweeper

clawsweeper Bot commented Oct 4, 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 cli CLI command changes commands Command implementations docker Docker and sandbox tooling agents Agent runtime and tooling labels Oct 4, 2026
@github-actions

github-actions Bot commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

⚠️ Security sensitive changes

This maintainer PR changes sensitive security components.

No secops approval is required. This comment is informational because the PR author has Maintain or Admin access.

  • Current SHA: a7cc5c08d0500b1d5fd40c29b518975a8f7c7432
  • Maintainer: @steipete
  • Repository role: admin

These security sensitive changes were made:

  • src/agents/sandbox/registry.kernel.ts: Controls sandbox containment or tool execution authority. Check filesystem and network isolation, approval scope, and command allowlists.

Carefully review these changes before merging.

@steipete
steipete enabled auto-merge (squash) October 4, 2026 01:32
@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 4, 2026
@clawsweeper

clawsweeper Bot commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed October 3, 2026, 9:36 PM ET / October 4, 2026, 01:36 UTC.

ClawSweeper review

What this changes

The branch simplifies CLI and Doctor flows, retires pre-July sandbox JSON imports with intermediate-upgrade guidance, and prevents malformed subagent allowlists from crashing repair.

Merge readiness

⛔ Blocked before merge - 3 items remain

The PR contains useful work that current main does not implement, and no concrete introduced code defect was found. Its migration retirement still needs upgrade-boundary validation.

Priority: P2
Reviewed head: a7cc5c08d0500b1d5fd40c29b518975a8f7c7432

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The patch is useful and source review found no discrete defect, but migration upgrade evidence remains incomplete.
Proof confidence 🌊 off-meta tidepool Not applicable: The verified repository-admin author is exempt from ordinary external-contributor proof. Reported tests exercise Doctor and updater owners, but the sandbox import retirement lacks an executed published-driver × candidate upgrade trace; existing-state compatibility is assessed independently.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The verified repository-admin author is exempt from ordinary external-contributor proof. Reported tests exercise Doctor and updater owners, but the sandbox import retirement lacks an executed published-driver × candidate upgrade trace; existing-state compatibility is assessed independently.
Evidence reviewed 11 items Pinned introduction and merge ownership: Reviewed the merge-base-to-head introduced hunks. Raw test-merge records confirm the pinned base followed by the exact PR head; base-only changes were not attributed to this branch.
Intentional retirement and preserved inputs: Doctor now checks the four sandbox registry paths using lstat and refuses repair through the existing retired-state owner. The complete PR body explicitly identifies the intermediate-upgrade requirement; that intentional tradeoff does not need renewed acceptance.
Existing migration retention contract: The documented policy permits retirement of formats whose last shipped writer predates July 1, requires preserving source data, and requires an intermediate-release recovery route.
Findings None None.
Security None None.

How this fits together

CLI commands and Doctor translate operator requests and existing configuration into diagnostics, repairs, and service operations. The updater invokes these owners while protecting installation authority and persisted state.

flowchart TD
  A[Operator commands] --> B[CLI admission]
  B --> C[Doctor and update owners]
  D[Configuration and stored state] --> C
  C --> E{Supported state format}
  E -->|Current| F[Guarded repairs and service operations]
  E -->|Retired| G[Preserved files and upgrade guidance]
Loading

Before merge

  • Resolve merge risk (P1) - Retained sandbox JSON now makes Doctor repair stop and requires an intermediate upgrade. The available evidence does not yet demonstrate a published updater safely handling that refusal, preserving the previous Gateway, or successfully upgrading existing SQLite state.
  • Complete next step (P2) - Record the published 2026.9.7 updater × candidate compatibility result for fresh state, existing SQLite state, and retained sandbox JSON, including safe refusal/service recovery and successful intermediate migration.
  • Add data-model compatibility proof - Confirm migration or upgrade compatibility proof before merge.
Agent review details

Security

None.

PR surface

Source -1000, Tests -550, Docs +6, Other -2. Total -1546 across 61 files.

View PR surface stats
Area Files Added Removed Net
Source 44 667 1667 -1000
Tests 14 368 918 -550
Docs 2 7 1 +6
Config 0 0 0 0
Generated 0 0 0 0
Other 1 1 3 -2
Total 61 1043 2589 -1546

Review metrics

Metric Value Why it matters
Retired upgrade inputs 4 sandbox registry paths Two JSON files and two shard directories now require an intermediate release instead of direct Doctor import.

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-plugins-internals.ts, migration/backfill/repair: src/commands/doctor-auth.ts, migration/backfill/repair: src/commands/doctor-sandbox-legacy-registry.ts, migration/backfill/repair: src/commands/doctor-sandbox.ts, migration/backfill/repair: src/commands/doctor-session-snapshots.ts, and 22 more. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Verify the published upgrade boundary (recommended)
    Record a published 2026.9.7 updater exercising the candidate with existing SQLite and retained sandbox JSON, including preserved state, safe refusal/service recovery, and successful intermediate migration.

Technical review

Best possible solution:

Keep the documented retirement and simpler owners, with verified staged-upgrade recovery and unchanged operation for fresh and existing SQLite installations.

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

Yes, source establishes the ancillary crash: repair an allowlist containing a stale string target and a non-string value on current main. The PR reports a failing regression, but this read-only review did not execute it.

Is this the best way to solve the issue?

Yes, the refactor uses existing owners and preserves upstream admission and write guards; retiring the importer matches the documented retention policy. Upgrade validation remains necessary before landing.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P2: The useful cleanup includes a bounded Doctor crash fix and a compatibility-sensitive migration retirement.
  • add merge-risk: 🚨 compatibility: The explicitly documented JSON retirement changes old-state recovery, and published-updater compatibility proof 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: The verified repository-admin author is exempt from ordinary external-contributor proof. Reported tests exercise Doctor and updater owners, but the sandbox import retirement lacks an executed published-driver × candidate upgrade trace; existing-state compatibility is assessed independently.

Label justifications:

  • P2: The useful cleanup includes a bounded Doctor crash fix and a compatibility-sensitive migration retirement.
  • merge-risk: 🚨 compatibility: The explicitly documented JSON retirement changes old-state recovery, and published-updater compatibility proof 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: The verified repository-admin author is exempt from ordinary external-contributor proof. Reported tests exercise Doctor and updater owners, but the sandbox import retirement lacks an executed published-driver × candidate upgrade trace; existing-state compatibility is assessed independently.

Evidence

What I checked:

  • Pinned introduction and merge ownership: Reviewed the merge-base-to-head introduced hunks. Raw test-merge records confirm the pinned base followed by the exact PR head; base-only changes were not attributed to this branch. (8673715a96fa)
  • Intentional retirement and preserved inputs: Doctor now checks the four sandbox registry paths using lstat and refuses repair through the existing retired-state owner. The complete PR body explicitly identifies the intermediate-upgrade requirement; that intentional tradeoff does not need renewed acceptance. (src/commands/doctor-sandbox.ts:410, a7cc5c08d050)
  • Existing migration retention contract: The documented policy permits retirement of formats whose last shipped writer predates July 1, requires preserving source data, and requires an intermediate-release recovery route. Public docs: docs/gateway/doctor/config-migrations.md. (docs/gateway/doctor/config-migrations.md:31, a7cc5c08d050)
  • Sandbox SQLite cutover provenance: GitHub identifies the sandbox registry SQLite cutover as ce015ce, committed June 7, 2026. The PR additionally reports checking publication dates; that full publication inventory was not independently reconstructed. (src/agents/sandbox/registry.ts, ce015cef5775)
  • Intermediate release retains the importer: The v2026.9.7 Doctor source imports and calls migrateLegacySandboxRegistryFiles. GitHub resolves that release to c074824. This establishes the recovery implementation, but not an executed staged upgrade. (src/commands/doctor-sandbox.ts:407, c074824a27c9)
  • Meaningful fix remains absent from main: Pinned current-main source still calls entry.trim() without narrowing malformed allowlist values during repair. The branch preserves non-string entries for validation and includes a focused regression; the complete PR body reports its original failure and subsequent pass. (src/commands/doctor/shared/stale-subagent-allowlist.ts:143, f415c15d9b91)

Likely related people:

  • steipete: 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 the published-updater compatibility trace for existing SQLite, retained sandbox JSON refusal, and intermediate-release recovery.

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.

@steipete
steipete merged commit 02aa587 into main Oct 4, 2026
146 of 151 checks passed
@steipete
steipete deleted the deslop/l358-cli-commands2-simplify branch October 4, 2026 01:47
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 4, 2026
* refactor(cli): deslop CLI and Doctor command flows

Retire pre-July sandbox JSON registry imports with preserved-source upgrade guidance. Simplify CLI, model runtime, update, and Doctor owners while retaining supported output and migration contracts. Preserve malformed subagent allowlist values during stale-target repair.

* refactor(cli): shrink assertion ratchet for simplifications
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling cli CLI command changes commands Command implementations docker Docker and sandbox tooling 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. security-sensitive-changed 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