Skip to content

refactor(infra): deslop infra - #163969

Merged
steipete merged 3 commits into
mainfrom
deslop/l335-simplify-infra-root-a-m-20261002
Oct 3, 2026
Merged

steipete merged 3 commits into
mainfrom
deslop/l335-simplify-infra-root-a-m-20261002

Conversation

@steipete

@steipete steipete commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Infrastructure helpers repeat approval delivery, wrapper planning, serialization, and cache behavior across unnecessary forwarding layers.

User Impact

The cleanup preserves configuration, stored data, approval text, and public SDK contracts. It also fixes lazy native approval adapters dropping their finalization callback, so channels can release completed approval bookkeeping.

Why This Change Was Made

  • Inline the single-use native approval delivery layer and build optional adapter hooks directly.
  • Reuse canonical approval normalization, executable parsing, hashing, and Git commit LRU storage.
  • Share shell-carrier/multiplexer processing and delivery-worker transaction setup while retaining their policy and transaction boundaries.
  • Remove unused internal heartbeat knobs, duplicate HTTP guard state, and single-use response/install helpers.
  • Simplify DNS escape parsing and diagnostic snapshot, flag, and timeline handling without changing their results.
Simplifications and rationale
Owner Simplification
Native approval delivery Inline the one-use delivery helper and remove duplicated callback contracts and forwarding closures.
Approval adapters Build optional hooks through typed assignments, preserving absent hooks and inherited method access.
Approval display and references Share home-path suffix formatting and use the canonical SHA-256 helper.
Command carriers and wrappers Reuse parsed option records; share carrier/multiplexer progression; remove regex-proven checks and repeated blocked-plan arguments.
Exec approval policy Use the existing normalizer/resolver directly and reuse already-prepared allowlist match keys.
Exec command and reply projection Inline one-use builders/render collectors and reuse existing descriptor and conversation results.
Safe-bin configuration Use existing string normalization helpers with the same string filtering, sorting, and first-seen order.
Delivery workers Share identical transaction setup across fourteen handlers while preserving operation labels and callbacks.
Diagnostics Inline one-use singleton constructors, share freezing traversal, avoid repeat flag normalization, and simplify JSON-only optional-field serialization.
Heartbeat scheduling Remove unused internal knobs and return values; stop the flood scan at its decisive threshold; replace a one-property private parameter bag.
State ownership and caches Remove an unused private role argument; use canonical LRU recency/eviction; simplify Map pruning iteration.
HTTP bodies Let the rejection reason own tripped state and inline the single-use prefix-reader adapter, retaining bounds and cancellation.
Installation and host helpers Inline guarded temporary cleanup/path checks and simplify cached-result and sequential name fallbacks.
Host environment filtering Remove repeated branches and a regex already covered by the broader accepted-key predicate without changing the policy.

Fixes Found Along the Way

The lazy approval adapter forwarded delivery observers but omitted onFinalized. Telegram uses that observer to remove terminalized system-agent approval IDs. The existing lifecycle test now exercises the lazy adapter rather than bypassing it.

Evidence

Measured reduction: 571 net production lines across 37 production files; tests add three net lines. This is the final below-1,000 batch after exhausting this partition; the coverage log below records all 113 files above 200 original lines, including overlap exclusions.

  • Before rebase, 870 tests across 44 files passed, using the repository Vitest wrapper with one worker. The 43-file batch took 1,967.37 seconds wall time on the loaded macOS host; the separate 14-case approval lifecycle suite took 768.77 seconds, dominated by cold worker preparation. The regression body took 93 ms after the fix.
  • The lazy-adapter regression first failed on the unchanged owner with zero finalization callbacks, then passed after forwarding the callback.
  • On rebased head 23375bfaeb499a339f5bb5098c97be48ef5a33bf, 125 tests across eight affected files passed (Vitest 415.99 seconds; wrapper 439.09 seconds), including gateway ownership, install/rollback/publication, approval lifecycle, and delivery storage. Both import-cycle checks reported 0, and the full assertion-safety ratchet passed. Core production typechecking passed before rebase; git range-diff confirms both commits retain their reviewed patches.
  • The first hosted CI run caught an unused resolver export and two disallowed object spreads in approval descriptor maps. The correction makes the resolver helper private and restores explicit descriptor fields. Focused type-aware lint, both zero-cycle gates, and full Knip production/all-export checks passed. All 137 tests across three approval suites passed (Vitest 213.73 seconds; command wall time 245.61 seconds).
  • Independent autoreview of the batch, approved baseline reductions, and final two-file CI correction was clean through P2. Final reviewed head: a9dc4793ea2ecd3e7698059459f3e14a19de73b9. Formatting and diff whitespace checks passed.
  • Initial remote attempts did not reach validation because of capacity delays and idle expiry during source capture. Pre-push checks used the authorized low-priority local fallback, one command at a time.
  • On final head, hosted run 37094169461 passed both corrected gates and all other jobs except checks-node-changed-compact-small-10 (job 111120727410): Bun 1.4.3-canary.1+13311cf83 exited with SIGSEGV/139 before any Vitest test results. The same 24-file selection passed on a clean Linux Testbox with source-byte verification and the checksum-pinned CI Bun runtime: 363 Vitest tests across 21 files (25.56 seconds) and 17 native Bun tests across three files. The replay does not establish a runtime crash fix; one targeted hosted-job rerun completed the missing coverage. Attempt 2 passed on exact head a9dc4793ea2ecd3e7698059459f3e14a19de73b9; GitHub squash auto-merge landed 341fc112e1e83ea74aa55c7c71033760bd043741. No admin exception was used. No test retry, timeout, assertion, or runtime pin changed.
Remote execution and cleanup
Provider Lease Command and result
Blacksmith Testbox tbx_01m3zd0t3j7p7n5w0w7pnx5mwq Wrapper warmup; admission delay exceeded the lane budget. Stopped; no tests ran.
AWS Crabbox cbx_38ad2e9d5440 Sanitized warmup; provisioning delay exceeded the lane budget. Released, cleanup complete, no host/resource remained.
Blacksmith Testbox tbx_01m3zpkf1tjqxkmrrwfd70c6qx Wrapper run with frozen install, cycles, assertion ratchet, and eight focused files; source capture outlasted idle lifetime. Already stopped; no validation ran.
Blacksmith Testbox tbx_01m3zydd2cvdek86bjwqccs2cz Wrapper run with frozen install, source hashes, canonical checksum-verified Bun installer, and scripts/ci-run-node-test-shard.mts using the exact failed 24-file group. Both invocations passed (380 tests total); remote payload 107.64 seconds. Lease stopped after proof. First attempt stopped before tests because an extra Git-HEAD assertion did not account for the wrapper carrier commit; corrected to source-byte verification.

Final reproduction lease: Testbox run 37094779403. All proof remains bound to the verified source rather than the carrier commit.

The assertion-safety allowances shrink exactly with the removed casts: approval-handler-runtime 15 to 10, exec-approval-reply 2 to 1.

Complete production coverage, largest first

l335 infra a-m coverage

Every direct production file above 200 original lines was read. Sorted by original size; overlap exclusions were inspected without edits. Smaller direct production modules were also swept.

Original lines File Coverage / outcome
1644 src/infra/diagnostic-events.ts READ — event types are SDK-visible; trusted/private delivery, queue priority, cloning, and provenance have separate contracts.
1328 src/infra/exec-approvals-allowlist.ts READ — excluded: open PR #161513 owns it; retains wrapper/payload trust, conservative shell syntax and safe-bin decisions.
885 src/infra/exec-authorization-plan.ts READ — excluded: open PR #161513 owns it; topology and wrapper persistence decisions have concrete authorization contracts.
756 src/infra/agent-run-registry.ts READ — excluded: open #161513 owns file; live claims, liveness and queue leases cannot be removed.
733 src/infra/deferred-plugin-session-sources.ts READ — July+ source receipts protect original session data through deferred plugin recovery; authority and source identity checks are required.
732 src/infra/backup-create.ts READ — retained: snapshot sealing, legacy audit capture race checks, ownership-bound publication and cleanup preserve archive integrity; current July+ source shapes remain.
727 src/infra/gateway-state-owner.ts READ — removed unused private payload role parameter; retained retained-lock/schema/projection custody and fresh mutation authority.
724 src/infra/device-pairing-store.ts READ — null-versus-absent row projection, setup completion and transaction publication preserve persisted and authorization contracts.
720 src/infra/approval-handler-runtime.ts READ — simplified optional hook construction into guarded typed assignments, removing conditional spread trees and redundant callback type/casts; retained public forwarding reads for inherited getters.
712 src/infra/install-package-dir.ts READ — inlined single-use path predicate and temp cleanup wrapper; retained install publication receipts, rollback quarantine, deferred settlement, npm config restoration.
683 src/infra/approval-native-route-coordinator.ts READ — excluded: open #161513 owns file; account route choice and missing-runtime notices remain owner-bound.
673 src/infra/clawhub-plugin-catalog.ts READ — excluded: open #161513 owns file; wire validation, exact-release ownership and projections retained.
672 src/infra/exec-approval-forwarder.ts READ — excluded: PR #163840 changes it; pending registry, settlement and native fallback route ownership are active.
668 src/infra/agent-events.ts READ — retained: synchronous listener mutation order, hidden routing, stale-owner rejection and public non-enumerable fields are distinct live contracts.
652 src/infra/gateway-lock.ts READ — async observation and synchronous mutation paths have separate timing/authority contracts; sidecars support shipped July+ Gateways.
645 src/infra/heartbeat-dispatch.ts READ — distinct quiet/failure/delivery outcomes preserve queue consumption, idempotent session publication, suppression and transport readiness contracts.
627 src/infra/heartbeat-runner-execution.ts READ — foreground admission, cron wait owners, restart recovery, and session-owned completions require separate fences; recent changes #161006/#153573 respected.
624 src/infra/dispatch-wrapper-resolution.ts READ — removed single-caller predicates and repeated blocked-result parameter forwarding; retained exact wrapper parsing and depth policy.
624 src/infra/gateway-suspend-coordinator.ts READ — held/recovering/retired states encode distinct scheduler recovery and irreversible handoff lifetimes; simplification would conflate authority.
613 src/infra/clawhub-skills.ts READ — retained: exact source/install references and separate metadata/card/release security contracts; network inputs require validation.
587 src/infra/clawhub-install-trust.ts READ — excluded: open #161513 owns file; exact publisher/release checks and decision precedence retained.
551 src/infra/bonjour-discovery.ts READ — simplified byte escape decoding to matched escapes and direct per-line TXT mapping; preserved bounds, invalid bytes, Unicode and discovery budgets.
534 src/infra/deferred-plugin-migrations.ts READ — pending obligations, rollback and config publication must remain atomic under their current owners; no safe larger removal.
527 src/infra/exec-approval-reply.ts READ — inlined one-caller presentation/fence/client-list wrappers, reused descriptor values, canonical record coercion; strings and public signatures retained.
522 src/infra/device-bootstrap.worker-kernel.ts READ — excluded: open PR #161513; binding, profile scope and expiry checks are current security contracts.
513 src/infra/delivery-queue.worker.ts READ — fourteen handlers share one typed transaction adapter; each operation label and transaction body remains unchanged.
507 src/infra/clawhub-client.ts READ — excluded: open #161513 owns file; credential routing, body bounds, UTF-8 validation and retry ownership retained.
506 src/infra/install-source-utils.ts READ — npm view/pack outputs differ by version/spec and archive handling; fallback and semver selection each retain tested dependency contracts.
487 src/infra/control-ui-assets.ts READ — retained: package ownership, selected-root asset health, repair ownership, boundary reads and build cancellation are meaningful; history ties fallback paths to packaged/symlinked install recovery, retained alongside current root-discovery cache semantics.
485 src/infra/device-pairing-core.kernel.ts READ — excluded: open PR #161513; scope, role and pending-request lifetime logic retained.
482 src/infra/exec-command-resolution.ts READ — inlined one-caller command builder and removed option projection; executable/policy target and hashing contracts retained.
479 src/infra/device-identity-store.ts READ — excluded: open PR #161513; identity salvage and key continuity preserve existing pairings.
478 src/infra/exec-approvals-store.ts READ — retained: active worker batching, mutation authority, fail-closed reads and rollback; touched within 24h by #162687.
472 src/infra/exec-approvals-config.ts READ — retained: canonical/Doctor parsing and value-free diagnostics; current October migration repair makes legacy parsing a live contract.
461 src/infra/exec-approvals-allow-always.ts READ — excluded: open PR #161513 owns it; persisted current grant bytes and additive policy authority retained.
455 src/infra/backup-sqlite-snapshot.ts READ — retained: global snapshot supplies agent registry, physical alias groups bind journals, all canonical identities recheck before archive publication.
452 src/infra/delivery-queue-sqlite.kernel.ts READ — namespace ownership, bounded tombstones and exact attempt reservation are supported persisted contracts.
449 src/infra/exec-approval-channel-runtime.ts READ — retained: current Gateway-owned and external-client lifetimes/replay paths both have production users and distinct stop/readiness contracts.
436 src/infra/clawhub-packages.ts READ — excluded: open #161513 owns file; external response shapes and validation remain.
411 src/infra/diagnostics-timeline.ts READ — replaced conditional-spread serialization with direct optional fields and shared completed-span payload; serialized omissions preserved.
411 src/infra/heartbeat-runner-scheduler.ts READ — cooldown and retry aggregation serve targeted/broadcast callers, current config and wake-generation fences; no sound larger removal found.
399 src/infra/device-pairing-approval.kernel.ts READ — owner/bootstrap approval scope and generation cleanup are distinct security flows; existing common helpers already own their shared steps.
391 src/infra/bun-sqlite-library.ts READ — retained: one-shot Bun SQLite selection and parent-decided worker admission facts must remain stable across retained runtimes.
389 src/infra/exec-approvals-effective.ts READ — excluded: open PR #161513 owns it; policy provenance and user-visible display output remain intact.
387 src/infra/command-carriers.ts READ — reused canonical inline-option result and removed regex-proven assignment delimiter revalidation; all wrapper policy and recursion bounds retained.
383 src/infra/exec-authorization-render.ts READ — inlined one-caller replacement collection and trivial rendering predicates; source-span and dispatch identity validation retained.
383 src/infra/gateway-boot-lifecycle.ts READ — distinct startup, recovery, completion and repair transitions preserve persisted history; no schema or retention changes authorized.
375 src/infra/agent-activity-events.ts READ — retained: two-pass call/result correlation handles results before calls, reused legacy/import IDs, synthetic repair outcomes and nested wrappers.
375 src/infra/backup-scratch.ts READ — retained: token retirement, ownership/identity proof, recognized layout validation and unknown payload preservation are cleanup authority.
375 src/infra/github-issue.ts READ — pre-create reservation, transport ambiguity, bounded output and exact reconciliation are required; fallback is not safe after an ambiguous create.
367 src/infra/approval-native-runtime.ts READ — inlined one-use delivery helper into its lifecycle owner, deleting duplicate callback contract and forwarding closures; retained dedupe, per-target errors and final notice publication timing.
366 src/infra/delivery-queue-sqlite-bound.ts READ — prepared-query caches and compact/replace/pending/complete modes serve separate retention and compare-and-swap contracts.
364 src/infra/exec-safe-bin-policy-profiles.ts READ — retained: data dominates file; fixture compiler serves built-in and operator profiles, abbreviation metadata is consumed by runtime validator.
357 src/infra/http-body.ts READ — removed duplicate tripped boolean; nullable rejection code now owns guard outcome; streaming/read and observer paths retain their separate error/response behavior.
353 src/infra/http-request-lifecycle.ts READ — Node/Bun/HEAD transport branches and per-connection backpressure are required contracts; no sound removal found.
346 src/infra/device-pairing-tokens.kernel.ts READ — excluded: open PR #161513; approved scopes, issuer generations and revocation retained.
345 src/infra/gateway-process-argv.ts READ — mutation discovery needs stronger package identity than diagnostic hints; process cwd and wrapper/platform classification remain distinct.
345 src/infra/host-env-security.ts READ — removed repeated predicate branches and redundant subset regex; retained exact inherited/override policy and scoped filtering.
335 src/infra/dotenv.ts READ — sync/bootstrap and async/plugin paths intentionally differ in lazy discovery and trust filtering; blocked key policy preserved.
335 src/infra/exec-control-command-guard.ts READ — retained: sqlite CLI and .open argument grammars differ; startup, live-state boundary and work-limit fallback contracts are necessary.
328 src/infra/delivery-recovery.shared.ts READ — complete error-graph no-send proof, live claims and replay pacing prevent duplicate visible sends.
326 src/infra/clawhub-skill-security.ts READ — retained: batches cannot mix owner-ambiguous legacy keys; final map restores original target order and exact-verify fallback preserves live API compatibility.
325 src/infra/device-pairing-node.ts READ — excluded: PR #163840; reconnect cleanup claims and published authority retained.
323 src/infra/device-pairing-node.worker.ts READ — generation fences and pending approval snapshots are distinct mutations; common transaction owner already exists.
322 src/infra/gateway-scheduler.ts READ — wall/monotonic deadlines, scoped cancellation, execution joins and replaced-job identity checks each protect separate lifecycle cases.
321 src/infra/exec-approvals-sqlite.ts READ — retained: agent-deletion fencing, fail-closed row parsing and projection writes; touched within 24h by #162687.
318 src/infra/approval-handler-runtime-types.ts READ — retained: SDK generic callback contract carries plugin payload/view types into the deliberate erased capability boundary.
318 src/infra/device-bootstrap.ts READ — excluded: PR #163840; worker operations preserve live handoff authority.
318 src/infra/host-env-security-policy.json READ — security policy source; exact allow/deny behavior retained.
315 src/infra/git-worker.ts READ — per-work-class pools preserve responsiveness; host keeps process ownership/effects/teardown while workers compute; no safe layer removal.
303 src/infra/heartbeat-runner-prompt.ts READ — excluded: PR #163840 already changes file; prompt byte and selected-event routing contracts preserved.
296 src/infra/exec-approvals-core.ts READ — eliminated nested host-normalization wrapper; retained public policy types and exact-mode distinctions.
286 src/infra/heartbeat-session-publication.ts READ — transcript receipt/media matching, current writer authority and accepted publication lifetime require present stages.
286 src/infra/kysely-sync.ts READ — excluded: open PR #161513; Node version iterator workaround and compile/execute/iterator lifetimes are independently necessary.
281 src/infra/device-pairing-node.records.ts READ — excluded: open PR #161513; public projections exclude auth material and preserve pending metadata.
277 src/infra/delivery-queue-sqlite-namespace.kernel.ts READ — staged, replacement and cross-namespace compare-and-swap flows each enforce a different ownership transition.
275 src/infra/git-read-cache.ts READ — metadata freshness, concurrent subscriber cancellation and retained subscription lifetimes have distinct contracts; canonical retained cache already used.
275 src/infra/host-env-security.reported-baseline.json READ — reported security baseline retained; no deletion credit.
274 src/infra/clawhub-artifacts.ts READ — retained: one bounded HTTP/archive owner, explicit ClawPack integrity evidence and cross-origin credential suppression are distinct contracts.
274 src/infra/heartbeat-outcome-store.ts READ — incognito memory and worker-backed storage require separate owners; bounded model-only context stays unchanged.
271 src/infra/heartbeat-runner-session.ts READ — global/per-agent, forced/subagent suppression and isolated queue lineage remain supported July+ behavior.
271 src/infra/legacy-json-object-stream.ts READ — bounded streaming, UTF-8 validation, source hashing and stable-file evidence preserve current Doctor migration contract.
270 src/infra/exec-approval-forwarder.messages.ts READ — retained: channel renderer fallback shared by four cases; remaining text fields differ by approval kind and are user-visible.
265 src/infra/event-session-routing.ts READ — retained: live configured route preservation and pinned DM owner checks are not interchangeable with key parsing alone.
263 src/infra/dotenv-global-core.ts READ — synchronous bootstrap, async reads, override aliases and conflict reporting preserve separate timing and precedence contracts.
262 src/infra/delivery-queue-sqlite-claim.kernel.ts READ — producer, platform send, renew and reconciliation states require different authority and timestamp checks.
259 src/infra/approval-request-account-binding.ts READ — retained: account matching, channel selection, persisted origin fallback and explicit targets differ intentionally.
257 src/infra/backup-archive-publication.ts READ — retained: exclusive hard-link publication and identity-checked staging cleanup preserve destination and durability commitments.
257 src/infra/exec-wrapper-trust-plan.ts READ — unified carrier/multiplexer settlement while retaining ordered recognition, multiplexer policy target and depth blocking.
252 src/infra/git-exec.ts READ — text/bytes/buffered output paths use canonical retry owner already; ref queue cancellation retains process teardown.
251 src/infra/executable-path.ts READ — retained: explicit paths, PATH search and preferred Windows .cmd resolution differ; cache lifecycle has explicit steady-poller invalidation semantics in source.
244 src/infra/exec-approvals-authorization.kernel.ts READ — reused prepared match keys for metadata update and removed separate changed-state bookkeeping; current authority checks retained.
241 src/infra/device-auth-store.ts READ — captured admission, read-only absence and mutation grant checks preserve token observation and commit authority.
238 src/infra/gateway-active-work.ts READ — complete active-work snapshot and cheap status projection intentionally differ; blocker wire shapes and custody remain intact.
237 src/infra/fs-safe-remove.ts READ — retained: sticky owner/parent/entry receipts, ordinary missing-path handling and recursive sibling pins enforce distinct mutation boundaries.
236 src/infra/approval-gateway-resolver.ts READ — retained: canonical reviewer identity validation and explicitly documented shipped legacy routing API remain supported.
235 src/infra/embedded-question-broker.ts READ — retained: delegates manager state but owns embedded authority, signal lifetime and RPC error mapping.
233 src/infra/device-pairing-worker.ts READ — excluded: PR #163840; commit receipts and pending publication must settle even on error.
233 src/infra/kysely-sync-cache-state.ts READ — authorizer/reprepare/disposal invalidation and active-statement reentrancy are required; no new database lifetime changes.
230 src/infra/diagnostic-trace-context.ts READ — inlined single-use state constructor while preserving shared state validation and property descriptors.
224 src/infra/exec-approval-text-sanitize.ts READ — excluded: open PR #161513 owns it; dual-view secret redaction and Unicode spoof protection are security contracts.
223 src/infra/heartbeat-delivery-normalization.ts READ — ordinary replies, structured tool notifications, failure placeholders and explicit silence retain distinct user-visible semantics.
220 src/infra/backup-config-capture.ts READ — retained: byte/hash identity, authored include graph and alias revalidation bind a coherent snapshot.
217 src/infra/diagnostic-error-metadata.ts READ — bounded, own-data-property extraction intentionally avoids getters, cycles and raw provider identifiers.
215 src/infra/exec-approval-session-target.ts READ — removed field-for-field conversation projection; target consistency, account binding and persisted session routing retained.
214 src/infra/channel-summary.ts READ — retained: canonical account inspection drives formatting; plugin summary and unavailable credential paths are externally visible.
213 src/infra/exec-safe-bin-trust.ts READ — retained: real filesystem case behavior, symlink-resolved bin directories and permission warnings have distinct contracts.
212 src/infra/device-auth-store.kernel.ts READ — shared token target already owns both device/origin tables; conditional writes and clears retain their comparison contracts.
207 src/infra/ed25519-signature.ts READ — retained: canonical and permissive PEM/base64 modes are intentionally separate public wire/identity contracts.
206 src/infra/approval-handler-bootstrap.ts READ — retained: generation checks across awaits, terminal-start distinction and scheduler retry settlement prevent leaked/revived handlers.
206 src/infra/heartbeat-runner-run.ts READ — real dispatcher owns delivery and settlement; current generation, typing cleanup and isolated-run teardown remain intact.
204 src/infra/device-pairing.ts READ — excluded: PR #163840; facade owns committed facts and current admission.
204 src/infra/git-commit.ts READ — replaced manual Map recency/eviction with existing LruCache owner; preserved cached null outcomes and 256-entry bound.

Collapse redundant approval, command, diagnostic, HTTP, and cache layers while preserving their contracts. Forward lazy native approval finalization so channels can release completed system-agent approval bookkeeping.
@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. This comment is informational because the PR author has repository Maintain or Admin access.

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

These security sensitive changes were made:

  • src/infra/exec-approval-reply.ts: Controls sandbox containment or tool execution authority. Check filesystem and network isolation, approval scope, and command allowlists.
  • src/infra/exec-approval-session-target.ts: Controls sandbox containment or tool execution authority. Check filesystem and network isolation, approval scope, and command allowlists.
  • src/infra/exec-approvals-authorization.kernel.ts: Controls sandbox containment or tool execution authority. Check filesystem and network isolation, approval scope, and command allowlists.
  • src/infra/exec-approvals-core.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.ts: Controls sandbox containment or tool execution authority. Check filesystem and network isolation, approval scope, and command allowlists.
  • src/infra/exec-safe-bin-config.ts: Controls sandbox containment or tool execution authority. Check filesystem and network isolation, approval scope, and command allowlists.
  • src/infra/exec-wrapper-trust-plan.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: blocked before merge. Reviewed October 3, 2026, 12:21 AM ET / 04:21 UTC (Revision 3).

ClawSweeper review

What this changes

Simplifies shared infrastructure helpers and restores finalization callbacks through lazy channel approval adapters so completed approval bookkeeping is released.

Merge readiness

⛔ Blocked before merge - 1 item remains

Keep open: the callback repair remains useful, and no actionable introduced defect was found. The previous generic migration-proof blocker is unsupported by the reviewed hunks.

Priority: P3
Reviewed head: a9dc4793ea2ecd3e7698059459f3e14a19de73b9

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A useful, coherent simplification with a focused lifecycle regression and no supported correctness blocker.
Proof confidence 🌊 off-meta tidepool Not applicable: Verified repository-admin authorship exempts this PR from the external-contributor proof gate. The lazy finalization repair has reported regression-test evidence, not live Telegram proof; no material authority change or stored-data contract change introduces an additional proof requirement.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: Verified repository-admin authorship exempts this PR from the external-contributor proof gate. The lazy finalization repair has reported regression-test evidence, not live Telegram proof; no material authority change or stored-data contract change introduces an additional proof requirement.
Evidence reviewed 8 items Pinned introduction and clean checkout: Reviewed the complete introduced delta from 9ae1a44 to a9dc479. Endpoint drift was excluded from attribution; the supplied stale test merge was not used to infer removal of main behavior. Final status remained clean.
Callback repair and regression coverage: The lazy adapter forwards the existing onFinalized observer. The changed lifecycle test routes a system-agent request through the lazy adapter and checks finalization; Telegram's existing observer deletes completed IDs from its process-local bookkeeping.
Current main still needs the repair: The fetched main revision forwards delivery observers but lacks onFinalized forwarding, so the central unique repair is not already implemented.
Findings None None.
Security None None.

How this fits together

Shared infrastructure connects Gateway requests and channel adapters to approval lifecycles, delivery storage, command policy, and diagnostics. These helpers prepare operations and pass results to the existing transport and storage owners.

flowchart TD
  A[Gateway requests] --> B[Shared infrastructure]
  C[Configuration and approval policy] --> B
  B --> D[Approval lifecycle]
  B --> E[Delivery storage worker]
  D --> F[Channel adapters and cleanup]
  E --> G[Persisted delivery results]
Loading

Before merge

  • Add data-model compatibility proof - Confirm migration or upgrade compatibility proof before merge.
Agent review details

Security

None.

PR surface

Source -571, Tests +3, Other 0. Total -568 across 40 files.

View PR surface stats
Area Files Added Removed Net
Source 37 551 1122 -571
Tests 2 16 13 +3
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 2 2 0
Total 40 569 1137 -568

Review metrics

None.

Stored data model

Persistent data-model change detected: unknown-data-model-change: src/infra/exec-approvals.ts. Confirm migration or upgrade compatibility proof before merge.

Technical review

Best possible solution:

Retain the existing policy and storage owners while consolidating redundant helpers and completing lazy-adapter lifecycle cleanup.

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

Yes, from source: current main omits the lazy adapter's finalization observer, and the modified lifecycle test exercises the missing forwarding path. No tests were executed during this read-only review.

Is this the best way to solve the issue?

Yes: forwarding the existing observer and reusing canonical helpers repairs the lifecycle gap without adding a competing owner or changing stored contracts.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

No label changes.

Label justifications:

  • P3: This is primarily internal simplification with a bounded approval-bookkeeping repair.
  • 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: Verified repository-admin authorship exempts this PR from the external-contributor proof gate. The lazy finalization repair has reported regression-test evidence, not live Telegram proof; no material authority change or stored-data contract change introduces an additional proof requirement.

Evidence

What I checked:

  • Pinned introduction and clean checkout: Reviewed the complete introduced delta from 9ae1a44 to a9dc479. Endpoint drift was excluded from attribution; the supplied stale test merge was not used to infer removal of main behavior. Final status remained clean. (a9dc4793ea2e)
  • Callback repair and regression coverage: The lazy adapter forwards the existing onFinalized observer. The changed lifecycle test routes a system-agent request through the lazy adapter and checks finalization; Telegram's existing observer deletes completed IDs from its process-local bookkeeping. (src/infra/approval-handler-adapter-runtime.ts:115, a9dc4793ea2e)
  • Current main still needs the repair: The fetched main revision forwards delivery observers but lacks onFinalized forwarding, so the central unique repair is not already implemented. (src/infra/approval-handler-adapter-runtime.ts:108, 4ec1118e7cc0)
  • Latest release comparison: The v2026.9.8 adapter also lacks onFinalized forwarding. (src/infra/approval-handler-adapter-runtime.ts, fc23bc864e45)
  • No introduced stored-data contract change: The delivery worker shares identical synchronous transaction setup while retaining operation labels, callbacks, namespaces, and stored payloads. Gateway state ownership fixes an already-defaulted private role; installation changes inline unchanged path validation and cleanup. These hunks do not require a data migration. (src/infra/delivery-queue.worker.ts:274, a9dc4793ea2e)
  • Authorization and SDK contracts preserved: Current-policy and delayed-policy-snapshot checks remain before approval persistence. Wrapper recognition order, multiplexer policy targets, and depth refusal remain equivalent. Public approval exports retain their signatures and delegate to existing normalization owners; no Codex dependency contract is implicated. (src/infra/exec-approvals-authorization.kernel.ts:218, a9dc4793ea2e)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • RomneyDa: 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 (2 earlier review cycles)
  • reviewed 2026-10-03T02:43:43.323Z sha 23375bf :: blocked before merge. :: none
  • reviewed 2026-10-03T03:49:45.628Z sha a9dc479 :: blocked before merge. :: none

@steipete
steipete enabled auto-merge (squash) October 3, 2026 02:46
@steipete
steipete disabled auto-merge October 3, 2026 03:05
@steipete
steipete enabled auto-merge (squash) October 3, 2026 03:44
@steipete
steipete merged commit 341fc11 into main Oct 3, 2026
288 of 291 checks passed
@steipete
steipete deleted the deslop/l335-simplify-infra-root-a-m-20261002 branch October 3, 2026 04:24
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 4, 2026
Remove redundant infrastructure forwarding, duplicate normalization, unused private heartbeat knobs, and repeated transaction setup while preserving public configuration, storage, approval text, and SDK contracts.

Fix lazy native approval adapters dropping onFinalized so channels release completed system-agent approval bookkeeping. The regression failed on the old adapter and passed after forwarding the callback.

Validation: 870 focused tests before rebase, 125 affected tests after rebase, both import-cycle checks at zero, assertion-safety ratchet passed, core typecheck and independent review passed. Full 113-file coverage log and exact-head CI evidence are in the PR.
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