Skip to content

refactor(commands): deslop commands, CLI, and infrastructure - #163840

Merged
steipete merged 1 commit into
mainfrom
deslop/l315-deslop-commands-cli-infra-20261002
Oct 2, 2026
Merged

steipete merged 1 commit into
mainfrom
deslop/l315-deslop-commands-cli-infra-20261002

Conversation

@steipete

@steipete steipete commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Commands, Doctor, and infrastructure repeat option forwarding, migration traversal, result projection, and error handling that already have canonical owners.

User Impact

No intended user-visible change. CLI flags, messages, exit codes, JSON output, migration precedence, persisted data, and authorization checks stay unchanged. Supported July 2026-and-later migrations and the older-Gateway node-list fallback remain supported.

Why This Change Was Made

This combines the subsystem cleanup into one batch, removing 1,459 net production lines instead of paying for separate CI runs for each small simplification.

  • Consolidate onboarding installation, auth selection, migration item selection, and cleanup reporting; retain branch-specific consent and error behavior.
  • Reuse Doctor's model-slot traversal, parsing, package identification, report projection, and session-key collection instead of parallel implementations and forwarding helpers.
  • Let status reports consume their existing overview facts directly, and share archive/storage command registration.
  • Map device-pairing authority refusals at the mutation owner after admission and publication settle; preserve locks, revalidation, cleanup, and each caller's return shape.
  • Consolidate receipt-authoritative APNs/MCP source cleanup at the source-claim owner, keeping each migration's safe reader and receipt commit.
  • Remove redundant outbound target forwarding and reuse existing filesystem, normalization, and text helpers.

Updater lifecycle, dependencies, schemas, and plugin SDK contracts are unchanged. The native assertion-baseline tool records five removed assertions; no allowance grows. No newly discovered product bugs or flaky-test fixes are included.

Evidence

  • Both import-cycle checks passed again on the final rebased head: 0 Madge cycles and 0 runtime-value cycles.
  • AWS focused run: 3,324 passed, 2 skipped, and one inherited Doctor fixture failure across 174 files. The same failure reproduced on the clean base. The branch now includes the upstream repair from fix(test): stop Doctor integrity teardown from breaking commands #163777; no duplicate fix is included.
  • The complete changed-file gate passed, including production/test types, lint, dead exports, boundaries, and ratchets. The final Gateway send rerun passed all 83 tests. Git range-diff confirms the rebase preserved the cleanup patch.
  • After the final Testbox exceeded the ten-minute queue limit, the local nice -n 15 confirmation completed with 82 Gateway tests passing and one 120-second timeout in the Telegram live-owner test; Doctor did not run because the first group failed. Native worker compilation took 566 seconds under severe host load. The failure is recorded, not counted as passing proof.
  • A later local cache-identity diagnostic spent 528 seconds preparing worker bundles and was canceled through its owned runner after the independent hosted run established the identical pre-existing failure. It produced no completed test verdict and is not counted as proof.
  • Exact-head CI 37074925001 passed types, lint, architecture, builds, Windows, and most test shards. Five test jobs failed; every failure has matching pre-existing evidence below. The tests and the relevant refusal, worker-admission, session mutation, and cache-validity owners are unchanged by this cleanup. Landing uses the maintainer-authorized inherited-failure exception, pinned to 714c365b1775c10760276a4dbc8bbf05141d4e5d; no green-CI claim is made.
  • Independent autoreview is scoped-clean at P0/P1 after supplying unchanged owner context: the early ref-mode branch still enforces env-reference precedence; all migration command entrypoints retain the Codex-only flag guard; the cleanup serializer already normalizes local paths while delegated paths bypass it. Existing tests cover all three contracts.
  • Blacksmith admission expired before checkout (run); validation moved to direct AWS Linux compute.

Release-note context: internal cleanup only; no operator action or migration required.

CI failure attribution

PR job Failure Baseline evidence
checks-node-changed-compact-small-18 session-reaper.test.ts: shared exact store discovers [main] instead of [main, ops] Same assertion on main run 37072934260.
checks-node-changed-compact-large-1 session-sharing-groups.test.ts: expected seeded host database to be defined Same error on main run 37072934260. Worker-backed seeding no longer promises an open host database.
checks-node-changed-compact-large-21 doctor-config-preflight.test.ts: retired Discord channel allow fixture refused Same test/error on independent PR run 37071278542. Discord retirement predates this cleanup.
checks-node-changed-1 doctor.auth-profile-consumers.e2e.test.ts: two maintenance-entry refusals Same cases/error on independent PR run 37071278542. The fixture starts asynchronous worker retirement through a synchronous close, then blocks the parent event loop with spawnSync.
checks-node-changed-compact-large-6 session-accessor.sqlite-data-version.test.ts: identical values lose object identity after transcript append Same test/identity assertion on independent PR run 37071278542. The changed fingerprint parser is used by quarantine-receipt decoding, not this cache validity path.

The session-sharing job additionally failed rechecks group members at transaction admission for a defaults update: the mutation correctly rejected revoked authorization, but the broad worker-admission spy observed a commit (true instead of false). The exact test, error, and assertion at line 409 also failed on main run 37067275144, before this PR. It passed in the next hourly main run, so that later pass is not presented as a repair. Its underlying race remains coordinator-owned. No tests, timeouts, assertions, or admission checks have been weakened.

Merged as b0072ac3c36eaeeed2f03834f279d4df268c8e5f; ancestry verified on fresh origin/main. The five failed jobs above remain inherited CI issues for the coordinator.

@clawsweeper

clawsweeper Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review in progress

ClawSweeper is reviewing this revision. This supersedes any previous blocked status.

View the workflow run.

@github-actions

github-actions Bot commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

⚠️ Security sensitive changes

This maintainer PR changes sensitive security components. This comment is informational because the PR author has repository Maintain or Admin access.

  • Current SHA: 714c365b1775c10760276a4dbc8bbf05141d4e5d
  • Maintainer: @steipete
  • Repository role: admin

These security sensitive changes were made:

  • src/infra/device-bootstrap.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.
  • src/infra/device-pairing-approval.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.
  • src/infra/device-pairing-node-facts.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.
  • src/infra/device-pairing-node.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.
  • src/infra/device-pairing-tokens.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.
  • src/infra/device-pairing-worker.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.
  • src/infra/device-pairing.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.
  • src/infra/exec-approval-forwarder.ts: Controls sandbox containment or tool execution authority. Check filesystem and network isolation, approval scope, and command allowlists.

Carefully review these changes before merging.

@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime cli CLI command changes commands Command implementations size: XL labels Oct 2, 2026
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 2, 2026
@clawsweeper

clawsweeper Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed October 2, 2026, 7:28 PM ET / 23:28 UTC (Revision 2).

ClawSweeper review

What this changes

The branch consolidates repeated CLI, onboarding, Doctor repair, status reporting, pairing, and migration logic into shared owners while preserving existing behavior.

Merge readiness

⛔ Blocked before merge - 2 items remain

Keep open: this maintainer-authored cleanup remains distinct from current main. No actionable introduced defect was found, and the prior generic upgrade warning is not supported by the inspected changes. Exact-head CI remains unresolved.

Priority: P3
Reviewed head: 714c365b1775c10760276a4dbc8bbf05141d4e5d

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A useful consolidation with substantial reported validation and no concrete source finding; unresolved CI remains a separate landing gate.
Proof confidence 🌊 off-meta tidepool Not applicable: The maintainer-author exemption applies to this internal refactor. Pairing refusal projection and migration cleanup retain their existing production boundaries; inspected tests and reported CI are supplemental evidence, and this reviewer executed no runtime scenario. No stored-data contract change was identified.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The maintainer-author exemption applies to this internal refactor. Pairing refusal projection and migration cleanup retain their existing production boundaries; inspected tests and reported CI are supplemental evidence, and this reviewer executed no runtime scenario. No stored-data contract change was identified.
Evidence reviewed 10 items Pinned introduction and merge result: Inspected the introduced merge-base-to-head diff across all 101 paths. Raw test-merge parents are the pinned base followed by the exact PR head; the inspected merge-result hunks retain the same pairing, source-cleanup, and API-key changes.
Current-main necessity: Current main has no changes since the merge base in the sampled central pairing, onboarding-installation, and migration-source owners. The branch's consolidation is therefore still distinct from main; the related merged Doctor fixture repair does not implement this cleanup.
Pairing authority remains at commit: The worker still checks current state and caller authority at transaction and commit admission, installs committed publications, and finishes settlement before mapping the same refusal exception to caller-specific results. This changes error projection without materially changing who can perform the final effect.
Findings None None.
Security None None.

How this fits together

OpenClaw's command layer turns operator options and existing configuration into setup, diagnostics, and repairs. Shared infrastructure carries those operations through authorization, persistent state, and message routing.

flowchart TD
  A[Operator commands] --> B[CLI validation]
  C[Existing configuration and state] --> D[Doctor and onboarding]
  B --> D
  D --> E[Shared infrastructure owners]
  E --> F[Authorization and commit checks]
  F --> G[State updates and message routing]
  E --> H[Operator reports]
Loading

Before merge

  • 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

None.

Stored data model

Persistent data-model change detected: migration/backfill/repair: config/assertion-safety-baseline.txt, migration/backfill/repair: src/commands/doctor-auth-oauth-sidecar.ts, migration/backfill/repair: src/commands/doctor-heartbeat-main-session-repair.ts, migration/backfill/repair: src/commands/doctor-heartbeat-scratch-migration.ts, migration/backfill/repair: src/commands/doctor-heartbeat-task-migration.ts, migration/backfill/repair: src/commands/doctor-main-session-recovery.ts, and 39 more. Confirm migration or upgrade compatibility proof before merge.

Technical review

Best possible solution:

Use the shared owners while preserving existing command output, migration precedence, receipt handling, and commit-time authorization.

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

Not applicable: this PR proposes behavior-preserving cleanup, and source review found no concrete introduced failure to reproduce.

Is this the best way to solve the issue?

Yes: consolidating equivalent operations into their existing owners is maintainable, and the inspected callers retain their validation, consent, and refusal contracts.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

No label changes.

Label justifications:

  • P3: This is internal cleanup with no intended user-visible behavior change; failing CI alone does not increase product priority.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; 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 maintainer-author exemption applies to this internal refactor. Pairing refusal projection and migration cleanup retain their existing production boundaries; inspected tests and reported CI are supplemental evidence, and this reviewer executed no runtime scenario. No stored-data contract change was identified.

Evidence

What I checked:

  • Pinned introduction and merge result: Inspected the introduced merge-base-to-head diff across all 101 paths. Raw test-merge parents are the pinned base followed by the exact PR head; the inspected merge-result hunks retain the same pairing, source-cleanup, and API-key changes. (714c365b1775)
  • Current-main necessity: Current main has no changes since the merge base in the sampled central pairing, onboarding-installation, and migration-source owners. The branch's consolidation is therefore still distinct from main; the related merged Doctor fixture repair does not implement this cleanup. (src/infra/device-pairing-worker.ts, 73fe145a1e6e)
  • Pairing authority remains at commit: The worker still checks current state and caller authority at transaction and commit admission, installs committed publications, and finishes settlement before mapping the same refusal exception to caller-specific results. This changes error projection without materially changing who can perform the final effect. (src/infra/device-pairing-worker.ts:194, 714c365b1775)
  • Migration cleanup preserves its contract: The shared cleanup visits the original and claim names in the same order, invokes the existing safe reader before removal, and leaves receipt updates with the APNs and MCP migration callers. MCP retains its cleanup-only parseStore:false reader. SQL column lists and persisted field values remain equivalent; no stored-data contract change was identified. (src/infra/state-migrations.source-snapshot.ts:269, 714c365b1775)
  • Prior compatibility concern checked: The earlier review reported no findings and a generic config/default compatibility action. Removed node-manager validation remains in the onboarding entry-point owner; all three migration entry points retain the Codex-only flag guard. The early SecretRef branch retains environment-reference precedence, and strict unresolved-secret paths throw before degraded diagnostics are produced. (src/commands/onboard-options.ts:61, 714c365b1775)
  • Retained boundary coverage: Inspected existing tests for revoked approval before worker commit and receipt-authoritative APNs/MCP retries that must not resurrect deleted canonical state. These are supplemental source evidence; this read-only review did not execute tests. (src/infra/device-pairing-worker.test.ts:162, 714c365b1775)

Likely related people:

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

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-02T22:59:04.829Z sha 714c365 :: blocked before merge. :: none

@steipete
steipete enabled auto-merge (squash) October 2, 2026 23:04
@steipete
steipete merged commit b0072ac into main Oct 2, 2026
202 of 211 checks passed
@steipete
steipete deleted the deslop/l315-deslop-commands-cli-infra-20261002 branch October 2, 2026 23:41
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 3, 2026
…w#163840)

## What Problem This Solves

Commands, Doctor, and infrastructure repeat option forwarding, migration traversal, result projection, and error handling that already have canonical owners.

## User Impact

No intended user-visible change. CLI flags, messages, exit codes, JSON output, migration precedence, persisted data, and authorization checks stay unchanged. Supported July 2026-and-later migrations and the older-Gateway node-list fallback remain supported.

## Why This Change Was Made

This combines the subsystem cleanup into one batch, removing 1,459 net production lines instead of paying for separate CI runs for each small simplification.

- Consolidate onboarding installation, auth selection, migration item selection, and cleanup reporting; retain branch-specific consent and error behavior.
- Reuse Doctor's model-slot traversal, parsing, package identification, report projection, and session-key collection instead of parallel implementations and forwarding helpers.
- Let status reports consume their existing overview facts directly, and share archive/storage command registration.
- Map device-pairing authority refusals at the mutation owner after admission and publication settle; preserve locks, revalidation, cleanup, and each caller's return shape.
- Consolidate receipt-authoritative APNs/MCP source cleanup at the source-claim owner, keeping each migration's safe reader and receipt commit.
- Remove redundant outbound target forwarding and reuse existing filesystem, normalization, and text helpers.

Updater lifecycle, dependencies, schemas, and plugin SDK contracts are unchanged. The native assertion-baseline tool records five removed assertions; no allowance grows. No newly discovered product bugs or flaky-test fixes are included.

## Evidence

- Both import-cycle checks passed again on the final rebased head: 0 Madge cycles and 0 runtime-value cycles.
- AWS focused run: 3,324 passed, 2 skipped, and one inherited Doctor fixture failure across 174 files. The same failure reproduced on the clean base. The branch now includes the upstream repair from openclaw#163777; no duplicate fix is included.
- The complete changed-file gate passed, including production/test types, lint, dead exports, boundaries, and ratchets. The final Gateway send rerun passed all 83 tests. Git range-diff confirms the rebase preserved the cleanup patch.
- After the final Testbox exceeded the ten-minute queue limit, the local `nice -n 15` confirmation completed with 82 Gateway tests passing and one 120-second timeout in the Telegram live-owner test; Doctor did not run because the first group failed. Native worker compilation took 566 seconds under severe host load. The failure is recorded, not counted as passing proof.
- Exact-head CI [37074925001](https://github.com/openclaw/openclaw/actions/runs/37074925001) passed types, lint, architecture, builds, Windows, and most test shards. Five test jobs failed; every failure has matching pre-existing evidence below. The tests and the relevant refusal, worker-admission, session mutation, and cache-validity owners are unchanged by this cleanup. Landing uses the maintainer-authorized inherited-failure exception, pinned to `714c365b1775c10760276a4dbc8bbf05141d4e5d`; no green-CI claim is made.
- Independent autoreview is scoped-clean at P0/P1 after supplying unchanged owner context: the early ref-mode branch still enforces env-reference precedence; all migration command entrypoints retain the Codex-only flag guard; the cleanup serializer already normalizes local paths while delegated paths bypass it. Existing tests cover all three contracts.
- Blacksmith admission expired before checkout ([run](https://github.com/openclaw/openclaw/actions/runs/37057668205)); validation moved to direct AWS Linux compute.

Release-note context: internal cleanup only; no operator action or migration required.

### CI failure attribution

| PR job | Failure | Baseline evidence |
| --- | --- | --- |
| `checks-node-changed-compact-small-18` | `session-reaper.test.ts`: shared exact store discovers `[main]` instead of `[main, ops]` | Same assertion on [main run 37072934260](https://github.com/openclaw/openclaw/actions/runs/37072934260/job/111056682704). |
| `checks-node-changed-compact-large-1` | `session-sharing-groups.test.ts`: expected seeded host database to be defined | Same error on [main run 37072934260](https://github.com/openclaw/openclaw/actions/runs/37072934260/job/111056682541). Worker-backed seeding no longer promises an open host database. |
| `checks-node-changed-compact-large-21` | `doctor-config-preflight.test.ts`: retired Discord channel `allow` fixture refused | Same test/error on [independent PR run 37071278542](https://github.com/openclaw/openclaw/actions/runs/37071278542/job/111051475776). Discord retirement predates this cleanup. |
| `checks-node-changed-1` | `doctor.auth-profile-consumers.e2e.test.ts`: two maintenance-entry refusals | Same cases/error on [independent PR run 37071278542](https://github.com/openclaw/openclaw/actions/runs/37071278542/job/111051475801). The fixture starts asynchronous worker retirement through a synchronous close, then blocks the parent event loop with `spawnSync`. |
| `checks-node-changed-compact-large-6` | `session-accessor.sqlite-data-version.test.ts`: identical values lose object identity after transcript append | Same test/identity assertion on [independent PR run 37071278542](https://github.com/openclaw/openclaw/actions/runs/37071278542/job/111051475748). The changed fingerprint parser is used by quarantine-receipt decoding, not this cache validity path. |

The session-sharing job additionally failed `rechecks group members at transaction admission for a defaults update`: the mutation correctly rejected revoked authorization, but the broad worker-admission spy observed a commit (`true` instead of `false`). The exact test, error, and assertion at line 409 also failed on [main run 37067275144](https://github.com/openclaw/openclaw/actions/runs/37067275144/job/111038492452), before this PR. It passed in the next hourly main run, so that later pass is not presented as a repair. Its underlying race remains coordinator-owned. No tests, timeouts, assertions, or admission checks have been weakened.
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 gateway Gateway runtime P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. 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