Repository navigation
fix(update): unblock Windows repair around protected processes - #173783
Conversation
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
|
🦞👀 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. |
There was a problem hiding this comment.
💡 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( |
There was a problem hiding this comment.
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 👍 / 👎.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex review: blocked before merge. What this changesThe 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.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Partial 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 Before merge
Findings
Tests
Agent review detailsHow this fits togetherUpdate 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]
Technical reviewBest 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:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against d372cddb9fdd. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceAcceptance criteria:
What I checked:
Likely related people:
PR surfaceSource +143, Tests +268, Docs +4, Other 0. Total +415 across 19 files. Added test files: 1. View PR surface stats
Review metrics
LabelsLabel changes:
Label justifications:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale6/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. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed October 16, 2026, 12:34 AM ET / 04:34 UTC. |
|
Landing with an unrelated red check. The only failure is |
…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
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 -Straces that policy to9d2ef5e1daaa, retained through the native Windows census migration in698cac4c78b8. 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
dist/index.js, the same 60-second guard, and every WAL/state assertion: 67.887s timeout → 17.383s pass.node scripts/run-tsgo.mjs -p tsconfig.core.json --incremental --tsBuildInfoFile .artifacts/l1639/core.tsbuildinfoandnode scripts/run-tsgo.mjs -p .artifacts/l1639/test-types.json --incremental(all changed test files, with a project extendingtest/tsconfig/tsconfig.core.test.shard.json) both pass.node --import ./scripts/tsx.mjs scripts/check-madge-import-cycles.tsreports 0 cycles.git diff --checkpass. One obsolete mock-factory baseline entry is removed after preserving real module exports.origin.windowsUserSidfield and strips it conservatively. Strict lease/repair/public schemas and SQLite tables remain unchanged.started,unsettled, andservingtook 37.97s, 39.81s, and 32.24s. No assertions, deadlines, or retries were changed.check:changed/SQLite inventory is omitted under the campaign's local gate budget; PR CI provides broad proof.crabbox warmup --target windows --blacksmith-wait-timeout 1s --ttl 30m --keep --timing-jsonwas 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
rgoutput order for imports of the changed production basenames, directly or through the update-run barrel. All proof processes used isolated state: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.
src/cli/update-cli/update-command-database-rollback.test.ts— restores pre-migration databases only before settled activation: startedsrc/cli/update-cli/update-command-database-rollback.test.ts— restores pre-migration databases only before settled activation: unsettledsrc/cli/update-cli/update-command-database-rollback.test.ts— restores pre-migration databases only before settled activation: servingsrc/cli/update-cli.target-schema.test.ts— update-cli > refuses a service-only incompatible git target before any mutable preparationsrc/cli/update-cli.test.ts— update-cli > allows downgrade with --yes in non-interactive modesrc/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)src/cli/update-cli/update-command-fresh-preview.test.ts— Doctor sees an already-current update's completed history after original-state capturesrc/cli/doctor-output.process.test.ts— Doctor report process output > reports deferred Doctor-only state after config refusal, then convergessrc/cli/doctor-output.process.test.ts— Doctor report process output > explains and preserves retained custom agent databases in preview and repairsrc/cli/update-cli/update-command-candidate-authority.process.test.ts— composes migrated candidate, plugin/config publication and fresh Doctor: healthysrc/cli/update-cli/update-command-install-layout.test.ts— records the container-image-install non-outcome in CLI JSON, history and report eligibilitysrc/cli/update-cli/update-command-install-layout.test.ts— records the unmanaged-package-install non-outcome in CLI JSON, history and report eligibilitysrc/cli/update-cli/update-command-install-layout.test.ts— reports Homebrew guidance across output and existing history (database: true)src/cli/update-cli/update-command-timeouts.test.ts— forwards an inherited activation budget for already-current updates without --timeoutsrc/cli/update-cli/update-command-contention.test.ts— reports exhausted update admission as recoverable and preserves historysrc/commands/doctor-config-preflight.test.ts— runDoctorConfigPreflight > refuses pre-July install records restored after an earlier Doctor pass completedsrc/commands/doctor-config-preflight.test.ts— runDoctorConfigPreflight > repairs session keys with a legacy roster through Doctor and preserves the authored backupsrc/commands/doctor-update-schema-guard.test.ts— stops pre-migration backup production when Doctor accepts SIGINTsrc/commands/doctor-update-schema-guard.test.ts— refuses early unregistered WAL state and admits post-core repair after verified capturesrc/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 Doctorsrc/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 themsrc/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 agentsrc/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 markerssrc/commands/doctor-config-preflight.refusal.process.test.ts— Doctor CLI migration refusal > refuses missing deferral metadata with the 2026.9.2 row only in WALsrc/commands/doctor-config-preflight.refusal.process.test.ts— Doctor CLI migration refusal > fails closed with manual recovery for an unsupported workspace and conflicting exec policysrc/commands/doctor-config-preflight.refusal.process.test.ts— Doctor CLI migration refusal > stops the ordered graph at a refused TUI migrationsrc/commands/doctor-config-preflight.refusal.process.test.ts— keeps the shipped 9.2 rollback window read-only and validates private state: managed pnpm partial metadatasrc/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 runsrc/commands/doctor-config-preflight.refusal.process.test.ts— keeps the shipped 9.2 rollback window read-only and validates private state: managed handoff mismatchsrc/commands/doctor-config-preflight.refusal.process.test.ts— keeps the shipped 9.2 rollback window read-only and validates private state: managed handoff missingsrc/commands/doctor-config-preflight.refusal.process.test.ts— keeps the shipped 9.2 rollback window read-only and validates private state: failed schema publicationsrc/commands/doctor-config-preflight.refusal.process.test.ts— doctor schema-17 repair atomicity > rolls back rejected v17 repair through doctor --fixsrc/commands/doctor-config-flow.billing-route.test.ts— Doctor model billing route migration > records inherited billing changes once (multiagent: false)src/commands/doctor-config-flow.billing-route.test.ts— Doctor model billing route migration > records inherited billing changes once (multiagent: true)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 durablesrc/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 durablesrc/commands/doctor-config-flow.billing-route.test.ts— Doctor deferred model retirement > leaves the active update untouched without an update correlation channelsrc/commands/doctor-config-flow.billing-route.test.ts— Doctor deferred model retirement > preserves the deferred receipt when the repaired config write is refusedsrc/commands/doctor-maintenance.continuation-scope.test.ts— keeps Doctor continuation with its repair scope (cached writer: true)src/commands/doctor-maintenance.continuation-scope.test.ts— keeps Doctor continuation with its repair scope (cached writer: false)src/commands/doctor-maintenance.admission-activation.test.ts— restores within the native deadline when cold source observations cost two secondssrc/commands/doctor-maintenance.admission-activation.test.ts— refuses an update committed after the final restart ownership replytest/gateway-external-state-ownership.e2e.test.ts— Gateway external shared-state ownership > preserves recent and live drivers and explicitly repairs an inactive identityless rowtest/gateway-external-state-ownership.e2e.test.ts— Gateway external shared-state ownership > keeps CLI readers usable while the owning Gateway defers schema publicationObserved case-time sums above 120s (lower bounds; duplicate reporter output counted once):
src/commands/doctor-config-preflight.refusal.process.test.tssrc/commands/doctor-config-flow.billing-route.test.tssrc/commands/doctor-update-schema-guard.test.tssrc/cli/update-cli/update-command-original-service.test.tssrc/cli/update-cli.test.tssrc/cli/update-cli/update-command-database-rollback.test.tssrc/cli/update-cli.target-schema.test.tssrc/cli/update-cli/update-command-fresh-preview.test.tssrc/cli/update-cli/update-command-lease.test.tssrc/cli/update-cli/update-command-mutable-signals.test.tssrc/commands/doctor-config-preflight.test.tssrc/infra/update-managed-service-handoff-lifecycle.test.tstest/gateway-external-state-ownership.e2e.test.tssrc/cli/update-cli/update-command-install-layout.test.tssrc/commands/doctor-config-preflight.container-upgrade.test.tssrc/cli/update-finalization-output.process.test.tstest/scripts/ci-platform-checkout.test.tssrc/infra/update-database-restore.test.tssrc/commands/doctor-update-schema-guard.legacy-windows.test.ts