Skip to content

refactor(infra): deslop infra - #164538

Merged
steipete merged 3 commits into
mainfrom
deslop/l351-infra-a-m2-20261003
Oct 4, 2026
Merged

steipete merged 3 commits into
mainfrom
deslop/l351-infra-a-m2-20261003

Conversation

@steipete

@steipete steipete commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

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:

  • Update allow-always rules in one cloned list instead of rebuilding the entire approvals document per entry; remove redundant approval storage and renderer forwarding.
  • Remove unused directory-routing knobs from device worker kernels while preserving the public facade and broker-owned database selection; reuse canonical key validation and pairing result construction.
  • Remove interpreter option branches already handled by generic option scanning, consolidate numeric shell escape decoding, and reuse facts already established by authorization planning.
  • Simplify ClawHub request forwarding and trust-result projection, and remove duplicate internal HTTP, environment, channel-summary, and diagnostic bookkeeping.

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 4b79003fe3295ebc7b78e354bb5519de96e2fd4d passes 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 another sessions.list. It fails identically with the CI 30-second deadline on clean current main 8ea8bb11a5bd5c0fa66665861c10b49aaf8ed989 and the verified PR candidate. Main's f8a5f8747be reconciles 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_01m423ghm7m1r8s2fz8nv86cse with 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 as 187cd918e8e308dd64dd142adeea9f3bf582460b before 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=1 took 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 trace method, 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.

Lines File Result
1616 src/infra/diagnostic-events.ts READ Inlined single-use state factory into lazy owner; retained version/shape admission and private descriptors after history confirmed cross-loader and listener-privacy contracts.
1316 src/infra/exec-approvals-allowlist.ts READ Inlined single-use safe-bin and package-manager projections; reused evaluation result type. Remaining distinct policy paths retain Windows, script, positional-carrier, durable-argument and trust-path contracts.
1213 src/infra/command-explainer/extract.ts READ Unified numeric ANSI-C escape decoding and source-offset advancement; retained parser work/depth budgets, span remapping, risk ordering, iterative traversal and topology ownership.
874 src/infra/exec-authorization-plan.ts READ Removed repeated wrapper validation/filtering, redundant relationship input and persistability revalidation; reused canonical POSIX wrapper set and existing blocking-risk decision.
752 src/infra/gateway-state-owner.ts EXCLUDED: state admission and heartbeat lifecycle boundary, parent retained it outside edit scope
746 src/infra/agent-run-registry.ts READ No sound structural deletion: exact claims, delegated authority, queued leases, replacement fencing and projection versions have distinct consumers; cron proposal functions are excluded closure.
735 src/infra/deferred-plugin-session-sources.ts READ No sound removal: receipt-bound source identities, archive fallback, canonical database recovery, and precommit revalidation each protect distinct retained-data contracts.
735 src/infra/backup-create.ts READ Retained single traversal and sealed snapshot publication; audit migration and update-capture paths are protected scope.
724 src/infra/device-pairing-store.ts READ Removed unused alternate-directory parameters from worker-only metadata, consume, confirm, and completion-prune operations; retained migration/test routing on snapshot APIs.
716 src/infra/gateway-lock.ts READ: sidecar/state ownership, cross-namespace fencing, historical detection, and cleanup retries have distinct maintained contracts
711 src/infra/install-package-dir.ts READ Retained staging/receipt/rollback authority; each validation follows a distinct awaited mutation boundary.
686 src/infra/approval-handler-runtime.ts READ: documented public SDK adapters and stop/binding cleanup contracts; retain public layer and typed hook erasure.
679 src/infra/approval-native-route-coordinator.ts READ: per-Gateway account selection, expiry and notice aggregation enforce distinct live ownership; retain ordering.
677 src/infra/gateway-suspend-coordinator.ts READ: reversible admission, lease expiry, committed shutdown, and fail-closed recovery remain distinct states; updater paths excluded
676 src/infra/clawhub-plugin-catalog.ts READ Forward common fetch options; reuse validated optional-string projection and build config/skill objects directly.
668 src/infra/agent-events.ts READ No sound structural deletion: immutable generation/routing snapshots and live registration iteration protect different lifecycle and callback-mutation contracts; audit emission remains excluded closure.
660 src/infra/exec-approval-forwarder.ts READ: strategies serve three live approval kinds; pending registry orders asynchronous delivery before resolution.
645 src/infra/heartbeat-dispatch.ts READ Excluded heartbeat-to-Automations ownership (#164265); full file read, no edits.
627 src/infra/heartbeat-runner-execution.ts READ Excluded heartbeat-to-Automations ownership (#164265); full file read, no edits.
613 src/infra/clawhub-skills.ts READ Forward common fetch options through the existing client; keep native/external identity and release-selection contracts.
600 src/infra/command-analysis/inline-eval.ts READ Deleted optional/prefix option descriptors and branches already fully subsumed by dash-token skipping; retained consuming options and file-program exclusions.
589 src/infra/dispatch-wrapper-resolution.ts READ No further sound simplification: wrapper-specific parsing, platform limits, semantic environment/output changes, lookup completeness and depth limits independently enforce documented trust decisions.
577 src/infra/clawhub-install-trust.ts READ Read verdict security facts once; remove single-use passing wrapper and use a direct boolean gate; retain explicit trust-request projections.
534 src/infra/deferred-plugin-migrations.ts READ No sound removal: config publication and rollback coordinate durable obligations; artifact-preserving reads and asynchronous worker admission have distinct callers.
523 src/infra/device-bootstrap.worker-kernel.ts READ Unified required-profile checks through the existing role/scope predicate and removed its repeated role validation and empty-scope branch.
523 src/infra/clawhub-client.ts READ Transport owns deadlines/body bounds/auth/retries; legacy token spellings are external CLI contracts, not local duplicate state.
522 src/infra/bonjour-discovery.ts READ: dns-sd, Avahi, and tailnet DNS parse different external protocols; shared TXT projection already owns common fields
506 src/infra/install-source-utils.ts READ Npm output/range/pack fallbacks cover shipped npm contracts; no unused option or behavior-neutral structural removal found.
499 src/infra/exec-approval-reply.ts READ: typed and command-backed public presentation helpers intentionally preserve distinct wire and fallback shapes.
488 src/infra/delivery-queue.worker.ts READ No sound removal: preparation, platform dispatch, unknown-send recovery, and settlement mutations encode distinct custody transitions.
487 src/infra/control-ui-assets.ts READ: package-root trust, asset-byte validation, source rebuild, and update handoff are distinct contracts; updater integration excluded
483 src/infra/device-pairing-core.kernel.ts READ Removed unused baseDir routing from worker-only kernels; the broker already binds one admitted physical database.
481 src/infra/exec-approvals-store.ts READ Removed single-caller database-read and synchronous initialization forwarding layers; retained owner batching, fencing, CAS and rollback.
472 src/infra/exec-approvals-config.ts READ Canonical and Doctor schemas serve distinct persisted contracts; diagnostic redaction and migration coercion remain necessary.
464 src/infra/exec-approvals-allow-always.ts READ Inlined generic one-caller rule updater into one concrete allow-always update; removed redundant source options and single-caller predicates.
460 src/infra/device-identity-store.ts READ Reused canonical PEM/type validation instead of recreating and revalidating both Ed25519 keys before comparing derived public material.
455 src/infra/exec-command-resolution.ts READ Simplified basename matching and removed a redundant trusted-path check; retained distinct token variants for downstream TypeScript narrowing.
455 src/infra/backup-sqlite-snapshot.ts READ Retained SQLite identity/journal checks and captured registry ordering; sanitization/audit closure is protected.
452 src/infra/delivery-queue-sqlite.kernel.ts READ No sound removal: bounded receipt pruning, exact owner checks, attempt reservations, and terminalization are distinct storage operations with persisted-input validation.
449 src/infra/exec-approval-channel-runtime.ts READ: removed trivial function wrapping the local shouldRun state; replay/start/stop ordering retained.
425 src/infra/clawhub-packages.ts READ Forward common request options to canonical client instead of restating the same four-field projection.
411 src/infra/heartbeat-runner-scheduler.ts READ Excluded heartbeat-to-Automations ownership (#164265); full file read, no edits.
399 src/infra/device-pairing-approval.kernel.ts READ Removed unused baseDir plumbing; approval continues on the bound worker connection with unchanged role and caller-scope checks.
394 src/infra/diagnostics-timeline.ts READ Retained explicit span-event projections at the private configuration/environment boundary; no further sound reduction.
391 src/infra/bun-sqlite-library.ts READ: one-shot native library selection and inherited capability publication own explicit Bun conformance and worker-lifecycle contracts
390 src/infra/agent-activity-events.ts READ No sound structural deletion: separate history passes resolve call/result ordering, duplicate IDs, synthetic repair results and wrapper suppression; producer and history states differ intentionally.
384 src/infra/command-analysis/risks.ts READ No further sound simplification: recursive carrier discovery, positional argument mapping, cycle guard and ordered risk fallbacks have distinct behavior and current callers.
383 src/infra/gateway-boot-lifecycle.ts EXCLUDED: direct boot/update lifecycle boundary per parent scope decision
377 src/infra/command-carriers.ts READ Reject non-executing options at parsing owner, delete second option-policy loop and redundant caller-established builtin name validation.
375 src/infra/github-issue.ts READ: bounded report preparation, ambiguous-create reconciliation, and durable pre-create authority have separate outcomes; update-failure reporter uses it
375 src/infra/backup-scratch.ts READ Token-based retirement and same-inode checks each fence different interprocess races; retained.
364 src/infra/exec-safe-bin-policy-profiles.ts READ Most lines are security profile data; compile-time prefix metadata serves runtime abbreviation checks and custom profiles.
357 src/infra/exec-authorization-render.ts READ Separate reviewed versus enforced rendering preserves expansion and dispatch binding contracts; span validation remains an independent security boundary.
357 src/infra/delivery-queue-sqlite-bound.ts READ No sound removal: serialization and prepared query caches belong to the physical handle; distinct upsert modes enforce different ownership contracts.
354 src/infra/http-body.ts READ: removed internal Error allocation and response forwarding layer from body-limit guard; rejection code now drives response directly
354 src/infra/exec-approvals-effective.ts READ Resolved field value and final source together, removing source sentinels and second formatting/projection layer.
353 src/infra/http-request-lifecycle.ts READ: request ordering/backpressure and Node/Bun rejection transports preserve different native framing and retirement contracts
345 src/infra/gateway-process-argv.ts READ: package and process identity checks prevent claiming unrelated processes; retained-artifact/update classification excluded
344 src/infra/device-pairing-tokens.kernel.ts READ Removed unused baseDir plumbing from worker-only token operations, enabling direct typed handler registration.
335 src/infra/exec-control-command-guard.ts READ SQLite CLI/open and package-runner parsers handle distinct argument contracts; no safe removal without reducing inspection coverage.
335 src/infra/dotenv.ts READ: workspace distrust policy and lazy plugin-provider credential inventory are intentional; sync/async callers both exist
332 src/infra/device-pairing-node.worker.ts READ Unified new/refreshed pending-node result construction and removed the unused store-routing argument; generation and transaction admission remain intact.
330 src/infra/gateway-scheduler.ts READ: one scheduler owns monotonic/wall deadlines, synchronous retirement, and pending async work; no duplicate dispatch owner remains
330 src/infra/device-pairing-node.ts READ No sound removal: cleanup claims and generation-specific invalidation fence concurrent reconnects and approvals; admission facts originate from an unknown broker payload.
328 src/infra/delivery-recovery.shared.ts READ No sound removal: error graph branches distinguish proven no-send from ambiguous transport failures; drain locks and replay pacing protect distinct concurrency contracts.
326 src/infra/clawhub-skill-security.ts READ Read external object records once; remove repeated record coercion wrappers; project shared fetch options once without forwarding batch items to single-skill verification.
321 src/infra/exec-approvals-sqlite.ts READ Reused canonical fail-closed document creator and one SQL values projection for insert/update without changing stored bytes or transactions.
320 src/infra/host-env-security.ts READ: removed key/value tuple projection, duplicate diagnostic fields, and private no-overrides result variant while preserving public output
318 src/infra/approval-handler-runtime-types.ts READ: plugin callbacks carry distinct payload, entry, view and binding types; no unused public contract.
315 src/infra/git-worker.ts READ: worker computation and host-owned Git process/authority settlement are intentional separate owners with bounded concurrency
303 src/infra/heartbeat-session-publication.ts READ Excluded heartbeat-to-Automations ownership (#164265); full file read, no edits.
300 src/infra/device-bootstrap.ts READ No sound removal: facade lock acquisition determines event timestamps and preserves credential settlement order; bound-context/profile APIs have separate production callers.
297 src/infra/kysely-sync.ts READ: native-version all/iterate differences and reader retirement are required; compile-only and prepared query surfaces have real callers
296 src/infra/heartbeat-runner-prompt.ts READ Excluded heartbeat-to-Automations ownership (#164265); full file read, no edits.
293 src/infra/exec-approvals-core.ts READ Skipped overlapping open PR #164286; full file read, no edits.
279 src/infra/git-read-cache.ts READ: revisioned and pending-only caches serve distinct data; custom diff clone avoids deep patch copies and shutdown joins cancellations
277 src/infra/delivery-queue-sqlite-namespace.kernel.ts READ No sound removal: insert, compare-and-replace, staged publication, and namespace migration preserve distinct atomic custody/fence rules.
274 src/infra/heartbeat-outcome-store.ts READ Excluded heartbeat-to-Automations ownership (#164265); full file read, no edits.
274 src/infra/clawhub-artifacts.ts READ Forward common fetch options; preserve cross-origin token suppression and all artifact/hash/header validation.
271 src/infra/legacy-json-object-stream.ts READ: APNs Doctor still consumes streamed one-property JSON with content-free errors and stable-file hash receipts
271 src/infra/heartbeat-runner-session.ts READ Excluded heartbeat-to-Automations ownership (#164265); full file read, no edits.
270 src/infra/exec-approval-forwarder.messages.ts READ Replaced generic renderer-resolver and fallback-thunk machinery with direct concrete renderer calls and lazy nullish fallbacks.
269 src/infra/device-pairing-node.records.ts READ No sound removal: explicit public projections redact auth and internal revision fields; refreshed surfaces and new surfaces intentionally differ in optional-field preservation.
266 src/infra/git-exec.ts READ: text/byte execution already shares one owner; buffered streaming and ref mutation admission retain different process contracts
265 src/infra/event-session-routing.ts READ Excluded heartbeat/cron wake-routing closure; whole file read but no edits.
263 src/infra/dotenv-global-core.ts READ: async/sync IO share parsing and first-wins precedence; override aliases and per-file conflict diagnostics are explicit contracts
262 src/infra/delivery-queue-sqlite-claim.kernel.ts READ No sound removal: claim, promote, dispatch, and renew enforce distinct pre-send, expiry, reconciliation, and unknown-after-send invariants through one transition owner.
259 src/infra/approval-request-account-binding.ts READ: live source, persisted route and explicit forwarding each have different documented account precedence.
257 src/infra/backup-archive-publication.ts READ Retained no-overwrite durable publication and identity-bound cleanup receipts; catches retain different recovery obligations.
253 src/infra/device-pairing-worker.ts READ No sound removal: admission, committed receipt publication, refused-outcome mapping, and settlement are the single authority owner; unknown broker values require validation.
251 src/infra/executable-path.ts READ PATH cache preserves documented hot-path behavior; Windows preference search differs from first-match executable lookup.
246 src/infra/approval-native-runtime.ts READ: shared native delivery owns dedupe, route reporting and cleanup around channel hooks; no redundant owner.
241 src/infra/device-auth-store.ts READ No sound removal: read-only and mutating token operations differ in state creation and live admission; origin scoping and snapshot callbacks have production callers.
238 src/infra/gateway-active-work.ts READ: shared maintenance inventory already reused by snapshot; per-category blockers and terminal policy are observable protocol data
238 src/infra/exec-approvals-authorization.kernel.ts READ Policy broadening, delayed grants, exact-command rules and usage updates have distinct authorization invariants; retained checks.
237 src/infra/fs-safe-remove.ts READ: pinned parent/leaf identities and sticky authority distinguish absence from replacement across awaited removal
236 src/infra/approval-gateway-resolver.ts READ: documented public canonical and command-backed resolution contracts; reviewer identity validation is security boundary.
235 src/infra/embedded-question-broker.ts READ: shared QuestionManager owns state; embedded adapter retains delegated authority, cancellation, and unsupported-secret-store validation
230 src/infra/kysely-sync-cache-state.ts READ: per-database lifecycle invalidation, authorizer changes, and reentrant statement protection are required cache contracts
227 src/infra/exec-wrapper-trust-plan.ts READ Dispatch wrappers, transparent shell carriers and multiplexers retain different policy versus execution targets and depth bounds.
226 src/infra/diagnostic-trace-context.ts READ No sound deletion: W3C validation, frozen async context and versioned private singleton admission serve actual trace and cross-loader contracts.
223 src/infra/heartbeat-delivery-normalization.ts READ Excluded heartbeat-to-Automations ownership (#164265); full file read, no edits.
220 src/infra/backup-config-capture.ts READ Include graph sealing and repeated identity/hash checks span awaited filesystem changes; no redundant validation.
217 src/infra/diagnostic-error-metadata.ts READ No sound structural deletion: own-property reads avoid getters, cycle-bounded traversal and low-cardinality normalization protect separate untrusted-error and privacy contracts.
214 src/infra/channel-summary.ts READ: inlined one-use account-label, line, and tint wrappers; retained status/credential projection and output spelling
213 src/infra/exec-safe-bin-trust.ts READ Filesystem case probing, symlink target directories, immutable roots and explicit writable-root warnings serve separate trust contracts.
212 src/infra/device-auth-store.kernel.ts READ Skipped edits: open deslop PR #164286 owns this file; read confirmed token CAS and origin routing remain meaningful boundaries.
209 src/infra/message-tool-run-outcome-store.ts READ: incognito and persistent storage retain distinct admitted database owners; write/worker cleanup settlement cannot be collapsed safely
207 src/infra/ed25519-signature.ts READ: replaced one-use DER parameter objects with direct arguments; canonical framing and signature validation unchanged
206 src/infra/heartbeat-runner-run.ts READ Excluded heartbeat-to-Automations ownership (#164265); full file read, no edits.
206 src/infra/exec-approval-session-target.ts READ Exec/plugin adaptation and stored versus live target resolution preserve account binding and disagreeing-origin refusal; public SDK surface unchanged.
206 src/infra/approval-handler-bootstrap.ts READ: generation and retry cancellation fence awaited channel context changes; no speculative defensive branches.
201 src/infra/exec-approval-text-sanitize.ts READ Raw and invisible-stripped redaction masks protect different secret-spoofing cases; UTF-16 offsets and display bounds retained.

The 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 fetched origin/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 37165531555 completed 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_01m423ghm7m1r8s2fz8nv86cse was stopped after validation. Protected staging and existing local recovery files were preserved.

@clawsweeper

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

@github-actions

github-actions Bot commented Oct 3, 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: 4b79003fe3295ebc7b78e354bb5519de96e2fd4d
  • Maintainer: @steipete
  • Repository role: admin

These security sensitive changes were made:

  • src/infra/device-bootstrap.worker-kernel.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.
  • src/infra/device-pairing-approval.kernel.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-core.kernel.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.
  • src/infra/device-pairing-core.worker.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.
  • src/infra/device-pairing-node.worker.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.
  • src/infra/device-pairing-state.kernel.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.
  • src/infra/device-pairing-store.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.
  • src/infra/device-pairing-tokens.kernel.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.
  • src/infra/exec-approval-channel-runtime.ts: Controls sandbox containment or tool execution authority. Check filesystem and network isolation, approval scope, and command allowlists.
  • src/infra/exec-approval-forwarder.messages.ts: Controls sandbox containment or tool execution authority. Check filesystem and network isolation, approval scope, and command allowlists.
  • src/infra/exec-approvals-allow-always.ts: Controls sandbox containment or tool execution authority. Check filesystem and network isolation, approval scope, and command allowlists.
  • src/infra/exec-approvals-allowlist.ts: Controls sandbox containment or tool execution authority. Check filesystem and network isolation, approval scope, and command allowlists.
  • src/infra/exec-approvals-effective.ts: Controls sandbox containment or tool execution authority. Check filesystem and network isolation, approval scope, and command allowlists.
  • src/infra/exec-approvals-resolver.ts: Controls sandbox containment or tool execution authority. Check filesystem and network isolation, approval scope, and command allowlists.
  • src/infra/exec-approvals-sqlite.ts: Controls sandbox containment or tool execution authority. Check filesystem and network isolation, approval scope, and command allowlists.
  • src/infra/exec-approvals-store.ts: Controls sandbox containment or tool execution authority. Check filesystem and network isolation, approval scope, and command allowlists.
  • src/infra/exec-approvals.ts: Controls sandbox containment or tool execution authority. Check filesystem and network isolation, approval scope, and command allowlists.

Carefully review these changes before merging.

@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 3, 2026
@clawsweeper

clawsweeper Bot commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed October 3, 2026, 8:44 PM ET / October 4, 2026, 00:44 UTC (Revision 5).

ClawSweeper review

What this changes

The 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
Reviewed head: 4b79003fe3295ebc7b78e354bb5519de96e2fd4d

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A useful, coherent refactor with substantial reported validation and no identified blocking patch defect.
Proof confidence 🌊 off-meta tidepool Not applicable: The verified maintainer author is exempt from ordinary contributor runtime proof. Pairing and command-policy changes preserve existing authority decisions, so no additional authority-chain gate was established; focused tests are supplemental, and related UI screenshots do not prove these paths. 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 verified maintainer author is exempt from ordinary contributor runtime proof. Pairing and command-policy changes preserve existing authority decisions, so no additional authority-chain gate was established; focused tests are supplemental, and related UI screenshots do not prove these paths. No stored-data contract change was identified.
Evidence reviewed 7 items Pinned introduction and merge ownership: Reviewed the merge-base-to-head infrastructure delta. Raw test-merge parents match the pinned base followed by the exact PR head; unrelated UI, workflow, and release changes belong to base drift.
Cleanup remains absent from current main: Fetched main still contains the repeated key parsing and per-entry approvals-document reconstruction removed by this branch. The supplied related merged PRs do not implement this cleanup.
Pairing database and authority ownership: The worker dispatcher binds the admitted physical database before invoking kernels. Public alternate-directory routing remains in the facade, and bootstrap approval retains transaction/commit admission and refusal settlement through the existing mutation owner.
Findings None None.
Security None None.

How this fits together

OpenClaw’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]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source -612, Tests +15. Total -597 across 42 files.

View PR surface stats
Area Files Added Removed Net
Source 40 644 1256 -612
Tests 2 15 0 +15
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 42 659 1256 -597

Review metrics

None.

Technical review

Best 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.

Labels

Label changes:

No label changes.

Label justifications:

  • P3: This is internal cleanup with no intended user-visible capability, configuration, or data-format change.
  • 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 verified maintainer author is exempt from ordinary contributor runtime proof. Pairing and command-policy changes preserve existing authority decisions, so no additional authority-chain gate was established; focused tests are supplemental, and related UI screenshots do not prove these paths. No stored-data contract change was identified.

Evidence

What I checked:

  • Pinned introduction and merge ownership: Reviewed the merge-base-to-head infrastructure delta. Raw test-merge parents match the pinned base followed by the exact PR head; unrelated UI, workflow, and release changes belong to base drift. (7c53816e28c7)
  • Cleanup remains absent from current main: Fetched main still contains the repeated key parsing and per-entry approvals-document reconstruction removed by this branch. The supplied related merged PRs do not implement this cleanup. (src/infra/device-identity-store.ts:100, ca267fa035f8)
  • Pairing database and authority ownership: The worker dispatcher binds the admitted physical database before invoking kernels. Public alternate-directory routing remains in the facade, and bootstrap approval retains transaction/commit admission and refusal settlement through the existing mutation owner. (src/infra/device-pairing-approval.ts:119, 4b79003fe329)
  • Authorization and storage equivalence: Blocked command candidates remain prompt-only before the simplified allow-always predicate. SQLite upserts retain the same stored fields, and canonical PEM validation remains before key equality; no stored-format, schema, default, or migration contract change was identified. (src/infra/exec-authorization-plan.ts:401, 4b79003fe329)
  • Complete captured body recovered: Read the omitted body through GitHub and verified SHA-256 080f0be79e264cf469da0397bc5718b50596d8a7c9f652cc9b44239c5245f5dc against the captured snapshot. It reports 1,693 passing focused tests and three existing skips, with final hosted CI remaining the landing gate. (4b79003fe329)
  • Inherited failure and media scope: The paired reproduction comment documents the UI outcome failure on clean main: refactor(infra): deslop infra #164538 (comment). Inspected all four prepared images; they demonstrate related UI/automation work, not this infrastructure refactor, and were not credited as its runtime proof.

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 (4 earlier review cycles)
  • reviewed 2026-10-03T21:12:24.862Z sha 41f531b :: needs maintainer review before merge. :: none
  • reviewed 2026-10-03T22:36:43.365Z sha c94383c :: needs maintainer review before merge. :: none
  • reviewed 2026-10-03T23:33:25.060Z sha 5a6a51e :: needs maintainer review before merge. :: none
  • reviewed 2026-10-03T23:59:10.537Z sha 5a6a51e :: needs maintainer review before merge. :: none

@steipete

steipete commented Oct 4, 2026

Copy link
Copy Markdown
Contributor Author

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 (tbx_01m423ghm7m1r8s2fz8nv86cse), in separate clean checkouts with frozen dependencies, the exact bundled-browser case passed on PR head 5a6a51ed91f6a5f587436aee167cd7e6ea709a11 and failed on main c13c486969497270e091759059297731a73afd48:

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 ['failed', 'Blocked', 'Outcome unknown'], received ['failed', 'Blocked', 'Running']; expected zero running rows, received one. The raw PR head passed the one selected case (14 unrelated cases excluded by the name filter).

The CI log confirms it tested merge commit 98b9ec5a3831d3f14c0941d618a7c0a58293cf9e, combining our head with main 4bcd6956b0a431b3d7024f1ad13095947c242bf8. That main includes 8db9539ee84 (#163545), whose undefined-status fallback in ui/src/lib/chat/tool-cards.ts changed from unknown to running for live incomplete cards. Item events with phase: end do not set the tool stream's result-received flag. This mock-Gateway test does not exercise approval persistence, pairing workers, or recovery storage; none of the changed infra files is in the outcome projection path.

The Linux unused-script failures are fixed on main by bf4fe3ace57. The branch has rebased without conflicts, with all three commits patch-identical, and final candidate checks are underway. The outcome-path source above is unchanged between the reproduced main revision and the new base cbd103def002ba9f91def95e157ceb7ff6840379.

@steipete
steipete disabled auto-merge October 4, 2026 00:37
@steipete
steipete force-pushed the deslop/l351-infra-a-m2-20261003 branch from 5a6a51e to 4b79003 Compare October 4, 2026 00:37
@steipete
steipete enabled auto-merge (squash) October 4, 2026 00:39
@steipete

steipete commented Oct 4, 2026

Copy link
Copy Markdown
Contributor Author

Final landing evidence for head 4b79003fe3295ebc7b78e354bb5519de96e2fd4d:

  • Both required cycle checks report zero; core typechecking passes; 63 focused files pass (1,693 tests, three existing skips) on verified tree 187cd918e8e308dd64dd142adeea9f3bf582460b.
  • Exact-head CI run 37165531555 completed. The only failed substantive job is checks-ui-e2e (8/9), so the aggregate CI gate is red. Dependency checking passes after main's Knip repair. The prior item-outcome failure is fixed on main by 7b3972c677e and passes this run.
  • The remaining failure is activity-current-work.e2e.test.ts, case reconciles completion during the first snapshot and keeps global navigation owner-specific, at line 180: page.waitForFunction: Timeout 30000ms exceeded while awaiting another sessions.list request.

The same exact case fails identically on the verified PR candidate and clean current main 8ea8bb11a5bd5c0fa66665861c10b49aaf8ed989 with frozen dependencies and CI=true, on the same owned Blacksmith Testbox. Main's f8a5f8747be (#164573) reconciles the five visible rows and defers the redundant refetch to its 60-second fallback; the test still awaits that request within 30 seconds. The controller is byte-identical at the PR base, PR head, failed CI merge base, and current main (cd3f3a97c6a821238835feb9f529de343e208905). No changed infra file participates in this mocked Activity event path. No test, assertion, timeout, or UI production code was changed to handle either inherited failure.

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.

@steipete
steipete merged commit 55a9b47 into main Oct 4, 2026
165 of 168 checks passed
@steipete
steipete deleted the deslop/l351-infra-a-m2-20261003 branch October 4, 2026 00:58
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 4, 2026
@.local/l351-infra-a-m2/squash-body.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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