Skip to content

fix(update): unblock Windows repair around protected processes - #173783

Merged
steipete merged 1 commit into
mainfrom
upd/upd-l1639
Oct 16, 2026
Merged

steipete merged 1 commit into
mainfrom
upd/upd-l1639

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes #173430. Windows update repair treats unrelated protected processes as possible handoff holders, refusing repair even after an Administrator retry.

User Impact

Same-account repair can exclude fully access-denied system processes and positively unrelated readable processes, while retained-artifact holders and unresolved surviving update work still block repair. Older handoffs without a recorded launching SID retain the conservative refusal for fully unreadable processes; the error now says to run repair as the same Windows account that started the update.

Why This Change Was Made

The native census covers all host PIDs, rather than a handoff job or process tree. Current main still sends rows with missing command/cwd facts to unverifiedPids (source); git log -S traces that policy to 9d2ef5e1daaa, retained through the native Windows census migration in 698cac4c78b8. Missing command/cwd data previously turned every same-account or unknown-owner row into unverified work. Capture the launching token SID when a new update run is created, retain it with private operational origin facts, qualify access denial against that SID, and classify recorded PID/birth identities and ancestry before clearing a process. Reentry cannot replace the launching account; the public run projection omits the SID. Creation times reject pre-handoff/recycled-parent false ancestry; missing intermediate parents remain unverified. Positive artifact evidence always takes precedence.

The handoff producer and sealed helper use ordinary Node spawn() without alternate tokens or UAC elevation (handoff launcher, owned updater spawn, and service-command spawn). No dependency, config/CLI option, or strict persisted-schema changes.

Evidence

  • Owning-boundary reproduction against unmodified main: the initial regression table failed 9 cases, with the positive-artifact control passing. The durable-SID regression separately fails on the unmodified ledger because the launching SID is absent. Coverage includes same/different/unknown SID, legacy records, denied versus unexplained missing facts, pre-handoff PID reuse, real descendants, and surviving workers with missing/reused parent PIDs.
  • Cross-importer proof executed all 211 files / 3,738 tests: initially 3,728 passed, 5 failed in two existing Doctor fixture files, and 5 Windows-only tests were skipped on macOS. The five failures passed after the fixture-owner changes below; all other importer results remain valid because production source stayed unchanged.
  • Final focused proof: 194 tests pass; extracted wrapper closure: 18 tests pass; SID-forced ledger and CLI fixtures: 32 tests pass. Those forced-SID fixtures first failed for the intended byte-budget/public-projection assumptions, then passed with the SID accounted for and omitted from CLI JSON.
  • Local live-flow proof: 3 E2E files / 20 tests pass, including owned Gateway state publication/repair and real packaged repair workers with a synthetic local provider. Every harness used isolated HOME/state and fixture-owned ports/processes.
  • The old WAL refusal test launched the Node entry point synchronously through the Bun test worker executable. The existing owned real-Node child runner preserves dist/index.js, the same 60-second guard, and every WAL/state assertion: 67.887s timeout → 17.383s pass.
  • Billing fixtures retained disposable Doctor snapshots across their next logical invocation, and timeout cleanup overlapped successor HOME scopes. Closing each context first preserves every assertion: 6 tests pass / 105.52s file time; first billing case 130.204s timeout → 20.256s, result-channel case 122.880s timeout → 20.793s. Before timings are from the loaded importer run; after timings are from focused replays. No timeout increases, retries, or new skips.
  • Typechecks: node scripts/run-tsgo.mjs -p tsconfig.core.json --incremental --tsBuildInfoFile .artifacts/l1639/core.tsbuildinfo and node scripts/run-tsgo.mjs -p .artifacts/l1639/test-types.json --incremental (all changed test files, with a project extending test/tsconfig/tsconfig.core.test.shard.json) both pass. node --import ./scripts/tsx.mjs scripts/check-madge-import-cycles.ts reports 0 cycles.
  • Lint, formatting, line-cap ratchet, mock-export ratchet, and git diff --check pass. One obsolete mock-factory baseline entry is removed after preserving real module exports.
  • The v2026.10.3 update-run parser accepts the additional non-strict origin.windowsUserSid field and strips it conservatively. Strict lease/repair/public schemas and SQLite tables remain unchanged.
  • Independent Codex review of the final diff and replay evidence: no actionable P0–P2 findings. Simplification kept one census decision owner, existing private origin storage, and existing child-process/Doctor resource owners; no new managers or test-only production seams.
  • Existing slow-proof cost: E2E runtime preparation took 4m49s (tsdown 3m52.3s). The unchanged database rollback matrix repeatedly creates package/Git fixtures, captures/restores databases, and invokes fresh Doctor/worker subprocesses; passing cases started, unsettled, and serving took 37.97s, 39.81s, and 32.24s. No assertions, deadlines, or retries were changed.
  • Inherited max-lines wrapper failure: both untouched HEAD and this patch contain 452 production environment-variable names against an unchanged budget of 453; the ratchet rejects the stale, unshrunk budget. No environment names or budget changes are introduced. Full check:changed/SQLite inventory is omitted under the campaign's local gate budget; PR CI provides broad proof.
  • Windows live proof was unavailable: crabbox warmup --target windows --blacksmith-wait-timeout 1s --ttl 30m --keep --timing-json was rejected before allocating a lease because the configured Blacksmith provider supports Linux only. No Windows live result is claimed.

Diff size: production +152 / -9 (net +143), tests +336 / -68 (net +268); documentation +7 / -3, wrapper inventory +1, and mock baseline -1. The added production logic records the account fact durably and resolves ancestry at the existing census owner; no process-name exclusions.

Thanks @karljamoralin for the affected-host native census evidence.

Exact importer proof command

The 211 files were selected in rg output order for imports of the changed production basenames, directly or through the update-run barrel. All proof processes used isolated state:

mkdir -p .artifacts/l1639/home .artifacts/l1639/state
export HOME="$PWD/.artifacts/l1639/home"
export OPENCLAW_STATE_DIR="$PWD/.artifacts/l1639/state"
OPENCLAW_NODE_TEST_PLAN_CONTINUE_ON_FAILURE=1 node \
  scripts/run-vitest.mjs \
  test/gateway-external-state-ownership.e2e.test.ts \
  packages/gateway-protocol/src/update-runs-validators.test.ts \
  test/scripts/ci-platform-checkout.test.ts \
  src/cron/service/admission-timeout.test.ts \
  src/infra/update-run-interruption.worker.test.ts \
  src/infra/update-startup-request-adoption.test.ts \
  src/infra/update-run-windows-user.test.ts \
  src/infra/update-candidate-admission.test.ts \
  src/infra/update-run-ledger.test.ts \
  src/infra/update-run-step-key.test.ts \
  src/infra/update-startup.campaign-apply-error.test.ts \
  src/infra/update-run-doctor-lint.test.ts \
  src/infra/update-candidate-canary.lint.test.ts \
  src/infra/update-migrated-finalize.worker.test.ts \
  src/infra/update-runner-git.test.ts \
  src/infra/update-candidate-canary.exit.process.test.ts \
  src/infra/update-triage-resolution.test.ts \
  src/infra/update-run-capture-receipts.test.ts \
  src/infra/update-startup-campaign-run.test.ts \
  src/infra/update-repair-agent.e2e.test.ts \
  src/infra/update-run-continuation.test.ts \
  src/infra/update-run-recovery-admission.test.ts \
  src/infra/openclaw-process-census.test.ts \
  src/infra/windows-process-census.native.test.ts \
  src/infra/update-startup.test.ts \
  src/infra/update-run-recovery.test.ts \
  src/infra/update-repair-turn-worker.test.ts \
  src/infra/update-requester-authority.test.ts \
  src/infra/update-run-record.test.ts \
  src/infra/update-managed-service-handoff-cleanup-repair.test.ts \
  src/infra/update-retained-runtime.test.ts \
  src/infra/update-run-abandonment.test.ts \
  src/infra/update-managed-service-handoff-recovery.test.ts \
  src/infra/update-run-report.test.ts \
  src/infra/update-run-reader.test.ts \
  src/infra/update-run-recovery-handoff.test.ts \
  src/infra/update-database-restore.test.ts \
  src/infra/update-run-admission-hold.test.ts \
  src/infra/update-run-contention.test.ts \
  src/infra/update-run-interruption-store.test.ts \
  src/infra/update-run-notice.test.ts \
  src/infra/restart-sentinel.update-result.test.ts \
  src/gateway/server-runtime-services.delivery-recovery.test.ts \
  src/infra/update-run-ledger.compaction.test.ts \
  src/infra/windows-process-census.test.ts \
  src/infra/update-managed-service-handoff-lifecycle.test.ts \
  src/infra/update-run-reconciliation.worker.test.ts \
  src/cli/update-cli/update-command-service-command.timing.test.ts \
  src/infra/update-run-diagnostics.test.ts \
  src/cli/update-cli/update-command-terminal-triage.test.ts \
  src/cli/update-cli/update-command-migrated.test.ts \
  src/cli/update-cli/progress.observation.test.ts \
  src/cli/update-cli/update-command-windows-task.test.ts \
  src/cli/update-cli/update-command-failure-report.test.ts \
  src/daemon/schtasks.installed-package.test.ts \
  src/cli/update-cli/update-finalization-lifecycle.test.ts \
  src/cli/update-cli/update-command-initial-admission.test.ts \
  src/cli/update-cli/update-command-metadata-diagnostics.test.ts \
  src/daemon/service.test.ts \
  src/cli/update-cli/update-command-config-fence.test.ts \
  src/cli/update-cli/update-command-terminal-record.test.ts \
  src/cli/update-cli.admission-ledger.test.ts \
  src/plugins/update-authority.e2e.test.ts \
  src/cli/update-cli/update-command-legacy-finalize.test.ts \
  src/cli/update-cli/update-command-migrated-windows.test.ts \
  src/cli/update-cli/update-command-fresh-doctor.test.ts \
  src/cli/update-cli/update-command-doctor-authority-callers.test.ts \
  src/plugins/plugin-source-capture-directory.test.ts \
  src/cli/update-cli/update-command-post-update-recovery.test.ts \
  src/cli/update-cli/update-command-target-settlement.test.ts \
  src/cli/update-cli/update-command-run-service-ownership.test.ts \
  src/cli/update-cli/update-command-service-maintenance-native.test.ts \
  src/cli/update-cli/update-command-rollback-replay.test.ts \
  src/cli/update-cli.test.ts \
  src/cli/update-cli/update-command-post-core-admission.process.test.ts \
  src/cli/update-cli/update-command-doctor-requester.test.ts \
  src/cli/update-dry-run-state.process.test.ts \
  src/plugins/update-authority.test.ts \
  src/cli/update-cli/update-command-foreground.test.ts \
  src/cli/update-cli/update-repair-package-activation.test.ts \
  src/cli/update-cli/update-recovery-guidance.test.ts \
  src/cli/update-cli/update-command-service.test.ts \
  src/cli/update-cli/update-command-failure-recovery.test.ts \
  src/cli/update-cli/update-repair-history.test.ts \
  src/cli/update-cli/update-command-mutable-signals.test.ts \
  src/cli/update-cli/update-command-post-update.test.ts \
  src/cli/update-cli/update-repair-command.test.ts \
  src/cli/update-cli/update-command-capture-cleanup.test.ts \
  src/cli/update-cli/update-load-path-finalization.integration.test.ts \
  src/cli/update-cli/update-command-recovery-cost.test.ts \
  src/cli/update-cli/update-command-terminal-unreported.test.ts \
  src/plugins/plugin-source-capture-recovery.test.ts \
  src/cli/update-cli/update-command-admission.test.ts \
  src/cli/update-cli/update-command-service-maintenance.test.ts \
  src/cli/update-cli/update-command-verification.test.ts \
  src/state/openclaw-agent-db-path-repair.test.ts \
  src/cli/update-cli/update-command-timeouts.test.ts \
  src/cli/update-cli/status.recovery.test.ts \
  src/cli/update-cli/update-command-package-doctor.test.ts \
  src/cli/update-cli.target-schema.test.ts \
  src/cli/update-cli/update-command-doctor-child.test.ts \
  src/cli/update-cli/update-command-package.test.ts \
  src/cli/update-cli/update-command-rollback-executor.test.ts \
  src/cli/update-cli/update-command-contention.test.ts \
  src/cli/update-cli/update-command-execution-validation.test.ts \
  src/cli/update-cli/update-command-recovery.test.ts \
  src/cli/update-cli/update-command-fresh-inspection.test.ts \
  src/state/openclaw-state-db-publication-authority.test.ts \
  src/cli/update-cli/update-command-fresh-preview.test.ts \
  src/state/openclaw-state-db-schema-migration-required.test.ts \
  src/cli/update-cli/update-command-database-rollback.test.ts \
  src/cli/update-cli.deferred-completion.test.ts \
  src/cli/update-cli/update-repair-handoff.test.ts \
  src/cli/update-cli/update-command-finalize-refusal.test.ts \
  src/cli/update-cli/update-command-service.integration.test.ts \
  src/cli/update-cli/update-command-run.test.ts \
  src/state/openclaw-state-db-binding-targets.test.ts \
  src/cli/update-cli/update-command-original-service.test.ts \
  src/cli/update-finalization-output.process.test.ts \
  src/cli/update-cli/update-command-lifecycle.test.ts \
  src/cli/update-cli/update-command-verification-report.test.ts \
  src/cli/update-cli/update-command-admit.test.ts \
  src/cli/update-cli/update-command-task-delivery.test.ts \
  src/cli/update-cli/update-command-post-update-repair.test.ts \
  src/state/openclaw-state-db-prepared-workers.test.ts \
  src/cli/update-cli/update-command-candidate-authority.process.test.ts \
  src/cli/update-cli/update-command-sentinel-env.test.ts \
  src/cli/update-cli/update-command-pending-recovery.test.ts \
  src/cli/update-cli/status.test.ts \
  src/cli/update-cli/update-command-readiness.windows.test.ts \
  src/cli/update-cli/update-command-rollback.test.ts \
  src/cli/update-cli/update-command-doctor-capability.test.ts \
  src/cli/update-cli/update-command-native-recovery.test.ts \
  src/cli/update-cli/update-command-service-maintenance-handoff.test.ts \
  src/cli/update-cli/update-command-inspection-failure.test.ts \
  src/cli/update-cli/update-command-predecessor-readiness.test.ts \
  src/cli/update-cli/update-command-terminal-outcome.test.ts \
  src/state/openclaw-database-preflight.test.ts \
  src/cli/update-cli/update-command-plugin-caller.test.ts \
  src/cli/update-cli/progress.test.ts \
  src/cli/update-cli/update-command.test.ts \
  src/cli/update-cli/update-command-activation.test.ts \
  src/cli/update-cli/update-repair-triage.test.ts \
  src/cli/update-cli/update-command-include-channel.test.ts \
  src/cli/update-cli/update-command-report.test.ts \
  src/cli/update-cli/update-command-fresh-doctor-authority.test.ts \
  src/cli/update-cli/update-command-candidate-exit.test.ts \
  src/cli/update-cli/update-command-execution.test.ts \
  src/cli/update-cli/update-command-service-admission.test.ts \
  src/cli/daemon-cli.update-run.test.ts \
  src/cli/update-cli/update-command-lease.test.ts \
  src/cli/program/register.transcripts.test.ts \
  src/cli/update-cli/update-command-admission-schema.test.ts \
  src/cli/update-cli/update-command-doctor-canonical-delegation.test.ts \
  src/cli/doctor-output.process.test.ts \
  src/gateway/server-methods/update-handoff-failure.test.ts \
  src/cli/update-cli/update-command-install-layout.test.ts \
  src/cli/update-cli/update-command-fresh-overrides.test.ts \
  src/cli/update-cli.package-lifecycle.test.ts \
  src/cli/daemon-cli/install.definition-repair.test.ts \
  src/state/openclaw-state.worker.settlement.test.ts \
  src/state/openclaw-state-db-schema-version.test.ts \
  src/state/openclaw-database-paths.windows.test.ts \
  src/state/user-profiles.schema.test.ts \
  src/auto-reply/reply/commands-update.test.ts \
  src/gateway/server-methods/update-unexpected-error.test.ts \
  src/gateway/server-methods/update-freebsd-pkg.test.ts \
  src/gateway/server-methods/update-effective-channel.test.ts \
  src/gateway/server-restart-sentinel.test.ts \
  src/flows/doctor-plugin-source-captures.test.ts \
  src/flows/doctor-health.update-schema.test.ts \
  src/gateway/server-methods/update.test.ts \
  src/flows/doctor-health.update-budget.test.ts \
  src/flows/doctor-retained-runtime.settlement.test.ts \
  src/flows/doctor-health.fleet-preflight.test.ts \
  src/flows/doctor-retained-runtime.test.ts \
  src/commands/triage-run.test.ts \
  src/gateway/server-methods/update.ocm.test.ts \
  src/commands/doctor-lint.update-budget.test.ts \
  src/gateway/update-run-watcher.test.ts \
  src/gateway/update-run-watcher.schema-publication.test.ts \
  src/commands/doctor-update-run.test.ts \
  src/gateway/server-methods/update-status.test.ts \
  src/commands/doctor-maintenance.continuation-scope.test.ts \
  src/commands/doctor-maintenance.admission-activation.test.ts \
  src/gateway/server-restart-update-run.test.ts \
  src/commands/doctor-config-preflight.container-upgrade.test.ts \
  src/gateway/server-methods/update-owner.test.ts \
  src/commands/doctor-update-schema-guard.test.ts \
  src/gateway/server-methods/update-status-schedule.test.ts \
  src/gateway/server-methods/update-report-run.test.ts \
  src/commands/doctor-update-schema-guard.legacy-windows.test.ts \
  src/commands/doctor-maintenance.admission-warm.test.ts \
  src/commands/doctor-update-refusal.test.ts \
  src/gateway/server.roles-allowlist-update.test.ts \
  src/commands/doctor-config-preflight.test.ts \
  src/gateway/update-run-notice.test.ts \
  src/gateway/server-methods/update-status-sentinel.test.ts \
  src/gateway/update-run-watcher.interruption.test.ts \
  src/gateway/server-restart-sentinel-notice.test.ts \
  src/commands/doctor-maintenance.installation.test.ts \
  src/commands/doctor-update-rehearsal-inventory.test.ts \
  src/commands/doctor-config-preflight.refusal.process.test.ts \
  src/gateway/server-restart-sentinel.state-context.test.ts \
  src/commands/doctor-config-flow.billing-route.test.ts \
  src/commands/status.update-ledger.test.ts \
  src/commands/doctor-maintenance.finish-revalidation.test.ts \
  src/commands/doctor-original-capture.test.ts \
  src/commands/status-all/report-data.test.ts \
  src/commands/status.git-probe.test.ts \
  src/commands/doctor/shared/post-core-plugin-convergence.persistence.test.ts \
  --maxWorkers=1
Observed slow cases and fixture cost

These measurements are from the initial loaded importer run. Native compilation/setup is excluded from case times. Doctor lifetime and Node-runner repairs are measured separately above; the remaining costs predate this diff and retain their existing assertions and guards. Package/Git rollback and handoff suites create real owned process/state fixtures; Doctor cases perform real state discovery and repair.

Test Seconds
src/cli/update-cli/update-command-database-rollback.test.ts — restores pre-migration databases only before settled activation: started 37.970
src/cli/update-cli/update-command-database-rollback.test.ts — restores pre-migration databases only before settled activation: unsettled 39.809
src/cli/update-cli/update-command-database-rollback.test.ts — restores pre-migration databases only before settled activation: serving 32.237
src/cli/update-cli.target-schema.test.ts — update-cli > refuses a service-only incompatible git target before any mutable preparation 32.981
src/cli/update-cli.test.ts — update-cli > allows downgrade with --yes in non-interactive mode 36.762
src/cli/update-cli/update-command-fresh-preview.test.ts — update command admission with fresh state > reports an invalid dev target after settlement (dry run=false, existing=true) 31.718
src/cli/update-cli/update-command-fresh-preview.test.ts — Doctor sees an already-current update's completed history after original-state capture 44.236
src/cli/doctor-output.process.test.ts — Doctor report process output > reports deferred Doctor-only state after config refusal, then converges 41.028
src/cli/doctor-output.process.test.ts — Doctor report process output > explains and preserves retained custom agent databases in preview and repair 41.353
src/cli/update-cli/update-command-candidate-authority.process.test.ts — composes migrated candidate, plugin/config publication and fresh Doctor: healthy 32.463
src/cli/update-cli/update-command-install-layout.test.ts — records the container-image-install non-outcome in CLI JSON, history and report eligibility 57.941
src/cli/update-cli/update-command-install-layout.test.ts — records the unmanaged-package-install non-outcome in CLI JSON, history and report eligibility 46.910
src/cli/update-cli/update-command-install-layout.test.ts — reports Homebrew guidance across output and existing history (database: true) 59.753
src/cli/update-cli/update-command-timeouts.test.ts — forwards an inherited activation budget for already-current updates without --timeout 45.161
src/cli/update-cli/update-command-contention.test.ts — reports exhausted update admission as recoverable and preserves history 63.988
src/commands/doctor-config-preflight.test.ts — runDoctorConfigPreflight > refuses pre-July install records restored after an earlier Doctor pass completed 45.695
src/commands/doctor-config-preflight.test.ts — runDoctorConfigPreflight > repairs session keys with a legacy roster through Doctor and preserves the authored backup 48.033
src/commands/doctor-update-schema-guard.test.ts — stops pre-migration backup production when Doctor accepts SIGINT 47.618
src/commands/doctor-update-schema-guard.test.ts — refuses early unregistered WAL state and admits post-core repair after verified capture 34.102
src/commands/doctor-config-preflight.container-upgrade.test.ts — container image replacement Doctor repair and startup readiness > preserves schema 19 at startup, then backs it up and repairs it through Doctor 39.764
src/commands/doctor-config-preflight.container-upgrade.test.ts — container image replacement Doctor repair and startup readiness > leaves legacy workspace and audit state untouched until Doctor repairs them 30.503
src/commands/doctor-config-preflight.container-upgrade.test.ts — container image replacement Doctor repair and startup readiness > isolates a divergent auxiliary database while migrating and admitting the default agent 37.487
src/commands/doctor-config-preflight.container-upgrade.test.ts — container image replacement Doctor repair and startup readiness > refuses startup and Doctor repair when a core agent schema has conflicting markers 36.451
src/commands/doctor-config-preflight.refusal.process.test.ts — Doctor CLI migration refusal > refuses missing deferral metadata with the 2026.9.2 row only in WAL 67.887
src/commands/doctor-config-preflight.refusal.process.test.ts — Doctor CLI migration refusal > fails closed with manual recovery for an unsupported workspace and conflicting exec policy 48.829
src/commands/doctor-config-preflight.refusal.process.test.ts — Doctor CLI migration refusal > stops the ordered graph at a refused TUI migration 45.060
src/commands/doctor-config-preflight.refusal.process.test.ts — keeps the shipped 9.2 rollback window read-only and validates private state: managed pnpm partial metadata 86.403
src/commands/doctor-config-preflight.refusal.process.test.ts — keeps the shipped 9.2 rollback window read-only and validates private state: managed pnpm missing metadata run 72.355
src/commands/doctor-config-preflight.refusal.process.test.ts — keeps the shipped 9.2 rollback window read-only and validates private state: managed handoff mismatch 55.327
src/commands/doctor-config-preflight.refusal.process.test.ts — keeps the shipped 9.2 rollback window read-only and validates private state: managed handoff missing 68.245
src/commands/doctor-config-preflight.refusal.process.test.ts — keeps the shipped 9.2 rollback window read-only and validates private state: failed schema publication 93.650
src/commands/doctor-config-preflight.refusal.process.test.ts — doctor schema-17 repair atomicity > rolls back rejected v17 repair through doctor --fix 35.736
src/commands/doctor-config-flow.billing-route.test.ts — Doctor model billing route migration > records inherited billing changes once (multiagent: false) 130.204
src/commands/doctor-config-flow.billing-route.test.ts — Doctor model billing route migration > records inherited billing changes once (multiagent: true) 43.477
src/commands/doctor-config-flow.billing-route.test.ts — Doctor deferred model retirement > records package-swap deferral through run-id and completes it only after the repaired config is durable 89.379
src/commands/doctor-config-flow.billing-route.test.ts — Doctor deferred model retirement > records package-swap deferral through result-channel and completes it only after the repaired config is durable 122.880
src/commands/doctor-config-flow.billing-route.test.ts — Doctor deferred model retirement > leaves the active update untouched without an update correlation channel 90.860
src/commands/doctor-config-flow.billing-route.test.ts — Doctor deferred model retirement > preserves the deferred receipt when the repaired config write is refused 83.354
src/commands/doctor-maintenance.continuation-scope.test.ts — keeps Doctor continuation with its repair scope (cached writer: true) 34.220
src/commands/doctor-maintenance.continuation-scope.test.ts — keeps Doctor continuation with its repair scope (cached writer: false) 32.476
src/commands/doctor-maintenance.admission-activation.test.ts — restores within the native deadline when cold source observations cost two seconds 41.866
src/commands/doctor-maintenance.admission-activation.test.ts — refuses an update committed after the final restart ownership reply 38.267
test/gateway-external-state-ownership.e2e.test.ts — Gateway external shared-state ownership > preserves recent and live drivers and explicitly repairs an inactive identityless row 32.382
test/gateway-external-state-ownership.e2e.test.ts — Gateway external shared-state ownership > keeps CLI readers usable while the owning Gateway defers schema publication 30.792

Observed case-time sums above 120s (lower bounds; duplicate reporter output counted once):

File Seconds
src/commands/doctor-config-preflight.refusal.process.test.ts 596.347
src/commands/doctor-config-flow.billing-route.test.ts 560.154
src/commands/doctor-update-schema-guard.test.ts 371.582
src/cli/update-cli/update-command-original-service.test.ts 331.532
src/cli/update-cli.test.ts 289.796
src/cli/update-cli/update-command-database-rollback.test.ts 276.531
src/cli/update-cli.target-schema.test.ts 236.380
src/cli/update-cli/update-command-fresh-preview.test.ts 217.591
src/cli/update-cli/update-command-lease.test.ts 216.438
src/cli/update-cli/update-command-mutable-signals.test.ts 193.850
src/commands/doctor-config-preflight.test.ts 193.632
src/infra/update-managed-service-handoff-lifecycle.test.ts 186.190
test/gateway-external-state-ownership.e2e.test.ts 172.578
src/cli/update-cli/update-command-install-layout.test.ts 165.915
src/commands/doctor-config-preflight.container-upgrade.test.ts 144.205
src/cli/update-finalization-output.process.test.ts 143.934
test/scripts/ci-platform-checkout.test.ts 131.392
src/infra/update-database-restore.test.ts 130.196
src/commands/doctor-update-schema-guard.legacy-windows.test.ts 126.150

Record the launching Windows SID in tolerant private update-run history.
Qualify denied census rows against that account and verify retained process
ancestry with PID and creation-time identities before releasing custody.

Use the existing real-Node child owner and close Doctor snapshots between
logical fixture invocations found by cross-importer proof.

Fixes #173430
@clawsweeper

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

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation cli CLI command changes scripts Repository scripts commands Command implementations size: L labels Oct 16, 2026
@steipete
steipete marked this pull request as ready for review October 16, 2026 04:18

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: db1ef2921d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

return undefined;
}
try {
const result = spawnSync(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Cache the Windows SID instead of spawning per call

On Windows, every invocation synchronously starts PowerShell with a 5-second timeout, in addition to the initial registry-based system-root lookup. This helper runs for each createUpdateRun (even run-ID reentry before the existing row is returned) and for every run ID inspected by repair, so AppLocker or a stalled PowerShell can add repeated multi-second delays to one update or repair command even though the SID is process-stable. Resolve it once through a lifecycle-owned cache or carry one prepared value through the repair census.

AGENTS.md reference: AGENTS.md:L72-L74

Useful? React with 👍 / 👎.

@chatgpt-codex-connector

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-16T04:23:26.441076Z db1ef29 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Oct 16, 2026
@clawsweeper

clawsweeper Bot commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge.

What this changes

The PR records the launching Windows account and uses process birth identities and ancestry to exclude unrelated processes from update-repair refusals.

Example: Repair encounters an unreadable process born at identity 100 while every recorded update driver was born at identity 200.

  • Before: The process blocks repair as unverified.
  • After: The process is excluded unless readable evidence references retained update artifacts.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Useful partial repair with substantial harness coverage, one confirmed performance defect, and incomplete platform and upgrade validation.
Proof confidence 🦐 gold shrimp (3/6) Maintainer authorship exempts this PR from the ordinary contributor proof gate; supplied tests exercise persistence and synthetic census decisions, while Windows native execution is explicitly unclaimed and the required published-driver upgrade compatibility run is absent.
Patch quality 🦐 gold shrimp (3/6) 1 actionable review finding remain.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Partial
User problem: Windows users cannot reconcile failed updates because unrelated protected processes are reported as possible surviving updater work.
Reason: The maintainer-authored direction has clear recovery value, although existing post-reboot failures need separate completion.

Merge readiness

⛔ Blocked before merge - 2 items remain

Keep open: this maintainer-authored PR addresses a confirmed Windows recovery failure, but has a concrete performance defect and only partially covers the reported incident.

Priority: P1
Reviewed head: db1ef2921dfd3d2c4ca82615535d94a6f1ba14cf

Before merge

  • Reuse the process-stable Windows SID lookup (P2) - Every call synchronously launches PowerShell with a five-second timeout. createUpdateRun performs this before returning an existing run, and handoff repair repeats it for each inspected run. A stalled PowerShell therefore adds repeated multi-second pauses to update and repair, and consumes the census deadline even though the account fact is process-stable. Resolve it once through a lifecycle-owned cache, including an unavailable result, or carry one prepared value through these callers. This also violates the root instruction to reuse process-stable facts.
  • Add data-model compatibility proof - The review found that existing stored data may not work after upgrade. Show that existing data still loads and works with this change.

Findings

  • [P2] Reuse the process-stable Windows SID lookup — src/infra/windows-user-sid.ts:10-18

Tests

  • Missing end-to-end proof: Native Windows repair admission for the affected Defender row and a latest-stable published-driver upgrade preserving existing state are not demonstrated.
Agent review details

How this fits together

Update repair combines retained run history, handoff leases, and native process observations to decide whether installation recovery may reclaim abandoned work.

flowchart TD
 A[Update invocation] --> B[Private run history]
 C[Windows process census] --> D[Process custody classification]
 B --> D
 D --> E[Handoff repair admission]
 E --> F[Installation recovery and settlement]
Loading

Technical review

Best possible solution:

Keep one conservative census owner that admits proven unrelated processes, preserves unresolved real holders, and supports recovery of existing failed Windows updates.

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

The reporter's native census row deterministically reaches current main's unverified-process refusal; this review executed no target code.

Is this the best way to solve the issue?

The shared-owner approach is useful, but the post-reboot Defender row remains unresolved when its birth follows the retained drivers and its parent lacks identity; retain a related-issue link rather than claiming complete closure.

Full review comments:

  • [P2] Reuse the process-stable Windows SID lookup — src/infra/windows-user-sid.ts:10-18
    Every call synchronously launches PowerShell with a five-second timeout. createUpdateRun performs this before returning an existing run, and handoff repair repeats it for each inspected run. A stalled PowerShell therefore adds repeated multi-second pauses to update and repair, and consumes the census deadline even though the account fact is process-stable. Resolve it once through a lifecycle-owned cache, including an unavailable result, or carry one prepared value through these callers. This also violates the root instruction to reuse process-stable facts.
    Confidence: 0.98

Overall correctness: patch is incorrect
Overall confidence: 0.93

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Windows handoff census exclusions changes intended behavior with a stated reason (9d2ef5e: The original census conservatively retained unreadable same-account and unknown-owner processes because dead helper identities alone could not prove surviving work absent.)
  • Native process observation adapter keeps the original intent (698cac4: The native cutover moved ABI and handle ownership into proc-safe while retaining application custody policy and existing millisecond receipt identities.)
  • Managed handoff reclamation keeps the original intent (9680e57: Reclamation requires dead owners, retained original history, a grace period, census evidence, and current generation ownership before settlement.)
  • Origin receipt encoding keeps the original intent (44b5df1: Operational recovery receipts must survive diagnostic compaction within the existing origin byte budget.)
  • Doctor fixture resource lifetimes keeps the original intent (310bce6: Doctor contexts keep their resources alive through finalization; the patch closes completed logical invocations before beginning successors without weakening assertions.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

Acceptance criteria:

  • pnpm test src/infra/windows-process-census.test.ts src/infra/openclaw-process-census.test.ts src/infra/update-run-windows-user.test.ts src/infra/update-run-ledger.test.ts --maxWorkers=1
  • pnpm test src/cli/update-cli/update-command-install-layout.test.ts --maxWorkers=1
  • node scripts/check-changed.mjs -- src/infra/windows-user-sid.ts src/infra/windows-process-census.test.ts
  • git diff --check

What I checked:

Likely related people:

  • Dallin Romney: Raw commit 88a4f54 adds src/infra/openclaw-process-census.ts:114 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: 88a4f54164de; files: src/infra/openclaw-process-census.ts)
  • Vincent Koc: Raw commit d1b8902 adds src/infra/openclaw-process-census.ts:71 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: d1b89023368e; files: src/infra/openclaw-process-census.ts)

PR surface

Source +143, Tests +268, Docs +4, Other 0. Total +415 across 19 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 8 152 9 +143
Tests 8 336 68 +268
Docs 1 7 3 +4
Config 0 0 0 0
Generated 0 0 0 0
Other 2 1 1 0
Total 19 496 81 +415

Review metrics

Metric Value Why it matters
Production versus test LOC Production +152/-9; tests +336/-68 Most production growth implements durable account facts and ancestry classification at the existing census owner; the test growth covers custody distinctions, persistence, and fixture lifetimes.

Labels

Label changes:

  • add P1: An official-release Windows update-repair workflow remains blocked despite elevation and reboot, while the Gateway continues serving.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🦐 gold shrimp.
  • add status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

Label justifications:

  • P1: An official-release Windows update-repair workflow remains blocked despite elevation and reboot, while the Gateway continues serving.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🦐 gold shrimp.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Demonstrate native Windows repair using the reported Defender observation and retained failed-run state.
  • Verify the latest stable updater against the candidate with existing settings and data preserved.

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 execution lanes are retired.

Reviewed October 16, 2026, 12:34 AM ET / 04:34 UTC.

@steipete

Copy link
Copy Markdown
Contributor Author

Landing with an unrelated red check. The only failure is checks-node-changed-compact-large-22-1 (Bun lane): src/commands/doctor-config-preflight.test.ts > runDoctorConfigPreflight > leaves historical transcript…. This PR does not touch that file or its production owner (the PR changes the Windows process census and handoff origin recording). The same file passes 17/17 under Node on this exact head, and the Bun Doctor shard has been flaking the same way on unrelated PRs today. All other checks are green on db1ef2921dfd.

@steipete
steipete merged commit fc319b5 into main Oct 16, 2026
233 of 239 checks passed
@steipete
steipete deleted the upd/upd-l1639 branch October 16, 2026 04:44
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 17, 2026
…andoff descendants (openclaw#173783)

On Windows, openclaw update repair refused with 'Handoff descendants remain alive or unverified', naming Microsoft Defender's protected DefenderSessionHelper.exe (elevated) or ~180 system processes (non-elevated): the census treated every inaccessible process as a possible handoff child. The handoff now records the launching Windows account SID in the tolerant origin field; access-denied processes are ignored only when repair runs as that same account (the updater never elevates or switches accounts for its children), and a start-time/parent ancestry check classifies processes born before the handoff drivers as unrelated. Readable descendants and unverifiable true descendants still block; a different or unknown account keeps the refusal with guidance to run repair as the account that started the update. Windows live proof was unavailable (no Crabbox Windows lease).

Fixes openclaw#173430
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI command changes commands Command implementations docs Improvements or additions to documentation P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. scripts Repository scripts size: L status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: update repair on Windows refuses on Microsoft Defender's DefenderSessionHelper.exe ("Handoff descendants remain alive or unverified")

1 participant