Repository navigation
refactor(infra): deslop infrastructure and outbound - #164046
Conversation
Remove one-use forwarding layers, redundant projections, and unused internal options while preserving delivery, migration, security, and native lifecycle contracts. Load database dependencies only for database requests in the generic worker fixture. Preserve existing assertions and deadlines; verify repeated retained-worker behavior and real Gateway deletion boundaries.
Keep the Node runtime resolver free of local JavaScript imports because tooling loads its TypeScript source before a loader is available. Restore the original bounded-cache loop and document that constraint.
Keep completed and failed as separate union members so status-specific Extract consumers retain their types. Runtime values remain unchanged.
Avoid parameter reassignment and hint shadowing. Update only the newly created transcript projection while preserving the opaque legacy metadata contract.
|
🦞👀 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: blocked before merge. Reviewed October 3, 2026, 1:49 AM ET / 05:49 UTC (Revision 2). ClawSweeper reviewWhat this changesSimplifies infrastructure, outbound delivery, migration orchestration, and worker cleanup by replacing redundant forwarding and projections with existing owners. Merge readiness⛔ Blocked before merge - 1 item remains This remains useful, distinct cleanup, and no actionable introduced defect was found. The earlier migration-compatibility concern is not supported by the actual hunks: stored contracts and migration decisions remain unchanged. Failed CI remains recorded and does not establish a patch regression. Priority: P3 Review scores
Verification
How this fits togetherOpenClaw infrastructure connects command requests, outgoing payloads, and legacy state to execution, channel transports, and SQLite owners. These helpers preserve routing, delivery bookkeeping, migration receipts, and resource cleanup. flowchart TD
A[Command requests] --> D[Infrastructure helpers]
B[Outgoing payloads] --> D
C[Legacy state] --> D
D --> E[Execution and channel owners]
D --> F[SQLite migration owners]
E --> G[Results and delivery receipts]
F --> H[Canonical state and migration receipts]
Before merge
Agent review detailsSecurityNone. PR surfaceSource -944, Tests +3, Other -2. Total -943 across 70 files. View PR surface stats
Review metricsNone. Stored data modelPersistent data-model change detected: Technical reviewBest possible solution: Keep the simplifications with existing delivery, migration, and lifecycle owners while preserving their current contracts. Do we have a high-confidence way to reproduce the issue? Not applicable: this is a behavior-preserving cleanup, and source review found no concrete introduced bug to reproduce. Is this the best way to solve the issue? Yes: consolidating redundant internal layers into existing owners is maintainable, and the inspected hunks preserve their decisions and state contracts. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against a3404dd380e1. 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 (1 earlier review cycle)
|
Evidence: landing over an inherited main failureHead
All other hosted jobs passed. Admin squash-merging pinned to the exact head, per maintainer direction for pre-existing main failures. |
* refactor(infra): deslop runtime and outbound helpers Remove one-use forwarding layers, redundant projections, and unused internal options while preserving delivery, migration, security, and native lifecycle contracts. Load database dependencies only for database requests in the generic worker fixture. Preserve existing assertions and deadlines; verify repeated retained-worker behavior and real Gateway deletion boundaries. * fix(infra): preserve native Node bootstrap loading Keep the Node runtime resolver free of local JavaScript imports because tooling loads its TypeScript source before a loader is available. Restore the original bounded-cache loop and document that constraint. * fix(infra): preserve triage result discriminants Keep completed and failed as separate union members so status-specific Extract consumers retain their types. Runtime values remain unchanged. * refactor(infra): simplify local bindings and projections Avoid parameter reassignment and hint shadowing. Update only the newly created transcript projection while preserving the opaque legacy metadata contract. * chore(infra): shrink assertion safety baseline
What Problem This Solves
Infrastructure maintenance requires tracing one-use forwarding layers, duplicate projections, and unused internal options around otherwise necessary delivery, migration, and native-resource owners.
User Impact
No user-visible behavior change. Configuration, persisted state, public SDK contracts, command output, delivery ordering, egress enforcement, and authority checks retain their existing behavior. No operator action or migration is required.
Why This Change Was Made
This batch removes 944 net production lines across 67 production files, plus two test/support updates. The batch removed 1,002 lines before the final rebase; fresh main already contains 58 lines of those simplifications. The full coverage log is attached below. It keeps the lifecycle and recovery machinery that enforces real contracts and simplifies the code surrounding those owners.
message.Fixes found along the way
The generic resource-worker fixture eagerly loaded auth and database modules before handling even an in-memory retain/wait request. Two retained-worker cases hit their unchanged startup deadline during the loaded-host fallback run. Load those exact modules only for a database request, within the existing awaited handler; keep the real database-deletion sibling coverage and all assertions/deadlines.
Update five SQL expectations to the canonical busy-timeout setter spelling, preserving exact values, call counts and ordering. July 2026 and later migration contracts remain supported; active overlapping work and recently changed updater lifecycle files were excluded.
Evidence
pnpm test src/infra/worker-task-pool.retained.test.ts --repeats 19 --maxWorkers=1passed all 100 executions on Linux (50.24 seconds wall). The same 100 executions passed on the loaded Mac (328.70 seconds wall).pnpm test src/infra/sqlite-wal.test.ts --maxWorkers=1passed 59 tests on Linux (36.16 seconds wall; Vitest file duration 32.83 seconds). Values, counts, and ordering assertions remain exact.The pre-rebase source tree (including the generated assertion-baseline reduction) matched the candidate Git tree exactly. Both
node --import ./scripts/tsx.mjs scripts/check-madge-import-cycles.tsandnode --import ./scripts/tsx.mjs scripts/check-import-cycles.tsreported 0 cycles.Final rebase is onto
7ff3b3be3713751de356800167d67ce752ad0d04. Main's shared snapshot telemetry and session-key option owners are preserved. Assertion-baseline conflicts retain the lower count per entry, including main's existing count of 2 for unhandled rejections. Independent rebase review is clean through P2. On the exact rebased Git tree, both cycle checks reported 0, the assertion SAFETY ratchet passed, and all 15 affected test files passed: 340 tests passed with 2 existing skips (144.76 seconds across three shards). Hosted CI will gate the published head.Hosted CI on
ad82746ed4997e578e90282b5c30788facdb7aabcompleted in run 37098654155. All other CI jobs passed or were intentionally skipped; two jobs failed, plus the aggregate gate:2026.9.8failspackage-verifywithInvalid package dist content inventory at dist/postinstall-content-inventory.json: expected packaged file hashes and executable bits to match current dist files.Thepublished-driver-updateartifact'supdate.stdoutmatches the same step and message in main run 37097223041, job 111131015571, headf3b754f361175b52b86d1d6c9b63affdb354b10e. Package installation and predecessor Gateway recovery pass in both. Published-driver harness and package-inventory sources are identical between that main baseline and this PR. This failure is qualified as inherited.Boundary configuration or resolution topology changed during compilation, naming removal of the three.cold-facade-*/fixturesource/manifest files. The facade fixture passed and removed its files while shared subprocess compilation was active; dependent suites then fail before assertions. The facade fixture and compiler/cache owners are unchanged versus main. A bounded search did not find an independent current hosted run with this same race, so it remains unqualified for the inherited-failure exception.Squash auto-merge is enabled for the reviewed head. No admin merge has been submitted; the compiler-race qualification remains the landing blocker. No CI rerun or refresh push was performed.
Full production-file coverage (including excluded owners)
l336 coverage log
Sizes reflect the final rebased tree. READ dispositions come from the completed file-by-file lane reports. Explicit exclusions retain their overlap or recent-lifecycle reason. Fresh main already contains 58 lines of the original 1,002-line reduction; the final PR removes 944 net production lines.
src/infra/state-migrations.doctor.tssrc/infra/update-managed-service-handoff.tssrc/infra/update-global.tssrc/infra/outbound/delivery-queue-recovery.tssrc/infra/npm-managed-root.tssrc/infra/state-migrations.session-store.tssrc/infra/restart.tssrc/infra/net/fetch-guard.tssrc/infra/update-check.tssrc/infra/worker-task-pool-core.tssrc/infra/update-candidate-state.tssrc/infra/package-update-swap.tssrc/infra/net/ssrf.tssrc/infra/sqlite-worker-broker.tssrc/infra/sqlite-snapshot-staging-owner.tssrc/infra/update-startup.tssrc/infra/outbound/deliver-queue-execute.tssrc/infra/state-migrations.meeting-transcripts-files.tssrc/infra/update-candidate-canary.tssrc/infra/package-update-steps.tssrc/infra/session-event-wake.tssrc/infra/sqlite-readonly-location.tssrc/infra/update-managed-service-handoff-lease.tssrc/infra/sqlite-snapshot.tssrc/infra/outbound/message-action-runner.tssrc/infra/state-migrations.audit-logs.tssrc/infra/state-migrations.meeting-transcripts.tssrc/infra/update-runner-git-preflight.tssrc/infra/update-runner-git-target.tssrc/infra/outbound/targets.tssrc/infra/session-cost-usage-rollup.tssrc/infra/update-candidate-plugin-tree.tssrc/infra/system-run-mutable-file-operand.tssrc/infra/session-sqlite-migration-manifest.tssrc/infra/update-runner-git.tssrc/infra/tailscale.tssrc/infra/outbound/message-action-execution.tssrc/infra/update-recovery-baseline-capture.tssrc/infra/state-migrations.runtime-state.tssrc/infra/outbound/source-reply-mirror.tssrc/infra/package-update-filesystem.tssrc/infra/session-sqlite-migration-readers.tssrc/infra/package-local-overrides.tssrc/infra/update-failure-report.tssrc/infra/system-run-approval-binding.tssrc/infra/outbound/current-conversation-bindings.tssrc/infra/sqlite-readonly-worker.tssrc/infra/package-root-imports.tssrc/infra/outbound/message-action-send.tssrc/infra/state-migrations.plugin-doctor.tssrc/infra/sqlite-schema-contract.tssrc/infra/update-run-recovery-schema.tssrc/infra/restart-stale-pids.tssrc/infra/state-migrations.workspace-setup.tssrc/infra/windows-gateway-firewall-diagnostics.tssrc/infra/ports-inspect.tssrc/infra/outbound/message.tssrc/infra/outbound/session-binding-service.tssrc/infra/state-migrations.media-persistence.tssrc/infra/package-update-publication-owner.tssrc/infra/outbound/message-action-params.tssrc/infra/update-recovery-backup-reader.tssrc/infra/sqlite-snapshot-single-flight.tssrc/infra/session-cost-usage-worker.tssrc/infra/push-web-store.kernel.tssrc/infra/state-migrations.workspace-setup-store.tssrc/infra/outbound/deliver-queue.tssrc/infra/state-migrations.audit-recovery.tssrc/infra/sqlite-readonly-location-cleanup.tssrc/infra/triage-continuation.tssrc/infra/provider-usage.auth.tssrc/infra/outbound/delivery-queue-migration.tssrc/infra/state-migrations.shared-auth-store.tssrc/infra/session-cost-usage-worker-runtime.tssrc/infra/restart-sentinel.tssrc/infra/package-update-integrity.tssrc/infra/shell-wrapper-resolution.tssrc/infra/package-update-activation-journal.tssrc/infra/provider-usage.fetch.minimax.tssrc/infra/state-migrations.legacy-session-store.tssrc/infra/outbound/deliver-channel.tssrc/infra/state-migrations.legacy-sessions.tssrc/infra/update-run-report.tssrc/infra/sqlite-wal.tssrc/infra/state-migrations.transcript-directives-archives.tssrc/infra/update-failure-report-receipt-store.tssrc/infra/session-cost-usage-collection.tssrc/infra/worker-native-lifecycle.tssrc/infra/outbound/deliver-core.tssrc/infra/update-candidate-plugins.tssrc/infra/update-runner-git-runtime.tssrc/infra/state-migrations.debug-proxy.tssrc/infra/state-migrations.managed-outgoing-images.tssrc/infra/update-run-ledger.tssrc/infra/restart-intent.tssrc/infra/sqlite-transaction.tssrc/infra/sqlite-readonly-native-resource.tssrc/infra/shell-env.tssrc/infra/state-migrations.source-snapshot.tssrc/infra/sqlite-worker-broker-reply.tssrc/infra/outbound/delivery-queue-storage.tssrc/infra/update-migrated-finalize.worker.tssrc/infra/update-candidate-snapshot.tssrc/infra/push-apns.tssrc/infra/state-migrations.device-identity.tssrc/infra/update-startup-auto-run.tssrc/infra/update-doctor-result.tssrc/infra/state-migrations.transcript-directives.tssrc/infra/outbound/target-resolver.tssrc/infra/state-migrations.exec-approvals.tssrc/infra/sqlite-integrity.tssrc/infra/package-lifecycle.tssrc/infra/update-repair-agent.runtime.tssrc/infra/update-failure-report-prepare.tssrc/infra/outbound/message-action-routing.tssrc/infra/sqlite-store.worker.tssrc/infra/push-apns-store.tssrc/infra/restart-sentinel-store.tssrc/infra/update-managed-service-handoff-database.tssrc/infra/sqlite-worker-operation-admission.tssrc/infra/state-migrations.state-dir.tssrc/infra/restart-handoff.tssrc/infra/update-managed-service-handoff-control.tssrc/infra/terminal-file-upload.tssrc/infra/outbound/outbound-send-service.tssrc/infra/outbound/outbound-audit.tssrc/infra/net/proxy/proxy-validation.tssrc/infra/session-cost-usage-worker-refresh.tssrc/infra/state-migrations.snapshot.worker.tssrc/infra/package-manager-exec-wrapper.tssrc/infra/state-migrations.apns.tssrc/infra/outbound/delivery-completion.tssrc/infra/update-database-backup.tssrc/infra/outbound/account-scoped-conversation-bindings.tssrc/infra/sqlite-integrity-worker.tssrc/infra/state-migrations.node-host.tssrc/infra/telemetry.tssrc/infra/package-dist-inventory.tssrc/infra/state-migrations.web-push.tssrc/infra/outbound/outbound-session.tssrc/infra/sqlite-schema-facts.tssrc/infra/npm-install-env.tssrc/infra/outbound/payloads.tssrc/infra/oauth-loopback-callback.tssrc/infra/state-migrations.acp-replay.tssrc/infra/worker-native-handle.tssrc/infra/state-migrations.restart-sentinel.tssrc/infra/sqlite-strict.tssrc/infra/state-migrations.media-persistence-targets.tssrc/infra/outbound/agent-delivery.tssrc/infra/sqlite-readonly-worker-session.tssrc/infra/session-cost-usage-reporting.tssrc/infra/shell-inline-command.tssrc/infra/update-failure-report-artifact.tssrc/infra/worker-cpu.tssrc/infra/state-migrations.workspace-setup-receipts.tssrc/infra/session-cost-usage-cache-runtime.tssrc/infra/sqlite-readonly-native-resource.client.tssrc/infra/state-migrations.plugin-doctor-context.tssrc/infra/windows-encoding.tssrc/infra/outbound/deliver-prepare.tssrc/infra/push-apns.relay.tssrc/infra/outbound/current-conversation-bindings.kernel.tssrc/infra/state-migrations.channel-pairing.tssrc/infra/state-migrations.mcp-oauth.tssrc/infra/unhandled-rejections.tssrc/infra/session-cost-usage-cache.sqlite.tssrc/infra/update-candidate-predecessor-stop.tssrc/infra/package-local-overrides-capture.tssrc/infra/package-update-lifecycle.tssrc/infra/state-migrations.plan.tssrc/infra/outbound/outbound-policy.tssrc/infra/sqlite-readonly-location.worker.tssrc/infra/package-update-activation-prepare.tssrc/infra/update-doctor-process-custody.tssrc/infra/net/undici-global-dispatcher.tssrc/infra/push-apns-http2.tssrc/infra/update-runner-git-transfer.tssrc/infra/update-database-restore.tssrc/infra/session-cost-usage-projection.tssrc/infra/push-web-store.tssrc/infra/outbound/deliver-queue-state.tssrc/infra/worker-task-pool-retirement.tssrc/infra/update-native-package-stage.tssrc/infra/session-delivery-queue-storage.tssrc/infra/session-delivery-queue-recovery.tssrc/infra/state-migrations.prelude.tssrc/infra/sqlite-wal-checkpoint.tssrc/infra/system-events.tssrc/infra/sqlite-snapshot-source.tssrc/infra/sqlite-worker-broker-lifecycle.tssrc/infra/sqlite-wal-filesystem.tssrc/infra/sqlite-snapshot-staging.tssrc/infra/state-migrations.plugin-state.tssrc/infra/sqlite-index-schema.tssrc/infra/outbound/message-action-contracts.tssrc/infra/update-run-codec.tssrc/infra/ocm-update-client.tssrc/infra/update-run-schema.tssrc/infra/state-migrations.commitments.tssrc/infra/update-campaign.tssrc/infra/push-web.tssrc/infra/system-presence.tssrc/infra/windows-install-roots.tssrc/infra/outbound/deliver-payload.tssrc/infra/update-triage-resolution.tssrc/infra/package-update-manager-preflight.tssrc/infra/update-run-reader.tssrc/infra/net/proxy/proxy-lifecycle.tssrc/infra/update-runner-git-steps.tssrc/infra/net/proxy-env.tssrc/infra/startup-migration-checkpoint.tssrc/infra/state-migrations.media-persistence-database.tssrc/infra/update-retained-runtime.tssrc/infra/system-disks.tssrc/infra/sqlite-worker-store.tssrc/infra/sqlite-worker-broker-admission.tssrc/infra/update-managed-service-handoff-reclamation.tssrc/infra/update-failure-facts.tssrc/infra/ssh-tunnel.tssrc/infra/worker-task-pool-owned.tssrc/infra/state-migrations.tui-last-session.tssrc/infra/package-local-overrides-shared.tssrc/infra/update-candidate-plugin-repair.tssrc/infra/outbound/deliver-contracts.tssrc/infra/sqlite-reader-lifecycle.tssrc/infra/outbound/deliver-hooks.tssrc/infra/session-delivery-queue.worker.tssrc/infra/sqlite-audit-record.kernel.tssrc/infra/windows-process-start.tssrc/infra/runtime-guard.tssrc/infra/worker-native-lifecycle.worker.tssrc/infra/outbound/delivery-queue-media-spool.tssrc/infra/openclaw-process-census.tssrc/infra/update-run-write.tssrc/infra/update-candidate-rehearsal.tssrc/infra/outbound/channel-selection.tssrc/infra/update-retained-runtime-tree.tssrc/infra/update-triage.tssrc/infra/update-managed-service-handoff-cleanup.tssrc/infra/path-env.tssrc/infra/state-migrations.meeting-transcripts-detection.tssrc/infra/update-managed-service-handoff-cancellation.tssrc/infra/node-duplex-framing.tssrc/infra/state-migrations.types.tssrc/infra/provider-usage.admin.tssrc/infra/update-candidate-canary-readiness.tssrc/infra/outbound/source-delivery-plan.tssrc/infra/provider-usage.fetch.claude.tssrc/infra/update-repair-agent.tssrc/infra/update-package-manager.tssrc/infra/package-update-swap-retirement.tssrc/infra/worker-task-server.tssrc/infra/openclaw-root.tssrc/infra/update-runtime-relocation.tssrc/infra/session-cost-usage-cache.kernel.tssrc/infra/question-channel-runtime-internal.tssrc/infra/outbound/channel-bootstrap.runtime.tssrc/infra/update-candidate-canary-process.tssrc/infra/outbound/channel-resolution.tssrc/infra/update-managed-command-custody.tssrc/infra/outbound/deliver-queue-admission.tssrc/infra/widearea-dns.tssrc/infra/outbound/target-normalization.tssrc/infra/session-delivery-queue-runtime.tssrc/infra/state-migrations.audit-checkpoints.tssrc/infra/session-sqlite-migration-artifact.tssrc/infra/windows-shell-command.tssrc/infra/update-runner-git-commands.tssrc/infra/sqlite-snapshot-staging.worker.tssrc/infra/update-candidate-plugin-tree-links.tssrc/infra/update-freebsd-pkg-ownership.tssrc/infra/net/node-proxy-agent.tssrc/infra/net/undici-runtime.tssrc/infra/state-migrations.audit-backup.tssrc/infra/outbound/conversation-delivery.tssrc/infra/state-migrations.cron-run-logs.tssrc/infra/update-candidate-admission.tssrc/infra/update-candidate-io.tssrc/infra/sqlite-worker-contract.tssrc/infra/sqlite-worker-transfer.tssrc/infra/sqlite-schema-sql.tssrc/infra/sqlite-readonly-worker-protocol.tssrc/infra/outbound/message-action-threading.tssrc/infra/update-runner-command.tssrc/infra/state-migrations.receipts.tssrc/infra/update-managed-service-handoff-process.tssrc/infra/ports-format.tssrc/infra/outbound/deliver-types.tssrc/infra/outbound/message-account-selection.tssrc/infra/update-run-step.tssrc/infra/system-run-approval-context.tssrc/infra/retained-operation.tssrc/infra/sqlite-snapshot-retirement.tssrc/infra/outbound/message-action-spec.tssrc/infra/update-managed-service-handoff-rows.tssrc/infra/push-web-preferences.tssrc/infra/package-update-activation.tssrc/infra/outbound/markdown-details.tssrc/infra/update-control-plane-sentinel.tssrc/infra/npm-registry-spec.tssrc/infra/update-channels.tssrc/infra/windows-port-pids.tssrc/infra/update-run-record.tssrc/infra/worker-task-pool-resources.tssrc/infra/update-run-recovery-native-schema.tssrc/infra/sqlite-worker-identity.tssrc/infra/session-cost-usage-rollup-codec.tssrc/infra/state-migrations.restart-sentinel-receipts.tssrc/infra/provider-usage.load.ts