Repository navigation
refactor(infra): deslop infra - #164538
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
|
Codex review: needs maintainer review before merge. Reviewed October 3, 2026, 8:44 PM ET / October 4, 2026, 00:44 UTC (Revision 5). ClawSweeper reviewWhat this changesThe PR removes redundant infrastructure helpers and worker parameters while preserving command approvals, device pairing, ClawHub requests, diagnostics, and HTTP handling. Merge readiness✅ Ready for maintainer review This remains useful cleanup absent from current main. No blocking introduced defect was identified, and the documented inherited UI failure does not justify changes to this branch. Priority: P3 Review scores
Verification
How this fits togetherOpenClaw’s infrastructure connects command and pairing requests to authorization and SQLite owners, and package requests to the shared ClawHub client. These helpers feed approved execution, paired-device state, downloads, and operational output. flowchart TD
A[Command and device requests] --> B[Infrastructure adapters]
B --> C[Authorization checks]
C --> D[SQLite worker owner]
D --> E[Approved execution and pairing state]
F[Package requests] --> G[ClawHub client]
G --> H[Validated downloads]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource -612, Tests +15. Total -597 across 42 files. View PR surface stats
Review metricsNone. Technical reviewBest possible solution: Keep the existing authorization and storage owners while removing their redundant internal forwarding and projections. Do we have a high-confidence way to reproduce the issue? Not applicable: this is a behavior-preserving refactor. Existing boundary tests and reported focused runs support equivalence; no runtime execution was performed during this read-only review. Is this the best way to solve the issue? Yes: the inspected changes simplify existing owners without creating competing implementations or altering public contracts. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against ca267fa035f8. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (4 earlier review cycles)
|
|
The UI outcome failure is reproduced on clean main and is independent of this infra refactor. No test or UI production code was changed to handle this failure. On the same Blacksmith Testbox ( node scripts/run-vitest.mjs run --config test/vitest/vitest.ui-e2e.config.ts --configLoader runner --project ui-e2e-bundled ui/src/e2e/chat-tool-turn-outcome.e2e.test.ts -t 'preserves item-only outcomes in expanded live rows and after history reload'Main produced the identical two assertions seen in CI run 37161779166: expected The CI log confirms it tested merge commit The Linux unused-script failures are fixed on main by |
5a6a51e to
4b79003
Compare
|
Final landing evidence for head
The same exact case fails identically on the verified PR candidate and clean current main Reproduction: CI=true node scripts/run-vitest.mjs run --config test/vitest/vitest.ui-e2e.config.ts --configLoader runner --project ui-e2e-bundled ui/src/e2e/activity-current-work.e2e.test.ts -t 'reconciles completion during the first snapshot and keeps global navigation owner-specific'The coordinator-authorized main-red exception applies to this non-security inherited failure. Landing will use an admin squash merge pinned to the freshly read API head SHA. Net production reduction remains 612 lines; the full coverage log is retained in the PR body. |
@.local/l351-infra-a-m2/squash-body.md
What Problem This Solves
Infrastructure still carries single-use forwarding layers, duplicated validation and projections, and worker options that callers never use after the first cleanup pass.
User Impact
No user-visible behavior, configuration, persisted data, protocol, or public plugin SDK changes are intended.
Why This Change Was Made
This second pass removes 612 net production lines across infra a–m while retaining authorization, lifecycle and migration boundaries:
This is the final below-1,000 batch for this lane. The coverage record below accounts for every production file over 200 lines. Larger candidates that would change private diagnostic cross-loader state, public SDK adapters, update lifecycle, or active heartbeat/other-PR work were retained.
Evidence
Final candidate
4b79003fe3295ebc7b78e354bb5519de96e2fd4dpasses both zero-cycle checks, core typechecking, and all 63 focused test files (1,693 passing tests, three existing skips; 118.58 seconds wall time). Exact-head CI run 37165531555 has one failed substantive job:checks-ui-e2e (8/9). The Activity first-snapshot case times out at line 180 awaiting anothersessions.list. It fails identically with the CI 30-second deadline on clean current main8ea8bb11a5bd5c0fa66665861c10b49aaf8ed989and the verified PR candidate. Main'sf8a5f8747bereconciles the visible rows and defers redundant refetch to 60 seconds; its controller is byte-identical across those revisions and outside this diff's import path. This is the coordinator-authorized non-security main-red exception. No assertions or timeouts were changed. The prior outcome-rendering and Linux Knip failures are fixed on main and pass this hosted run.The landing reproduction used Blacksmith Testbox
tbx_01m423ghm7m1r8s2fz8nv86csewith clean pinned head/main worktrees and frozen dependencies. The repository wrapper stalled for over ten minutes preparing its source capsule; the installed Crabbox CLI ran the paired reproduction. Native full sync then timed out for the rebase, so final checks used SSH on the same owned lease, fetching the pinned base and applying the reviewed patch. The resulting Git tree was verified as187cd918e8e308dd64dd142adeea9f3bf582460bbefore running checks. The inherited UI failure is detailed below, with exact assertions and source attribution in the linked evidence comment.The focused selection exercised 62 files and 1,639 tests. Its initial run exposed an extra ClawHub helper argument and the incomplete logger fixture described below. Both were corrected without weakening assertions; the affected two files then passed all 20 tests with no unhandled errors. The standalone parser suite also passed all 35 tests.
Both import-cycle checks passed with zero cycles again after the CI correction, and both focused command-policy files passed all 151 tests. Focused tests ran before a patch-identical rebase onto current main; none of the touched files changed in that base update. Independent P1 review is complete, and its actionable feedback is resolved. Explicit diagnostic-event projections and private cross-loader state contracts are retained.
Validation used the authorized local fallback under
nice -n 15: the Blacksmith Testbox had stopped before tests could run, and AWS refused the shared active-lease cap. The first hosted run caught a TypeScript narrowing regression and two shrink-only assertion-budget updates. Distinct token variants are restored. The two tiny cleanups needing the shared baseline were removed because that file is owned by active lanes. No check or baseline exception was added. The second hosted run passed package boundaries, ratchets, all type checks, and every selected test job, leaving three lint errors. Those are corrected by preserving local field assignment and constraining the private policy-label helper to string. Focused type-aware lint, both cycle checks, and all 99 tests in the two affected files passed afterward. Hosted CI on the final head completed with only the inherited Activity test failure described below.Test budget:
pnpm test src/infra/command-explainer/extract.test.ts --maxWorkers=1took 26.42 seconds wall time (7.15 seconds Vitest duration). The eight added numeric-escape cases used about 0.001 test-seconds in the combined local run; they add no fixture, process, shard, sleep, or timer. The affected worker-read fixture and ClawHub rerun took 367.57 seconds wall time, including a worker-artifact rebuild. The first hosted run was cancelled after those failures; its previously cancelled type and test coverage passed on the corrected-head run. Local assertion-ratchet validation passes. Local SDK declaration preparation exceeded its existing deadline; the corrected-head hosted package gate subsequently passed.Fixes Found Along the Way
The worker-read test logger lacked the scheduler's
tracemethod, causing unhandled timer errors. The mock now supplies that method; existing assertions and timeouts are unchanged.Complete size-ordered coverage record
Infra a-m second-pass coverage
Original base:
a6357978b73dd780e7a2d9d29c47c5baf9db2928. All 113 production files over 200 lines, sorted by original size. Excluded files are identified explicitly.src/infra/diagnostic-events.tssrc/infra/exec-approvals-allowlist.tssrc/infra/command-explainer/extract.tssrc/infra/exec-authorization-plan.tssrc/infra/gateway-state-owner.tssrc/infra/agent-run-registry.tssrc/infra/deferred-plugin-session-sources.tssrc/infra/backup-create.tssrc/infra/device-pairing-store.tssrc/infra/gateway-lock.tssrc/infra/install-package-dir.tssrc/infra/approval-handler-runtime.tssrc/infra/approval-native-route-coordinator.tssrc/infra/gateway-suspend-coordinator.tssrc/infra/clawhub-plugin-catalog.tssrc/infra/agent-events.tssrc/infra/exec-approval-forwarder.tssrc/infra/heartbeat-dispatch.tssrc/infra/heartbeat-runner-execution.tssrc/infra/clawhub-skills.tssrc/infra/command-analysis/inline-eval.tssrc/infra/dispatch-wrapper-resolution.tssrc/infra/clawhub-install-trust.tssrc/infra/deferred-plugin-migrations.tssrc/infra/device-bootstrap.worker-kernel.tssrc/infra/clawhub-client.tssrc/infra/bonjour-discovery.tssrc/infra/install-source-utils.tssrc/infra/exec-approval-reply.tssrc/infra/delivery-queue.worker.tssrc/infra/control-ui-assets.tssrc/infra/device-pairing-core.kernel.tssrc/infra/exec-approvals-store.tssrc/infra/exec-approvals-config.tssrc/infra/exec-approvals-allow-always.tssrc/infra/device-identity-store.tssrc/infra/exec-command-resolution.tssrc/infra/backup-sqlite-snapshot.tssrc/infra/delivery-queue-sqlite.kernel.tssrc/infra/exec-approval-channel-runtime.tssrc/infra/clawhub-packages.tssrc/infra/heartbeat-runner-scheduler.tssrc/infra/device-pairing-approval.kernel.tssrc/infra/diagnostics-timeline.tssrc/infra/bun-sqlite-library.tssrc/infra/agent-activity-events.tssrc/infra/command-analysis/risks.tssrc/infra/gateway-boot-lifecycle.tssrc/infra/command-carriers.tssrc/infra/github-issue.tssrc/infra/backup-scratch.tssrc/infra/exec-safe-bin-policy-profiles.tssrc/infra/exec-authorization-render.tssrc/infra/delivery-queue-sqlite-bound.tssrc/infra/http-body.tssrc/infra/exec-approvals-effective.tssrc/infra/http-request-lifecycle.tssrc/infra/gateway-process-argv.tssrc/infra/device-pairing-tokens.kernel.tssrc/infra/exec-control-command-guard.tssrc/infra/dotenv.tssrc/infra/device-pairing-node.worker.tssrc/infra/gateway-scheduler.tssrc/infra/device-pairing-node.tssrc/infra/delivery-recovery.shared.tssrc/infra/clawhub-skill-security.tssrc/infra/exec-approvals-sqlite.tssrc/infra/host-env-security.tssrc/infra/approval-handler-runtime-types.tssrc/infra/git-worker.tssrc/infra/heartbeat-session-publication.tssrc/infra/device-bootstrap.tssrc/infra/kysely-sync.tssrc/infra/heartbeat-runner-prompt.tssrc/infra/exec-approvals-core.tssrc/infra/git-read-cache.tssrc/infra/delivery-queue-sqlite-namespace.kernel.tssrc/infra/heartbeat-outcome-store.tssrc/infra/clawhub-artifacts.tssrc/infra/legacy-json-object-stream.tssrc/infra/heartbeat-runner-session.tssrc/infra/exec-approval-forwarder.messages.tssrc/infra/device-pairing-node.records.tssrc/infra/git-exec.tssrc/infra/event-session-routing.tssrc/infra/dotenv-global-core.tssrc/infra/delivery-queue-sqlite-claim.kernel.tssrc/infra/approval-request-account-binding.tssrc/infra/backup-archive-publication.tssrc/infra/device-pairing-worker.tssrc/infra/executable-path.tssrc/infra/approval-native-runtime.tssrc/infra/device-auth-store.tssrc/infra/gateway-active-work.tssrc/infra/exec-approvals-authorization.kernel.tssrc/infra/fs-safe-remove.tssrc/infra/approval-gateway-resolver.tssrc/infra/embedded-question-broker.tssrc/infra/kysely-sync-cache-state.tssrc/infra/exec-wrapper-trust-plan.tssrc/infra/diagnostic-trace-context.tssrc/infra/heartbeat-delivery-normalization.tssrc/infra/backup-config-capture.tssrc/infra/diagnostic-error-metadata.tssrc/infra/channel-summary.tssrc/infra/exec-safe-bin-trust.tssrc/infra/device-auth-store.kernel.tssrc/infra/message-tool-run-outcome-store.tssrc/infra/ed25519-signature.tssrc/infra/heartbeat-runner-run.tssrc/infra/exec-approval-session-target.tssrc/infra/approval-handler-bootstrap.tssrc/infra/exec-approval-text-sanitize.tsThe approval-error and backup-tar-retry micro-edits were omitted because shrinking their shared assertion baseline would overlap active lanes.
Current Landing Status
Merged by coordinator-authorized, exact-head admin squash as
55a9b478127a026ecc830cc4440b566c7be772cb; ancestry verified on fetchedorigin/main. The landed diff removes 612 net production lines across 40 production files (645 added, 1,257 deleted). The rebase was conflict-free and patch-identical; one leased corrective push was needed in this landing round.Both cycle checks, core typechecking, and 63 focused test files passed. Hosted run
37165531555completed with only the inherited Activity first-snapshot test failure plus its aggregate gate. The identical 30-second failure was reproduced on clean current main and the verified PR candidate; final evidence. All security checks passed or were neutral. The prior item-outcome and Linux Knip failures were fixed on main and passed the final hosted run. No UI test or production code was changed to handle either inherited failure.Blacksmith Testbox
tbx_01m423ghm7m1r8s2fz8nv86csewas stopped after validation. Protected staging and existing local recovery files were preserved.