Skip to content

fix(update): bound activation and accept slow Windows identity reads - #147019

Merged
steipete merged 2 commits into
mainfrom
steipete/upd-windows-handoff-start-identity
Sep 13, 2026
Merged

steipete merged 2 commits into
mainfrom
steipete/upd-windows-handoff-start-identity

Conversation

@steipete

@steipete steipete commented Sep 13, 2026 •

Copy link
Copy Markdown
Contributor

Refs #146860. Refs #138560.

What Problem This Solves

Updates can remain in activating without an enclosing execution deadline, while the managed handoff rejects valid Windows process identities when their lookup exceeds a forced one-second budget.

User Impact

Activation now has a bounded failure outcome, update-activation-timeout, with next steps in openclaw update status and Doctor. Slow valid Windows identity reads use the existing shared reader budget. InteractiveToken remains supported, and PID-reuse protection remains required.

A timeout does not authorize rollback, restart, or lease release. Unsettled writers keep their ownership. If migration or pending recovery prevents safe history publication, the updater reports the timeout and preserves that state for its owning runtime. An activation timeout can leave the Gateway stopped.

Why This Change Was Made

The existing update executor owns the deadline through activation and settlement. It closes admission, cancels through the existing command-process scope, and joins within a finite allowance before reporting failure. Windows cleanup retains the existing taskkill ordering and join owner. Direct updates, Doctor updates, current-core plugin convergence, and migrated finalization use the existing multi-step envelope: max(30 minutes, 6 × per-step timeout). Cancellation settlement has the same bounded allowance; expiry alone never proves that a writer stopped.

The one-second override is removed from the lease reader. The canonical Windows reader already has a bounded ten-second envelope, with a five-second PowerShell attempt and any remaining time for WMIC. No new retry or principal-specific path is added. The report does not establish why the actual Windows query failed, and this change does not attribute that failure to stored task credentials.

Duplicate finalization budget formulas now share their existing owner. Runtime state preparation now sits with run admission and preserves its existing sequence and authority checks. A revoked delegated Doctor request is checked before loading the repair flow, then authority is rechecked after loading.

Sibling #145219 forwards caller budgets through handoff and runtime probes, but does not change the lease reader's forced one-second override. This PR handles that override; overlapping caller/docs changes will be reconciled when #145219 is rebased. No config, schema, dependency, protocol, or changelog changes. Production delta: +933/-641 lines (net +292); much of the diff is existing executor code wrapped by the deadline scope.

Reported by @rogerspires4452-dev (#146860).

Evidence

  • Final exact-head CI: run 34759230380 passed on 27bfeee0af2f078628cb7e7160db33e4a0248cec, including both Windows test jobs. Its checkout log confirms merge 82931792276b against base 060e856e5f9, including the required main repair; the exact-head watcher reports GREEN. The first reopen used an obsolete merge, so a second close/reopen was needed. No code changed during landing.

  • Before: a valid two-second identity probe throws managed handoff process start identity is unavailable. After: all four lease identity boundary cases pass, including unavailable/exhausted-query refusal.

  • Before: stalled executor settlement produces no terminal result, and synchronous work beyond its deadline returns success. After: timeout is recorded as finished/failed, the reason is preserved, outstanding ownership excludes another update, and normal completion is unchanged.

  • Before: commands ignore scope cancellation; Windows taskkill is never dispatched. After: all 46 process and Windows command tests pass, including forced-taskkill join ordering and sibling isolation.

  • CLI, status, Doctor, migrated-state, and legacy-producer boundary tests exercised the actual owners. One delegated-Doctor fixture initially hit its unchanged 15-second child deadline; moving requester refusal ahead of the repair-flow import made that regression pass without increasing its timeout.

  • Launchd/systemd activation cancellation: four focused boundary cases pass. Legacy 2026.9.4 grant fixtures exercise the real candidate worker and native-command receiver.

  • Initial Linux CI exposed an executor-test cleanup race (kill ESRCH) after the command scope had already stopped its descendant. Commit 27bfeee0af2f reuses the existing race-safe cleanup helper and asserts exit, preserving the live-descendant and retained-installation assertions. Both focused cases, their changed-file checks, and a fresh P1 review pass.

  • Runtime build and pnpm check:changed passed. Independent P1 autoreview is scoped-clean; its parent-budget finding was fixed and re-reviewed.

  • Initial-head CI on 9030b95481b0958ae1afd3a7416853059f5907da reported a main-side failure in check-test-types-core-2: session-accessor.sqlite-reclamation-memory.test.ts:44,50 has TS2322/TS2339 errors around onCommitRequest. The file was added on main by fix(memory): admit shared index writes through the agent owner #146760 (e05d8b6c907) and is absent from this branch. CI checked merge ed796165 against base bf066ff9; this unrelated file was left untouched. The same file also failed at runtime in checks-node-compact-small-1; its callback contract changed on main in perf(sessions): keep cleanup responsive and reuse workers #140897.

No Windows-native end-to-end managed update with an InteractiveToken Scheduled Task was available. The Windows CI unit-test shard passed on the initial head. Evidence is the reporter's run records, unit/boundary tests, mocked Windows taskkill ordering, and real local subprocess/legacy-worker tests. The installed updater runs first; a candidate cannot retroactively repair an old driver's pre-candidate identity lookup.

ClawSweeper review

The completed review of 27bfeee0af2f078628cb7e7160db33e4a0248cec found no actionable code defect. The maintainer landing decision accepts the documented availability tradeoff and native Windows upgrade/recovery proof gap: activation expiry can leave the Gateway stopped, and unsettled ownership remains retained for recovery. The reporter's identity-query trace remains outstanding, so #146860 remains open; this change cannot repair an installed updater's earlier lookup. Budget-forwarding overlap will be reconciled at #145219's rebase. No persistent schema or retention contract changes are introduced; existing migrated-state and legacy-producer boundary evidence is retained. No code fixups or re-review request were needed for this landing.

Close executor admission and cancel owned commands when activation exceeds
its existing multi-step budget. Bound settlement, retain unconfirmed writer
leases, and report update-activation-timeout through status and Doctor.

Reuse the canonical Windows process creation-time budget without weakening
PID-reuse checks or changing Scheduled Task principals. Preserve native
cleanup ordering and legacy migrated-finalization contracts.

Related: #146860, #138560
@clawsweeper

clawsweeper Bot commented Sep 13, 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 commands Command implementations size: XL maintainer Maintainer-authored PR labels Sep 13, 2026
@steipete
steipete marked this pull request as ready for review September 13, 2026 12:30
@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 13, 2026
@clawsweeper

clawsweeper Bot commented Sep 13, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 13, 2026, 9:24 AM ET / 13:24 UTC (Revision 5).

ClawSweeper review

What this changes

Bounds update activation and cancellation settlement, adds timeout recovery guidance, and lets Windows process-identity checks use the shared reader’s longer allowance.

Merge readiness

⛔ Blocked before merge - 3 items remain

This PR remains useful and has no actionable correctness finding. The documented landing disposition addresses the previous availability and Windows proof concerns; those accepted limitations do not require another approval cycle.

Priority: P1
Reviewed head: 27bfeee0af2f078628cb7e7160db33e4a0248cec

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A coherent owner-level repair with meaningful boundary coverage and no actionable defect; accepted platform and availability limits remain explicit.
Proof confidence 🌊 off-meta tidepool Not applicable: The maintainer-authored PR is exempt from ordinary contributor proof. Reported real subprocess and legacy-worker checks support cancellation and ownership behavior; mocked Windows checks do not establish a native managed upgrade, whose coverage gap is explicitly accepted in the captured landing disposition.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The maintainer-authored PR is exempt from ordinary contributor proof. Reported real subprocess and legacy-worker checks support cancellation and ownership behavior; mocked Windows checks do not establish a native managed upgrade, whose coverage gap is explicitly accepted in the captured landing disposition.
Evidence reviewed 8 items Introduced scope and merge identity: The host pins the introduced delta to 2acbeee..27bfeee. Raw test-merge metadata confirms main followed by the exact PR head as parents; its result retains the activation addition. Base-only changes were excluded from attribution.
Deadline preserves the existing ownership boundary: Direct and delegated executors check activation expiry, close child admission on abort, and retain the existing settlement and lease-release checks. Expiry does not manufacture permission to release unsettled children.
Cancellation reaches the process owner: Command execution inherits scope cancellation through its termination controller. Windows taskkill helpers run outside the cancelled scope and remain joined before root cancellation; argv execution still disables shell interpretation.
Findings None None.
Security None None.

How this fits together

The update executor coordinates installation changes, Doctor, plugin finalization, and Gateway service operations. It holds installation ownership while child work runs and publishes the outcome through update history and status.

flowchart TD
  A[CLI or Doctor update] --> B[Validate candidate and ownership]
  B --> C[Activation deadline]
  C --> D[Owned installation and service work]
  C -->|Deadline expires| E[Cancel and join child work]
  D --> F[Publish update outcome]
  E --> F
  E --> G[Retain unsettled ownership]
Loading

Before merge

  • Resolve merge risk (P1) - Accepted availability tradeoff: expiry can interrupt slow activation after Gateway stop and leave the Gateway unavailable while unsettled ownership remains retained.
  • Resolve merge risk (P2) - Accepted coverage limitation: native Windows published-driver upgrade and timeout recovery remain unverified; candidate code cannot repair an installed driver’s earlier identity lookup.
  • Add data-model compatibility proof - Confirm migration or upgrade compatibility proof before merge.
Agent review details

Security

None.

PR surface

Source +292, Tests +447, Docs +10. Total +749 across 33 files.

View PR surface stats
Area Files Added Removed Net
Source 21 933 641 +292
Tests 10 461 14 +447
Docs 2 13 3 +10
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 33 1407 658 +749

Review metrics

Metric Value Why it matters
Production versus test growth Production net +292 lines; tests and test support net +447 lines Production growth is explained by deadline ownership, cancellation propagation, and terminal reporting; regression coverage targets those boundaries.
Activation allowance max(30 minutes, 6 × per-step timeout), plus the same settlement allowance This makes the new outer bound and its possible outage duration explicit.

Stored data model

Persistent data-model change detected: migration/backfill/repair: src/commands/doctor-update-run.ts, migration/backfill/repair: src/commands/doctor-update.ts, migration/backfill/repair: src/shared/update-outcome.ts, unknown-data-model-change: src/commands/doctor-update.ts. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Honor the recorded availability decision (recommended)
    Proceed under the documented acceptance that timeout may leave the Gateway stopped and that native Windows recovery coverage remains incomplete.

Technical review

Best possible solution:

Retain the bounded executor and PID-reuse checks under the recorded availability decision, while keeping the unresolved Windows query diagnosis with its existing issue.

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

Yes for the bounded source defects: main lacks the enclosing activation deadline and restricts lease identity reads to one second. The reporter’s exact Windows query failure remains unproven, and no runtime reproduction was executed in this review.

Is this the best way to solve the issue?

Yes for those defects: the patch extends existing executor, process, and timeout owners while preserving identity and settlement checks. It does not establish that all reported Windows handoff failures are fixed.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P1: The PR addresses prolonged update stalls and rejected Windows handoffs affecting active update workflows.
  • merge-risk: 🚨 availability: The new activation deadline can leave a stopped Gateway unavailable when cancellation or recovery cannot safely finish.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The maintainer-authored PR is exempt from ordinary contributor proof. Reported real subprocess and legacy-worker checks support cancellation and ownership behavior; mocked Windows checks do not establish a native managed upgrade, whose coverage gap is explicitly accepted in the captured landing disposition.

Evidence

What I checked:

  • Introduced scope and merge identity: The host pins the introduced delta to 2acbeee..27bfeee. Raw test-merge metadata confirms main followed by the exact PR head as parents; its result retains the activation addition. Base-only changes were excluded from attribution. (61621d1fda5a)
  • Deadline preserves the existing ownership boundary: Direct and delegated executors check activation expiry, close child admission on abort, and retain the existing settlement and lease-release checks. Expiry does not manufacture permission to release unsettled children. (src/cli/update-cli/update-command-executor.ts:487, 27bfeee0af2f)
  • Cancellation reaches the process owner: Command execution inherits scope cancellation through its termination controller. Windows taskkill helpers run outside the cancelled scope and remain joined before root cancellation; argv execution still disables shell interpretation. (src/process/exec-runner.ts:141, 27bfeee0af2f)
  • Windows identity repair remains necessary: Pinned main still passes 1000 ms to the shared process-start reader. The release file retrieved for v2026.9.4 also retains that override. The candidate removes it while preserving null refusal and identity comparison; the shared Windows reader supplies a ten-second envelope. (src/infra/update-managed-service-handoff-lease.ts:89, 0a7b7fecfd7f)
  • Focused behavior and revocation coverage: Inspected tests cover terminal timeout reporting with retained ownership, synchronous deadline expiry, slow and unavailable identity reads, real subprocess cancellation, sibling isolation, and Windows cleanup ordering. Existing delegated-Doctor coverage checks that a revoked requester leaves config bytes unchanged. Execution results are contributor-reported; this read-only review ran no tests. (src/cli/update-cli/update-command-activation.test.ts:27, 27bfeee0af2f)
  • Previous concern has an explicit disposition: The captured body at source revision 4d231981e575f4e26ae5315f7433a4c1baa87d80b092d995e33c7c3114d41e19 explicitly accepts the availability tradeoff and missing native Windows upgrade/recovery evidence. A REST read confirmed the same head and disposition. The previous completed review contains no findings or published rank-up moves. (27bfeee0af2f)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Jason (Json): Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (4 earlier review cycles)
  • reviewed 2026-09-13T12:37:25.997Z sha 9030b95 :: blocked before merge. :: none
  • reviewed 2026-09-13T12:46:02.409Z sha 9030b95 :: blocked before merge. :: none
  • reviewed 2026-09-13T12:59:52.727Z sha 27bfeee :: blocked before merge. :: none
  • reviewed 2026-09-13T13:17:21.247Z sha 27bfeee :: blocked before merge. :: none

Keep the live-descendant and retained-installation assertions, then reuse the existing race-safe cleanup helper and assert the process has exited. The command scope can already have stopped it before fixture cleanup.
@steipete steipete closed this Sep 13, 2026
@steipete steipete reopened this Sep 13, 2026
@steipete steipete closed this Sep 13, 2026
@steipete steipete reopened this Sep 13, 2026
@steipete
steipete merged commit ec1cf77 into main Sep 13, 2026
481 of 555 checks passed
@steipete
steipete deleted the steipete/upd-windows-handoff-start-identity branch September 13, 2026 13:36
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Sep 13, 2026
* commit '0ac8a700e43efceef73d92fe8e50b185819e38ad': (27 commits)
  test(acpx): prove targeted turn cancellation (#137049)
  fix(ci): honor realtime meeting live-test opt-in (#147044)
  improve: reduce heartbeat enrollment work for large fleets (#147055)
  fix(gateway): install despite stale Linux session bus addresses (#146569)
  chore(i18n): refresh native locales (#147025)
  fix: avoid Gateway reinstalls when macOS service inspection is inconclusive (#146880)
  fix(pairing): QR setup rejects trusted-proxy gateways without a shared secret (#147036)
  fix(update): bound activation and accept slow Windows identity reads (#147019)
  perf(accounts): avoid materializing avatars for owner checks (#147032)
  improve(status): report external and ArrayBuffer memory (#141902)
  fix(update): preserve linked plugins during post-core sync (#147009)
  fix(channels): keep replies working after hot config reloads (#147001)
  refactor(gateway): defer worker transcript runtime loading (#143495)
  improve: reduce GitHub OAuth maintenance work for large agent rosters (#147021)
  fix(test): avoid settings lock writer startup timeouts (#147029)
  fix(update): correct backup guidance and cover incident regressions (#147023)
  refactor(gateway): share connection lifecycle across transports (#145950)
  refactor(telegram): share HTML text escaping (#146936)
  perf(build): reduce disk use in UI performance checks (#146687)
  refactor(memory-wiki): share freshness result construction (#146935)
  ...

# Conflicts:
#	src/config/sessions/session-accessor.sqlite-reclamation-memory.test.ts
steipete added a commit that referenced this pull request Sep 13, 2026
…ed literals (#145219)

Derive update inspection, candidate startup, activation, and finalization allowances from measured SQLite state, observed startup, plugin count, and the caller's step budget. Forward the owning allowance through service commands, readiness, Doctor, and migrated finalization instead of imposing competing short cutoffs. Keep metadata and progress probes cancellable in child processes.

Preserve update-activation-timeout settlement, integrity checks, live authority, and unsettled-writer ownership. Expiry alone never authorizes rollback, restart, or lease release. Installer network operations share the documented allowance. No new configuration, dependencies, schema, retries, or persistent retention/recovery semantics.

The activation regression failed with the original resolver and passed with the repair; focused proof passed 102 tests in six files. Native POSIX FIFO cancellation and Chrome boundary proof are recorded in the PR. CI 34767727811 passed 129 jobs with 11 skips on a verified current-base merge checkout. The final refresh commit is tree-identical to the reviewed source.

The maintainer accepts longer recovery waits and the incomplete slow-state published-driver/native Windows recovery qualification. An already-installed driver retains its loaded timers; containing-release delivery and reporter recovery remain unverified.

Reported by @rlosito (#146637); the initiating timeout cause remains unproved. Related update-timeout reports are tracked in #145252.

Refs #144758 #144901 #144890 #143292 #146637 #145252. Preserves the activation boundary from #147019.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 14, 2026
…penclaw#147019)

Bound update activation with the executor's existing multi-step budget, cancel owned commands at expiry, and report update-activation-timeout with next steps in openclaw update status and Doctor. Preserve unsettled writer ownership; timeout alone never authorizes rollback, restart, or lease release and can leave the Gateway stopped.

Use the shared Windows process-start identity reader budget instead of the forced one-second override. Keep InteractiveToken support and PID-reuse checks. Native Windows published-driver upgrade/recovery proof remains a documented gap accepted for this landing; the reporter's identity-query trace remains outstanding.

Refs openclaw#146860. Refs openclaw#138560.
Reported by @rogerspires4452-dev (openclaw#146860).
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 14, 2026
…ed literals (openclaw#145219)

Derive update inspection, candidate startup, activation, and finalization allowances from measured SQLite state, observed startup, plugin count, and the caller's step budget. Forward the owning allowance through service commands, readiness, Doctor, and migrated finalization instead of imposing competing short cutoffs. Keep metadata and progress probes cancellable in child processes.

Preserve update-activation-timeout settlement, integrity checks, live authority, and unsettled-writer ownership. Expiry alone never authorizes rollback, restart, or lease release. Installer network operations share the documented allowance. No new configuration, dependencies, schema, retries, or persistent retention/recovery semantics.

The activation regression failed with the original resolver and passed with the repair; focused proof passed 102 tests in six files. Native POSIX FIFO cancellation and Chrome boundary proof are recorded in the PR. CI 34767727811 passed 129 jobs with 11 skips on a verified current-base merge checkout. The final refresh commit is tree-identical to the reviewed source.

The maintainer accepts longer recovery waits and the incomplete slow-state published-driver/native Windows recovery qualification. An already-installed driver retains its loaded timers; containing-release delivery and reporter recovery remain unverified.

Reported by @rlosito (openclaw#146637); the initiating timeout cause remains unproved. Related update-timeout reports are tracked in openclaw#145252.

Refs openclaw#144758 openclaw#144901 openclaw#144890 openclaw#143292 openclaw#146637 openclaw#145252. Preserves the activation boundary from openclaw#147019.
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 maintainer Maintainer-authored PR merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XL status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant