Skip to content

refactor(infra): consolidate variant handling and lifecycle projections - #167012

Merged
steipete merged 3 commits into
mainfrom
deslop/d26-infra-20261007
Oct 8, 2026
Merged

steipete merged 3 commits into
mainfrom
deslop/d26-infra-20261007

Conversation

@steipete

@steipete steipete commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Closes #166956

What Problem This Solves

Infrastructure owners repeat variant handling, result construction, and operation context across otherwise identical paths.

User Impact

No user-visible behavior changes are intended. Features, flags, configuration, protocol and stored data shapes, exported contracts, and user-facing text remain unchanged. No migration is required.

Why This Change Was Made

Share the common paths while keeping real differences explicit: approval delivery and stop cleanup, shell decoding with exact source offsets, migration blocked results, package publication and rollback context, update copy and reporting flows, and usage projections. Authority checks remain at their original boundaries, and cleanup, recovery, ordering, and error distinctions are preserved.

The measured reduction is 988 net production lines across 66 files; tests are unchanged. A file-by-file pass covered all 823 permitted production files. The protected wrapper import closure and outbound code were excluded. The coverage log below records the inspected files.

Evidence

  • Isolated Codex review: no actionable P0–P2 findings. Two ordering details found during maintainer review were preserved explicitly: catch-captured canary phase and pre-await rollup freshness.
  • Differential parser proof: 294,972 decoder/source-offset comparisons, 30,000 word-tree comparisons, and 665 complete Tree-sitter explanation comparisons matched the original implementation.
  • Linux / Node 24.21.0: focused tests passed (2,588 tests; 18 existing conditional skips). node scripts/run-vitest.mjs src/infra passed (14,824 tests in 1,057 files; 71 existing skips in 10 files). These broad runs tested 7b5bdeeb5c34; subsequent changes restored the original APNs comparison and public declaration spelling, and tightened the assertion baseline. Tests and runtime statements in the declaration follow-up are unchanged.
  • On final head 0dd4a0396e81 (Hetzner Linux, Node 24.21.0), core production types and all 27 core test-type shards passed; changed-file formatting, core/script lint, ratchets, and the remaining planned guards passed. Delivery-claim tests passed (37 tests), and runtime/Madge cycle checks both reported zero cycles. The restored APNs comparison also passed 50 tests on 585688ebea91.
  • Two unrelated checks fail on the inherited base. The lint-suppression test finds two unlisted logging suppressions, independently reproduced on the unchanged base and already removed on main by fix(logging): unblock production lint suppression checks #166841. Knip flags the unchanged readRecommendedModels export in scripts/publish-model-catalog.mts, already made private on main by refactor: remove experimental fleet management #165825. Neither file nor either guard was changed here. No skips, new suppressions, or widened baselines were introduced.
  • The assertion baseline was canonically regenerated and verified to change only src/infra/npm-managed-root.ts from eight grandfathered assertions to six.
  • The full Plugin SDK comparison against the base reports no API changes: zero added/removed entrypoints and zero changed exports or reachable declarations. Final commit and all 67 changed-file hashes were verified before and after remote validation.
  • Exact-head CI passed on 0dd4a0396e814bd5b8b49b331bdeb8bba0b849c4: 76 successful jobs and 25 scope skips. The complete commit-check census has no failed or cancelled check, and the CI, dependency, and security review statuses are successful. CodeQL's aggregate result is neutral (17 configurations not found); the selected CodeQL jobs completed successfully.
File-by-file production coverage

C = consolidated in this PR; R = inspected and retained. Protected wrapper import-closure files and outbound were excluded. Detailed local notes record why larger candidates retained their distinct authority, recovery, ordering, or public-contract behavior.

File under src/infra/ Result
active-node-context.ts R
advertised-lan-host.ts R
agent-activity-events.ts R
agent-run-authority.types.ts R
agent-run-capacity-wait.ts R
agent-run-registry.types.ts R
agent-run-status-events.ts R
agent-run-terminal-writes.ts R
approval-channel-policy-support.ts R
approval-display-paths.ts R
approval-errors.ts R
approval-gateway-resolver.ts R
approval-gateway-runtime-context.ts R
approval-gateway-runtime-methods.ts R
approval-gateway-runtime.types.ts R
approval-handler-adapter-runtime.ts R
approval-handler-bootstrap.ts R
approval-handler-runtime-types.ts R
approval-handler-runtime.ts C
approval-native-delivery.ts R
approval-native-route-coordinator.ts C
approval-native-route-notice.ts R
approval-native-runtime-types.ts R
approval-native-runtime.ts R
approval-native-target-key.ts R
approval-presentation.ts R
approval-request-account-binding.ts R
approval-request-filters.ts R
approval-scope.ts R
approval-turn-source.ts R
approval-types.ts R
approval-view-model.ts R
approval-view-model.types.ts R
archive.ts R
backup-archive-path-policy.ts R
backup-archive-publication.ts R
backup-config-capture.ts R
backup-create-stream.ts R
backup-create.ts R
backup-retention.ts R
backup-sqlite-snapshot.ts R
backup-sqlite-source-groups.ts R
backup-tar-retry.ts R
backup-tar-walk.ts R
binaries.ts R
bonjour-discovery.ts R
brew.ts R
browser-open.ts R
channel-activity.ts R
channel-approval-auth.ts R
channel-runtime-context.ts R
channel-summary.ts R
channels-status-issues.ts R
clawhub-artifacts.ts R
clawhub-client.ts R
clawhub-display.ts R
clawhub-install-trust.ts R
clawhub-packages.ts R
clawhub-plugin-catalog.ts R
clawhub-plugin-icons.ts R
clawhub-plugin-manifest.ts R
clawhub-plugin-release.ts R
clawhub-plugin-skills.ts R
clawhub-promotions.ts R
clawhub-retry.ts C
clawhub-skill-security.ts R
clawhub-skills.ts R
clawhub-telemetry.ts R
clipboard.ts R
command-analysis/explain.ts R
command-analysis/inline-eval.ts R
command-analysis/risks.ts R
command-explainer/extract.ts C
command-explainer/format.ts R
command-explainer/tree-sitter-runtime.ts R
command-explainer/types.ts R
control-ui-assets.ts R
cron-run-exec-source.ts R
deferred-plugin-migration-warnings.ts R
deferred-plugin-session-empty.ts R
deferred-plugin-session-sources.ts R
deferred-plugin-session-verification.ts R
delivery-queue-sqlite-claim.kernel.ts C
delivery-queue-sqlite-namespace.kernel.ts R
delivery-queue-sqlite-namespace.ts R
delivery-queue-sqlite.kernel.ts R
delivery-queue-sqlite.ts R
delivery-queue-state-context.ts R
delivery-queue-worker-store.ts R
delivery-queue.worker-contract.ts R
delivery-queue.worker.ts R
delivery-recovery.shared.ts R
detect-binary.ts R
detect-package-manager.ts R
dev-install-branch.ts R
device-auth-store.kernel.ts R
device-auth-store.ts R
device-auth-store.worker.ts R
device-bootstrap.ts R
device-bootstrap.worker-kernel.ts R
device-bootstrap.worker-types.ts R
device-identity-async.ts R
device-identity-legacy.ts R
device-pairing-admission.types.ts R
device-pairing-approval.kernel.ts R
device-pairing-approval.ts R
device-pairing-binding.ts R
device-pairing-card-renderer.ts R
device-pairing-cloud-worker.ts R
device-pairing-core.kernel.ts C
device-pairing-core.types.ts R
device-pairing-core.worker-contract.ts R
device-pairing-core.worker.ts R
device-pairing-dispatch.worker.ts R
device-pairing-identity.ts R
device-pairing-join-code.ts R
device-pairing-join-code.worker.ts R
device-pairing-lock.ts R
device-pairing-migration.ts R
device-pairing-mutation.worker.ts R
device-pairing-node-desktop-migration.ts R
device-pairing-node-facts.ts R
device-pairing-node-state.ts R
device-pairing-node.records.ts R
device-pairing-node.ts R
device-pairing-node.worker-contract.ts R
device-pairing-node.worker.ts R
device-pairing-publication.ts R
device-pairing-read.kernel.ts R
device-pairing-read.types.ts R
device-pairing-resolution.ts R
device-pairing-state.kernel.ts R
device-pairing-store-cache.ts R
device-pairing-store-readonly.ts R
device-pairing-store.ts R
device-pairing-token-utils.ts R
device-pairing-tokens.kernel.ts R
device-pairing-tokens.ts R
device-pairing-worker-contract.ts R
device-pairing-worker.ts R
device-pairing.ts R
device-pairing.types.ts R
diagnostic-error-metadata.ts R
diagnostic-llm-content.ts R
diagnostic-model-request.ts R
diagnostic-process-types.ts R
diagnostic-rpc-types.ts R
diagnostic-run-types.ts R
diagnostic-semantic-run-progress.ts R
directory-entries.ts R
embedded-mode.ts R
embedded-plugin-approval-broker.ts R
embedded-question-broker.ts R
embedded-state-lock.ts R
error-diagnostics.ts R
event-session-routing.ts R
exec-approval-channel-runtime.ts R
exec-approval-channel-runtime.types.ts R
exec-approval-command-display.ts R
exec-approval-forwarder.messages.ts R
exec-approval-forwarder.runtime.ts R
exec-approval-forwarder.ts R
exec-approval-policy-snapshot.ts R
exec-approval-reply.ts R
exec-approval-session-target.ts R
exec-approval-surface.ts R
exec-approval-text-sanitize.ts R
exec-approvals-allow-always.ts R
exec-approvals-allowlist.ts R
exec-approvals-analysis.ts R
exec-approvals-authorization.kernel.ts R
exec-approvals-authorization.ts R
exec-approvals-authorization.worker-contract.ts R
exec-approvals-authorization.worker.ts R
exec-approvals-config.ts R
exec-approvals-contracts.ts R
exec-approvals-effective.ts R
exec-approvals-generated-migration.ts R
exec-approvals-mcp.ts R
exec-approvals-migration-gate.ts R
exec-approvals-policy.ts R
exec-approvals-resolver.ts R
exec-approvals-sqlite.ts R
exec-approvals-store.ts R
exec-approvals.ts R
exec-approvals.types.ts R
exec-argv-analysis.ts R
exec-authorization-plan.ts R
exec-authorization-render.ts R
exec-auto-approval-eligibility.ts R
exec-auto-review.ts R
exec-command-analysis-types.ts R
exec-control-command-guard.ts R
exec-host.ts R
exec-policy.ts R
exec-safe-bin-config.ts R
exec-safe-bin-runtime-policy.ts R
exec-safe-builtins.ts R
exec-wrapper-resolution.ts R
fatal-error-hooks.ts R
fetch.ts R
file-watch-notifier.ts C
format-time/format-datetime.ts R
format-time/format-duration.ts R
format-time/format-relative.ts R
format-time/parse-offsetless-zoned-datetime.ts R
fs-observation-mode.ts R
fs-observation-root.ts R
fs-observation-snapshot.ts R
fs-safe-compat.ts R
fs-safe-copy-worker-contract.ts R
fs-watch-errors.ts R
gateway-active-work.ts R
gateway-boot-lifecycle.kernel.ts C
gateway-boot-lifecycle.ts R
gateway-boot-lifecycle.worker.ts R
gateway-discovery-targets.ts R
gateway-drain.ts R
gateway-lock-diagnostics.ts R
gateway-lock-legacy.ts R
gateway-lock.ts R
gateway-owner-lease.types.ts R
gateway-processes.ts R
gateway-shutdown-budget.ts R
gateway-suspend-coordinator.ts C
gateway-work-metrics-events.ts R
gateway-work-metrics.ts R
gemini-auth.ts R
git-read-cache.ts R
git-read-operations.ts R
git-source.ts R
github-issue.ts R
google-api-base-url.ts R
heartbeat-active-hours.ts R
heartbeat-agent-resolution.ts R
heartbeat-config.ts R
heartbeat-cooldown.ts R
heartbeat-delivery-normalization.ts R
heartbeat-dispatch.ts R
heartbeat-events-filter.ts R
heartbeat-events.ts R
heartbeat-log.ts R
heartbeat-outcome-store.kernel.ts C
heartbeat-outcome-store.ts R
heartbeat-outcome-store.worker.ts R
heartbeat-reason.ts R
heartbeat-runner-config.ts R
heartbeat-runner-execution.ts R
heartbeat-runner-prompt.ts R
heartbeat-runner-run.ts R
heartbeat-runner-scheduler.ts R
heartbeat-runner-session.ts R
heartbeat-runner.ts R
heartbeat-schedule.ts R
heartbeat-session-publication.ts R
heartbeat-summary-projection.ts R
heartbeat-summary.ts R
heartbeat-typing.ts R
heartbeat-visibility.ts C
heartbeat-wake-contracts.ts R
heartbeat-wake-policy.ts R
heartbeat-wake.ts R
host-account-avatar.ts R
host-account-name.ts R
host-directory-listing.ts R
http-content-encoding.ts R
http-error-body.ts R
install-flow.ts R
install-from-npm-spec.ts R
install-mode-options.ts R
install-owner.ts R
install-package-dir.ts C
install-progress.ts R
install-source-utils.ts R
install-spec.ts R
install-target.ts R
installation-target-context.ts R
installed-apps.ts R
is-main.ts R
json-file.ts R
json-utf8-bytes.ts R
jsonl-socket.ts R
launchd-stop-timeout.ts R
legacy-acp-migration-source.ts R
legacy-json-object-stream.ts C
loopback-connect.ts R
machine-model.ts R
machine-name.ts R
mcp-tool-approval-binding.ts R
message-tool-run-outcome-store.kernel.ts R
message-tool-run-outcome-store.ts R
message-tool-run-outcome-store.worker.ts R
migration-warning-summary.ts R
net/node-proxy-agent.ts R
net/provider-websocket.ts R
net/proxy-fetch.ts R
net/proxy/proxy-lifecycle.ts R
net/proxy/proxy-validation.ts R
net/proxyline-runtime.ts R
network-discovery-display.ts R
network-interfaces.ts R
node-claude-skill-protocol.ts R
node-commands.ts R
node-duplex-framing.ts R
node-pairing-authz.ts R
node-pairing-migration.ts R
node-pairing-surface.ts R
node-shell.ts R
npm-command.ts R
npm-install-env.ts C
npm-integrity.ts R
npm-managed-root.ts C
oauth-loopback-callback.ts R
oauth-page-csp.ts R
ocm-update-client.ts R
openclaw-cli-invocation.ts R
openclaw-cli-shim.ts R
os-summary.ts R
package-dist-inventory.ts C
package-lifecycle.ts R
package-local-overrides-capture.ts C
package-local-overrides-preflight.ts C
package-local-overrides-shared.ts R
package-local-overrides.ts C
package-manager-exec-wrapper.ts R
package-plugin-composition.ts R
package-root-imports.ts R
package-tag.ts R
package-update-activation-immutable-pointer.ts R
package-update-activation-immutable-recovery.ts R
package-update-activation-prepare.ts R
package-update-activation-runtime-assets.ts R
package-update-activation-runtime.types.ts R
package-update-activation-sealed.ts R
package-update-activation-sqlite.ts R
package-update-activation.ts R
package-update-backup-paths.ts R
package-update-lifecycle.ts R
package-update-local-overrides.ts R
package-update-manager-preflight.ts R
package-update-npm-pack.ts R
package-update-npm-root.ts R
package-update-publication-owner.ts R
package-update-recovery-contract.ts R
package-update-steps.ts C
package-update-swap-contract.ts R
package-update-swap-results.ts R
package-update-swap-retirement.ts R
package-update-swap-target.ts R
package-update-swap.ts R
package-update-utils.ts R
package-update-verification-step.ts R
pairing-files.ts R
pairing-token.ts R
path-env.ts R
path-prepend.ts R
phone-number-presentation.ts R
plugin-approval-canonical-decisions.ts R
plugin-approvals.ts R
plugin-install-path-warnings.ts R
ports-format.ts R
ports-inspect.ts R
ports-lsof-listeners.ts R
ports-probe.ts C
ports-types.ts R
ports.ts R
private-dir-mode.ts R
private-file-store.ts R
process-respawn.ts R
promotions-feed.kernel.ts R
promotions-feed.ts R
promotions-feed.worker.ts R
provider-usage.admin.ts R
provider-usage.auth.ts R
provider-usage.fetch.claude.ts R
provider-usage.fetch.codex.ts R
provider-usage.fetch.deepseek.ts R
provider-usage.fetch.gemini.ts R
provider-usage.fetch.minimax.ts C
provider-usage.fetch.shared.ts R
provider-usage.fetch.zai.ts R
provider-usage.format.ts R
provider-usage.load.ts R
provider-usage.shared.ts R
provider-usage.ts R
provider-usage.types.ts R
push-apns-auth.ts R
push-apns-http2.ts R
push-apns-relay-url.ts R
push-apns-send-current.ts R
push-apns-store-transaction.ts C
push-apns-store.errors.ts R
push-apns-store.rows.ts R
push-apns-store.ts R
push-apns-store.types.ts R
push-apns-store.worker-contract.ts R
push-apns-store.worker.ts C
push-apns.relay.ts R
push-apns.ts R
push-web-preferences.ts R
push-web-store.kernel.ts R
push-web-store.native.ts R
push-web-store.records.ts R
push-web-store.scope.ts R
push-web-store.ts R
push-web-store.worker-contract.ts R
push-web-store.worker.ts R
push-web.ts R
question-channel-runtime-internal.ts R
question-channel-runtime.ts R
question-gateway-resolver.ts R
question-reaction-runtime.ts R
registry-package-archive.ts R
remote-env.ts R
resolve-system-bin.ts R
restart-budget.ts R
restart-coordinator.ts R
restart-handoff-contract.ts R
restart-handoff.ts R
restart-intent-error.ts R
restart-intent.ts R
restart-request.ts R
restart-sentinel-store.ts R
restart-sentinel.read.worker-contract.ts R
restart-sentinel.read.worker.ts R
restart-sentinel.ts C
restart-sentinel.worker-contract.ts R
restart-sentinel.worker.ts R
restart-supervisor.ts R
restart.ts R
restart.types.ts R
retained-cache.ts R
retry-after.ts R
retry-policy.ts R
retryable-network-errors.ts R
runtime-dependency-ownership.ts R
runtime-guard.ts R
runtime-status.ts R
safe-package-install.ts R
scp-host.ts C
sealed-runtime-bootstrap.ts R
secret-file.ts R
session-cost-usage-aggregation.ts R
session-cost-usage-cache-read.ts R
session-cost-usage-cache-runtime.ts C
session-cost-usage-cache.kernel.ts R
session-cost-usage-cache.sqlite.ts R
session-cost-usage-collection.ts R
session-cost-usage-events.ts R
session-cost-usage-incognito.ts R
session-cost-usage-pricing-context.ts R
session-cost-usage-pricing.ts R
session-cost-usage-projection.ts C
session-cost-usage-refresh-health.ts R
session-cost-usage-reporting.ts C
session-cost-usage-rollup.ts R
session-cost-usage-totals.ts R
session-cost-usage-worker-refresh.ts R
session-cost-usage-worker-runtime.ts R
session-cost-usage-worker.ts R
session-cost-usage-worker.types.ts R
session-cost-usage.ts R
session-cost-usage.types.ts R
session-delivery-queue-recovery.ts R
session-delivery-queue-runtime.ts R
session-delivery-queue-storage.ts R
session-delivery-queue.records.ts R
session-delivery-queue.worker-contract.ts R
session-delivery-queue.worker.ts R
session-event-wake.ts C
session-sqlite-migration-artifact.ts R
session-sqlite-migration-issues.ts R
session-sqlite-migration-manifest.ts R
session-sqlite-migration-readers.ts R
session-sqlite-transcript-verification.ts R
sibling-temp-file.ts R
sqlite-audit-record.read-contract.ts R
sqlite-audit-record.worker-contract.ts R
sqlite-audit-record.worker.ts R
sqlite-file-header.ts R
sqlite-integrity-operation.ts R
sqlite-integrity.worker.ts R
sqlite-readonly-inspection.ts R
sqlite-readonly-location.types.ts R
sqlite-readonly-native-resource.ts R
sqlite-readonly-operation-types.ts R
sqlite-snapshot-staging-runtime.ts R
sqlite-snapshot-staging.types.ts R
sqlite-snapshot-staging.worker.ts R
sqlite-worker-broker.types.ts R
sqlite-worker-database-context.ts R
sqlite-worker-operation-settlement.ts R
ssh-client.ts R
ssh-config.ts R
ssh-tunnel.ts C
state-migrations.acp-session-metadata.ts R
state-migrations.agent-database.ts R
state-migrations.agent-dir-receipt.ts R
state-migrations.agent-owner-recovery.ts R
state-migrations.apns.ts R
state-migrations.audit-backup.ts R
state-migrations.audit-checkpoints.ts R
state-migrations.audit-coordination.ts R
state-migrations.audit-logs.ts R
state-migrations.audit-logs.types.ts R
state-migrations.audit-moves.ts R
state-migrations.audit-records.ts R
state-migrations.audit-recovery-protocol.ts R
state-migrations.audit-recovery.ts R
state-migrations.audit-sanitized.ts R
state-migrations.channel-pairing.ts R
state-migrations.commitments.ts R
state-migrations.config-machine-state.ts R
state-migrations.debug-proxy.ts R
state-migrations.device-auth.ts R
state-migrations.device-identity-repair.ts R
state-migrations.device-identity.ts R
state-migrations.device-identity.types.ts R
state-migrations.doctor-discovery.ts R
state-migrations.doctor.ts C
state-migrations.exec-approvals-canonical.ts R
state-migrations.exec-approvals.ts R
state-migrations.exec-approvals.types.ts R
state-migrations.fs.ts R
state-migrations.json-fields.ts R
state-migrations.legacy-owner.ts R
state-migrations.legacy-session-store.ts R
state-migrations.legacy-sessions.ts R
state-migrations.lock.ts R
state-migrations.managed-outgoing-images.ts R
state-migrations.mcp-oauth-format.ts C
state-migrations.mcp-oauth-lock-stale.ts R
state-migrations.mcp-oauth-lock.ts R
state-migrations.mcp-oauth-store.ts R
state-migrations.mcp-oauth.ts R
state-migrations.mcp-oauth.types.ts R
state-migrations.mcp-oauth.worker-contract.ts R
state-migrations.mcp-oauth.worker.ts R
state-migrations.media-persistence-database.ts R
state-migrations.media-persistence-transform.ts R
state-migrations.media-persistence.ts R
state-migrations.meeting-transcripts-database.ts R
state-migrations.meeting-transcripts-detection.ts R
state-migrations.meeting-transcripts-files.ts R
state-migrations.meeting-transcripts-insert.ts R
state-migrations.meeting-transcripts-verify.ts R
state-migrations.meeting-transcripts.ts R
state-migrations.meeting-transcripts.types.ts R
state-migrations.messages.ts R
state-migrations.no-replace-move.ts R
state-migrations.node-host.ts R
state-migrations.pairing.ts R
state-migrations.plan.ts R
state-migrations.plugin-doctor-context.ts R
state-migrations.plugin-doctor.ts R
state-migrations.plugin-plan.ts R
state-migrations.plugin-state.ts R
state-migrations.prelude.ts R
state-migrations.rescue-pending.ts R
state-migrations.restart-sentinel.ts R
state-migrations.retired-cron-files.ts R
state-migrations.retired-delivery-files.ts R
state-migrations.retired-files.ts R
state-migrations.retired-runtime-files.ts R
state-migrations.runtime-state.ts R
state-migrations.session-store-paths.ts R
state-migrations.session-store.ts R
state-migrations.session-surfaces.ts R
state-migrations.shared-auth-store.ts R
state-migrations.shared-auth-store.types.ts R
state-migrations.snapshot.worker.ts C
state-migrations.source-backup.ts R
state-migrations.source-path.ts R
state-migrations.source-snapshot.ts R
state-migrations.state-dir.ts R
state-migrations.state-schema.ts R
state-migrations.steps.ts R
state-migrations.storage.ts R
state-migrations.transcript-archive-publication.ts R
state-migrations.transcript-directives-archives.ts R
state-migrations.transcript-directives-transform.ts R
state-migrations.transcript-directives.ts R
state-migrations.tui-last-session.ts C
state-migrations.types.ts R
state-migrations.web-push-parse.ts R
state-migrations.web-push.ts R
state-migrations.workspace-setup-files.ts R
state-migrations.workspace-setup-receipts.ts R
state-migrations.workspace-setup-store.ts R
state-migrations.workspace-setup.ts R
state-migrations.workspace-setup.types.ts R
state-repair-message.ts R
supervisor-markers.ts R
system-agent-approvals.ts R
system-disks.ts R
system-event-ownership.ts R
system-events.ts R
system-message.ts R
system-presence.ts R
system-run-approval-binding.ts R
system-run-approval-context.ts R
system-run-approval-plan.ts R
system-run-command.ts R
system-run-cwd-binding.ts R
system-run-file-snapshot.ts R
system-run-mutable-file-operand.ts R
system-run-mutable-file-options.ts R
system-run-mutable-file-policy.ts R
system-run-normalize.ts R
system-run-runtime-file-options.ts R
system-run-shell-file-operand.ts R
systemd-stop-timeout.ts R
tailnet.ts R
tailscale-backend-ready.ts R
tailscale-route-owner-protocol.ts R
tailscale-route-owner.worker.ts R
tailscale-route-ownership-error.ts R
tailscale.ts R
telemetry-store.kernel.ts R
telemetry-store.worker.ts R
telemetry-worker-contract.ts R
telemetry.ts C
temp-download.ts R
terminal-file-upload.ts R
tls/gateway.ts C
transport-ready.ts C
triage-continuation.ts R
unhandled-rejections.ts R
unicode-visibility.ts R
update-admission-contract.ts R
update-campaign.ts R
update-candidate-admission.ts R
update-candidate-canary-commands.ts R
update-candidate-canary-process.ts R
update-candidate-canary-progress.ts R
update-candidate-canary-readiness.ts R
update-candidate-canary.ts C
update-candidate-exec-approvals.ts R
update-candidate-io.ts R
update-candidate-paths.ts R
update-candidate-plugin-code-links.ts R
update-candidate-plugin-file.ts C
update-candidate-plugin-repair.ts R
update-candidate-plugin-sources.ts C
update-candidate-plugin-tree-links.ts R
update-candidate-plugin-tree-schema.ts R
update-candidate-plugin-tree.ts R
update-candidate-plugins.ts R
update-candidate-predecessor-stop.ts R
update-candidate-rehearsal.ts R
update-candidate-snapshot.ts R
update-candidate-state.diagnostics.ts R
update-candidate-state.inspection.ts R
update-candidate-state.process.ts R
update-candidate-state.sizes.ts R
update-candidate-state.ts R
update-candidate-state.worker.ts R
update-capture-paths.ts R
update-capture-privacy-marker.ts R
update-check-lifecycle.ts R
update-check-package-target.ts C
update-check.ts R
update-control-plane-sentinel.ts R
update-database-backup.ts R
update-database-generations.ts R
update-database-restore-source.ts R
update-database-restore.ts R
update-deferred-model-retirement.ts R
update-dev-target.ts R
update-doctor-config.ts R
update-doctor-lint-schema.ts R
update-doctor-lint.ts R
update-doctor-process-custody.ts R
update-failure-report-artifact-sweep.ts C
update-failure-report-artifact.ts R
update-failure-report-precreate.ts C
update-failure-report-prepare.ts C
update-failure-report-receipt-store.ts C
update-failure-report.ts C
update-failure-result.ts R
update-finalization-budget.ts R
update-freebsd-pkg-ownership.ts C
update-git-metadata.ts R
update-git-runtime.ts R
update-global-command-runner.ts R
update-global.ts C
update-immutable-activation.ts C
update-immutable-generation.ts C
update-immutable-install-record.ts R
update-immutable-install.ts C
update-immutable-layout.ts R
update-immutable-owner.ts R
update-immutable-protection.ts R
update-immutable-service.ts R
update-immutable-verification.ts R
update-install-kind.ts R
update-install-root.ts C
update-install-status.ts R
update-install-status.types.ts R
update-managed-command-custody.ts R
update-managed-service-handoff-command-source.ts R
update-managed-service-handoff-command.ts R
update-managed-service-handoff-control.ts R
update-managed-service-handoff-current.ts R
update-managed-service-handoff-database-recovery.ts R
update-managed-service-handoff-identity.ts R
update-managed-service-handoff-lease-types.ts R
update-managed-service-handoff-native-loader.ts R
update-managed-service-handoff-native-scope-source.ts R
update-managed-service-handoff-native.ts R
update-managed-service-handoff-node.ts R
update-managed-service-handoff-parent-source.ts R
update-managed-service-handoff-result-source.ts R
update-managed-service-handoff-runtime-assets.ts R
update-managed-service-handoff-runtime.ts R
update-managed-service-handoff-sealed.ts R
update-managed-service-handoff-service.ts R
update-managed-service-handoff-types.ts R
update-managed-service-handoff.ts R
update-migrated-finalize.worker.ts R
update-native-package-owner.ts R
update-native-package-stage.ts R
update-network-budget.ts R
update-npm-failure.ts R
update-npm-prefix.ts C
update-package-manager.ts R
update-post-core-capability.ts R
update-post-core-context.ts R
update-recovery-backup-reader.ts R
update-recovery-backup-status.ts R
update-recovery-baseline-capture.ts R
update-recovery-capture-acquisition.ts R
update-recovery-capture-seal.ts R
update-rehearsal-paths.ts R
update-repair-agent.runtime.ts R
update-repair-agent.ts R
update-repair-inference.ts R
update-repair-maintenance.ts R
update-repair-protocol.ts R
update-repair-turn-worker.ts R
update-repair-turn.ts R
update-repair.worker.ts R
update-requester-authority.ts R
update-restart-notice.ts R
update-restart-sentinel-payload.ts R
update-retained-runtime-tree.ts C
update-retained-runtime.ts R
update-run-activity.ts R
update-run-admission.ts R
update-run-codec.ts R
update-run-driver.ts R
update-run-interruption-contract.ts R
update-run-interruption-health.ts R
update-run-interruption-store.ts R
update-run-interruption-worker.ts R
update-run-interruption.ts R
update-run-ledger.ts R
update-run-legacy-expiry.ts R
update-run-mutation.types.ts R
update-run-mutation.worker.ts R
update-run-notice.ts C
update-run-read.kernel.ts R
update-run-reader.ts C
update-run-reconciliation.read.ts R
update-run-reconciliation.ts C
update-run-reconciliation.types.ts R
update-run-reconciliation.worker.ts C
update-run-record.ts R
update-run-recovery-admission.ts R
update-run-recovery-keys.ts R
update-run-recovery-native-schema.ts R
update-run-recovery-package-schema.ts R
update-run-recovery-schema.ts R
update-run-recovery-state.ts R
update-run-recovery-store.ts R
update-run-recovery-types.ts R
update-run-recovery.ts R
update-run-report-health.ts R
update-run-report.ts R
update-run-result.ts R
update-run-status.ts R
update-run-step-key.ts R
update-run-step.ts R
update-run-terminal-record.ts R
update-run-verification.ts R
update-run-write.async.ts R
update-run-write.ts R
update-runner-command.ts R
update-runner-doctor.ts R
update-runner-git-cleanup.ts R
update-runner-git-commands.ts C
update-runner-git-node-preflight.ts C
update-runner-git-preflight.ts C
update-runner-git-recovery.ts R
update-runner-git-runtime.ts R
update-runner-git-steps.ts R
update-runner-git-target.ts C
update-runner-git-transfer.ts R
update-runner-git.ts R
update-runner-install-surface.ts R
update-runner-types.ts R
update-runtime-relocation.ts R
update-snapshot-capacity.ts R
update-startup-auto-run.ts R
update-startup.ts R
update-status-schedule.ts C
update-status-state.ts R
update-step-result.ts R
update-timeout-provenance.ts R
update-triage-resolution.ts R
update-triage.ts R
voicewake-routing.ts C
voicewake.ts R
widearea-dns.ts R
windows-gateway-firewall-diagnostics.ts R
windows-launcher-encoding.ts R
windows-powershell-spawn.ts R
windows-shell-command.ts C
windows-task-restart.ts R
worker-native-lifecycle.types.ts R
worker-native-lifecycle.worker.ts R
worker-task-pool.types.ts R
ws.ts R

@clawsweeper

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

@steipete
steipete marked this pull request as ready for review October 8, 2026 06:57
@github-actions

github-actions Bot commented Oct 8, 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: 0dd4a0396e814bd5b8b49b331bdeb8bba0b849c4
  • Maintainer: @steipete
  • Repository role: admin

These security sensitive changes were made:

  • src/infra/device-pairing-core.kernel.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.

Carefully review these changes before merging.

@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 8, 2026
@clawsweeper

clawsweeper Bot commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed October 8, 2026, 3:04 AM ET / 07:04 UTC.

ClawSweeper review

What this changes

This PR consolidates repeated infrastructure handling for approvals, shell parsing, migrations, package updates, cleanup, and usage reports while preserving existing contracts.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Useful, approved consolidation with no actionable defect found, supported by substantial reported tests and differential comparisons but limited shipped-entry-point evidence.
Proof confidence 🦐 gold shrimp (3/6) Not applicable: The supplied repository state and security-guard discussion establish maintainer authorship, so the ordinary external-contributor proof gate does not apply. Recorded validation exercises production logic through tests and differential comparisons; no material authority change was established. The diff preserves stored formats and migration semantics without introducing a data-model migration.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Refactor · Worth it: Yes · Fix scope: Complete
Reason: The linked request establishes owner direction for behavior-preserving consolidation. Removing repeated construction and handling within existing owners has maintenance value without adding product surface.

Merge readiness

⛔ Blocked before merge - 1 item remains

Keep open as requested infrastructure maintenance. No concrete introduced correctness or security defect was found; the distinct consolidation work remains absent from current main.

Priority: P3
Reviewed head: 0dd4a0396e814bd5b8b49b331bdeb8bba0b849c4

Before merge

  • Resolve review confidence - ClawSweeper must reach high confidence before merge readiness is known.

Findings

None.

Tests

  • Missing end-to-end proof: The supplied evidence records differential parser comparisons and tests, but no shipped CLI or Gateway execution of the consolidated paths. This read-only review did not execute target code; a failing-base regression is not applicable to the intended behavior-preserving refactor.
Agent review details

How this fits together

OpenClaw’s infrastructure supports Gateway lifecycle, approval delivery, package installation and updates, stored-state migration, and usage reporting. These owners consume requests and existing state, then produce guarded operations, recovery outcomes, and reports.

flowchart TD
  A[CLI and Gateway requests] --> B[Infrastructure owners]
  C[Configuration and stored state] --> B
  B --> D[Existing authority and lifecycle checks]
  D --> E[Shared variant handling]
  E --> F[Transport and filesystem operations]
  E --> G[State updates and usage reports]
  F --> H[Cleanup and recovery outcomes]
Loading

Technical review

Best possible solution:

Keep shared handling inside the existing owners while retaining their distinct authority checks, ordering, recovery, and public contracts.

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

Not applicable: this PR addresses repeated infrastructure implementation rather than a failing user flow; the introduced diff establishes the consolidation opportunity.

Is this the best way to solve the issue?

Yes: the patch shares existing operations while preserving variant-specific checks and outcomes, matching the linked maintenance request.

AGENTS.md: found and applied where relevant.

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

Provenance checked

Testing

Proof path: in-process harness. Added test files: 0.

Security

None.

Evidence

What I checked:

  • Approved maintenance scope: refactor(infra): consolidate repeated lifecycle and variant handling #166956 explicitly requests behavior-preserving infrastructure consolidation, unchanged contracts and assertions, and the listed validation gates. This PR is its candidate implementation.
  • Pinned introduction and clean checkout: Reviewed the merge-base-to-head introduced hunks across all listed paths. The assertion baseline only shrinks the managed npm assertion count from eight to six; no test files, dependencies, schema definitions, or configuration options are introduced. The final checkout status is clean. (config/assertion-safety-baseline.txt:2215, 0dd4a0396e81)
  • Delivery ownership preserved: The shared send transition retains the promote-only producer-state requirement, exact live-claim check, transactional publication, and dispatch preservation of unknown-after-send evidence. (src/infra/delivery-queue-sqlite-claim.kernel.ts:191, 0dd4a0396e81)
  • Pairing and revocation equivalence: The extracted removal helper deletes the same paired device and matching pending requests; callers retain their original eligibility checks, mutation admission, persistence, and APNs cleanup. Metadata updates retain the same explicit field allowlist. (src/infra/device-pairing-core.kernel.ts:215, 0dd4a0396e81)
  • Approval stop cleanup preserved: The combined delivery branch still avoids binding after stop, unbinds a completed binding after a mid-flight stop, and cancels unbound delivery effects. Existing tests cover all three races; they were not changed. (src/infra/approval-handler-runtime.ts:480, 0dd4a0396e81)
  • Usage projection ordering: The shared reader computes aggregate freshness before awaiting body reads, retains session freshness after decoding, reports invalid bodies, and preserves file-by-file accumulation and refresh selection. (src/infra/session-cost-usage-projection.ts:124, 0dd4a0396e81)

Likely related people:

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

PR surface

Source -988, Other 0. Total -988 across 67 files.

View PR surface stats
Area Files Added Removed Net
Source 66 1651 2639 -988
Tests 0 0 0 0
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 1 1 0
Total 67 1652 2640 -988

Stored data model

Persistent data-model change detected: migration/backfill/repair: src/infra/state-migrations.doctor.ts, unknown-data-model-change: src/infra/state-migrations.doctor.ts. Migration or upgrade compatibility proof is recorded; maintainers should verify it before merge.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #166956
Summary: This PR is the candidate implementation of the explicitly linked infrastructure maintenance request.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Labels

Label changes:

  • add P3: This is explicitly requested internal maintenance with no intended user-visible behavior change or reported urgent runtime failure.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P3: This is explicitly requested internal maintenance with no intended user-visible behavior change or reported urgent runtime failure.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only; repair and merge need explicit maintainer commands such as @clawsweeper autofix or @clawsweeper automerge.

@steipete
steipete merged commit ea26da6 into main Oct 8, 2026
237 checks passed
@steipete
steipete deleted the deslop/d26-infra-20261007 branch October 8, 2026 07:23
@steipete

steipete commented Oct 8, 2026

Copy link
Copy Markdown
Contributor Author

Maintainer closeout for 0dd4a0396e814bd5b8b49b331bdeb8bba0b849c4: the automated review found no correctness or security defect and retained a medium-confidence runtime-proof flag. For this explicitly requested behavior-preserving refactor, the unchanged test assertions, full infra and focused runs, differential parser comparisons, empty SDK API diff, fresh independent reviews, and successful exact-head hosted CI satisfy the agreed validation scope.

The Doctor edits consolidate equivalent result construction. Schemas, persisted formats, migration ordering, and admission decisions are unchanged. No production Gateway verification is claimed.

Verified squash commit ea26da6e902d0b29cab793482f1ea3c70dab507e on fetched main, with 988 net production lines removed. The linked maintenance issue is closed and the test lease is released.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 9, 2026
…ns (openclaw#167012)

Consolidate repeated infra variant handling and lifecycle operations while preserving approval authority, cleanup order, shell decoding and source offsets, migration results, package publication and rollback, update reporting, and usage projections.

Remove 988 net production lines across 66 files. Keep tests and Plugin SDK declarations unchanged, and shrink the assertion baseline only where two assertions were removed.

Validation: 14,824 infra tests and 2,588 focused tests passed; final-head production and test types, lint, owner guards, delivery-claim tests, zero-cycle checks, and the full SDK API comparison passed. Exact-head CI passed. Two inherited local guard failures were already fixed on main and are documented in the PR.

Closes openclaw#166956.
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: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. 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.

refactor(infra): consolidate repeated lifecycle and variant handling

1 participant