Repository navigation
fix(update): derive update budgets from measured state instead of fixed literals - #145219
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: blocked before merge. Reviewed September 13, 2026, 12:37 PM ET / 16:37 UTC (Revision 47). ClawSweeper reviewWhat this changesThe branch derives update deadlines from measured state, forwards budgets through installers and recovery, and preserves Chrome tab access across delayed lifecycle events. Merge readiness⛔ Blocked before merge - 4 items remain This PR remains useful: current main retains timeout ceilings that the branch addresses. No actionable patch defect was found, and the recorded maintainer acceptance resolves the previous recovery-wait concern without another approval round. Priority: P1 Review scores
Verification
How this fits togetherOpenClaw’s updater stages and validates a candidate before replacing the installation and restarting the Gateway. Its operation budgets govern database inspection, package verification, service commands, and recovery. flowchart TD
A[CLI or automatic update] --> B[Measure state and startup]
B --> C[Resolve operation budgets]
C --> D[Validate candidate]
D --> E[Activate and restart]
E --> F{Completion or expiry}
F --> G[Record verified outcome]
F --> H[Cancel and retain unsettled ownership]
Before merge
Agent review detailsSecurityNone. PR surfacePR surface statistics unavailable: the file list is incomplete. Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Retain one measured-budget owner with live authority and writer-settlement checks, under the recorded acceptance of longer recovery waits and bounded upgrade qualification. Do we have a high-confidence way to reproduce the issue? Yes, from source: current main clamps package recovery scans independently of larger caller budgets. This review did not execute a reproduction; the field report’s initiating error remains separately unproved. Is this the best way to solve the issue? Yes. Reusing measured budget owners and forwarding their allowances is a coherent repair, while existing integrity checks, cancellation, and unsettled-writer custody remain enforced. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 05177019f408. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (46 earlier review cycles; latest 8 shown)
|
5c3c698 to
160b325
Compare
Dependency graph guard clearedThis PR no longer has blocked dependency graph changes. A future dependency graph change requires a fresh
|
openclaw update no longer fails with EADDRINUSE on the configured MCP Apps sandbox port while the live Gateway runs. The candidate canary keeps MCP Apps off and records its isolation facts, using the marker already supplied by published updaters. Normal Gateway listener settings remain intact. Published 2026.9.3 and 2026.9.4 drivers both pass the repaired canary; regression coverage proves failure before the fix and success afterward. The later package swap / rollback-verification timeout is owned by #145219. Fixes #145280. Thanks to @Carme99 for the report and listener/PID evidence.
openclaw update no longer fails with EADDRINUSE on the configured MCP Apps sandbox port while the live Gateway runs. The candidate canary keeps MCP Apps off and records its isolation facts, using the marker already supplied by published updaters. Normal Gateway listener settings remain intact. Published 2026.9.3 and 2026.9.4 drivers both pass the repaired canary; regression coverage proves failure before the fix and success afterward. The later package swap / rollback-verification timeout is owned by openclaw#145219. Fixes openclaw#145280. Thanks to @Carme99 for the report and listener/PID evidence.
b75da63 to
fe768d4
Compare
fe768d4 to
fa76218
Compare
Refs #144758 #144901 #144890 #143292 #146637 #145252. Reconciles the landed activation boundary from #147019.
What Problem This Solves
Fixes update steps that can expire before their owning operation's allowance on slow hardware or networks. A throttled run completed six large snapshots and then failed a native capability probe that still had a hidden 30-second limit.
User Impact
State copies, candidate startup, service work, and network operations receive their owning allowances. Expiry still cancels authority and preserves uncertain writer ownership. No new configuration, dependencies, schema, retry policy, or retention changes.
Why This Change Was Made
SQLite bytes, copy progress, observed startup, and plugin count determine budgets; callers forward the resolved allowances. Metadata/network operations share a 300-second default. Main's
update-activation-timeoutsettlement and status/Doctor guidance remain authoritative: expiry alone never authorizes rollback, restart, or lease release. The Gateway can remain stopped while ownership is unresolved.ClawSweeper review
Reviewed head:
e9fe0f4088204ac699be7c3157c12af4c301b112(tree-identical to the lead-reviewedcf061526ffff1fba3daa9204667d42be25f6a7bd). No concrete code findings remain. The maintainer accepts the disclosed longer recovery waits and incomplete slow-state published-driver/native Windows qualification for this landing; the optional Rank-up request is deferred, not claimed complete. Configuration, schema, and persistent recovery/retention semantics remain unchanged. Integrity checks, live authority, and unsettled-writer ownership remain enforced. No code fixup is needed.Reported by @rlosito (#146637); the initiating timeout cause remains unproved. Related update-timeout reports are tracked in #145252.
Evidence
Final landing validation
The only added commit after the scoped-clean review is the tree-identical CI refresh
e9fe0f4088204ac699be7c3157c12af4c301b112; its parent is the reviewedcf061526ffff1fba3daa9204667d42be25f6a7bd. The maintainer explicitly carried the review forward.Exact-head CI 34767727811 passed. The performance job's actual checkout was verified as merge
8d2ab4860a4f39d75dfe30060deb8eb77b07f673, with current-at-push mainca0746ad8c5631f2b1759fdf319eecb7c2b2d318as its first parent and the refreshed head as its second. Startup JavaScript measured 355,740 B against the 356,316 B limit. ClawSweeper Dispatch was cancelled during runner setup with no repository steps executed; its single rerun succeeded. The exact-head watcher finishedGREEN.A preceding close/reopen run had used an older merge snapshot and still failed the inherited performance limit; it was not used as passing evidence. No product code, assertions, baselines, or test timeouts changed during landing preparation. The published-driver and native Windows qualification limits below remain unchanged.
Round 4: activation and measured-budget reconciliation
Rebased from
f97a08d17e453348c2de1ab9d70effeb919ee38eonto mainbec7b26b8d4cf1a2d791afa0eb38837f07ab727c. The activation implementation, shared outcome, and Windows identity reader from #147019 are unchanged. A later main advance (#144558) moved the SQLite cleanup import; both owners and main's stronger cleanup assertion are retained. The refreshed cleanup, schema-budget, native-watchdog, and activation suites passed 36 tests / 35.102s.update-activation-timeoutreporting, recovery guidance, candidate executor authority, and forwarded probe/recovery budgets.The new regression exercises a real executor over a sparse 2 GiB state file and a 48-hour caller allowance. Before: activation failed with its former 1,800-second budget. After: both complete and release their leases. The existing timeout test still records
update-activation-timeoutand retains the unsettled lease. Windows continuation tests additionally assert the allowance reaches both the child timeout and worker input while retaining all autostart assertions.Head:
cf061526ffff1fba3daa9204667d42be25f6a7bd. Round-4 runtime including CI repair +133/-65, tests +96/-21, docs +6/-1. P1 review: scoped-clean, no actionable P0/P1 findings.pnpm check:changedand the requested clean-statenode scripts/check-changed.mjs: formatting, ratchets, every typecheck, dead-export scans, and core lint passed. Both stop at extension lint's known ancestor-install declaration-input boundary (clean fallback 674.36s). The CI runner's clean-checkout lint jobs passed on head69f2d5f8950.node scripts/run-vitest.mjs src/cli/update-cli/update-command-activation.test.ts -t 'keeps activation alive' node scripts/run-vitest.mjs src/cli/update-cli/update-command-activation.test.ts src/cli/update-cli/update-command-execution.test.ts src/cli/update-cli/update-command-migrated-windows.test.ts src/cli/update-cli/update-command-timeouts.test.ts src/commands/doctor-update.ledger.test.ts src/commands/doctor-update.test.ts node scripts/run-vitest.mjs src/cli/update-cli/update-command-activation.test.ts src/cli/update-cli/update-command-execution.test.ts src/cli/update-cli/update-command-executor.test.ts src/cli/update-cli/update-command-timeouts.test.ts src/cli/update-cli/update-recovery-guidance.test.ts src/cli/update-cli/status.test.ts src/commands/doctor-update.ledger.test.ts src/commands/doctor-update.candidate.test.ts src/commands/doctor-config-preflight.test.ts src/infra/update-managed-service-handoff-identity.test.ts src/infra/update-candidate-io.process.test.ts src/infra/update-candidate-io.test.ts src/infra/update-candidate-state.budget.test.ts src/infra/update-post-core-finalize.test.ts src/cli/update-cli/update-finalization-lifecycle.test.ts src/infra/update-candidate-canary.test.ts pnpm check:changed node scripts/check-changed.mjsCI integration repairs after reconciliation
CI 34762910861, head
69f2d5f8950, completed with 125 success, 11 skipped, 4 failure including the aggregate gate.checks-node-compact-small-3passed. A cancelled label job ran no repository steps and passed its single authorized rerun.checks-ui-e2e (7/7): selected-mode native Chrome navigation recurred in the browser path already changed by this branch. A delayed same-group event retired valid attachment authority after its root commit. Renewal now owns that decision; group changes still revoke unproven creation and cannot mint a blank-document exception. Regression: 1 failed / 5 passed before; all 162 tests across six owner suites passed after.pnpm test:e2e:browser-extensionpassed the native bootstrap flow, including selected creation/snapshot and revocation, 157.909s guarded. No assertion, mock, delay, or timeout was weakened.checks-node-compact-small-18: two update CLI fixtures advertised an empty shell script as the service Node. Real metadata sizing could not obtain its JSON result. The fixture now uses a distinct executable launcher (Windows: copied executable); service-node and prefix assertions remain unchanged. Before: 2 failed; targeted repair proof: 7 passed / 29.157s. Full CLI validation: 497 passed / 1029.697s guarded, with an isolated filesystem module cache.checks-node-compact-small-24:gateway-tls-pinning.test.tsencounteredEADDRINUSEat the first lazy MCP App sandbox bind. These sources are unchanged from main. feat(gateway): renew TLS certificates without restarting listeners #146267 added the sandbox check, while the fixture reserves only the Gateway port and derives the sandbox listener as the adjacent port. No matching main-run failure was confirmed; this unrelated test-port collision is recorded and its owner is unchanged.The browser and fixture repairs are committed separately (
eb5bae7d8cd,cf061526fff). Fresh P1 review of the browser and fixture corrections is scoped-clean. Exact-head CI 34765071944 is terminal: 127 success, 11 skipped, 2 failure. Both failures are the inheritedcontrol-ui-performancebudget and its aggregateopenclaw/ci-gate. The repaired native browser andcompact-small-18jobs passed.compact-small-24,compact-small-3, real-Gateway UI, Windows, and all lint jobs also passed.The PR performance job and current-main
90f67e1cf4b6job 103745293032 both report 355,733 B startup JavaScript gzip against the unchanged 355,719 B limit (14 B over), with eight requests and 1,153,709 raw bytes. The branch has no Control UI production changes. No baseline, assertion, ignore, or budget was weakened to address this inherited failure. The PR remains ready, mergeable, and unmerged for lead review. A focused changed-file check passed formatting, all typechecks, dead-export scans, and core test lint, then reached the same ancestor declaration boundary (340.733s).Prior branch proof and limitations
The isolated progress watchdog's native POSIX FIFO proof failed three cases before repair: outstanding native filesystem work prevented the updater from exiting. After repair, all three passed, including concurrent updater timer, cancellation/completion, natural exit, and probe extinction. Cleanup uncertainty remains a failure. Previous exact-head CI on
da10366c85ce1e03c5559475466e42ffed214804passed 129 jobs with 11 skipped (run 34757920474); it is historical evidence, not the current gate.#146637 is a qualified field case, not a claimed fix: 35,050 files / 446,928,701 bytes; a successful fingerprint scan took 23,793 ms. The initiating failure was truncated, so its timeout cause is unproved. Recovery fingerprint expiry is advisory; corruption still refuses recovery.
The historical throttled published-2026.9.3 → candidate and main → main 2 GiB hardware matrix remains incomplete. The installed released driver can fail its own timer before candidate code runs. Native Windows published-driver recovery and unkillable kernel IO are not proved. The maintainer has authorized landing round 4 with these qualification limits recorded.
The original 164-anchor inventory follows unchanged. The round-4 table above supersedes its activation/finalization dispositions where main added a bounded outcome.
Complete literal inventory and current dispositions
Source anchors below identify the original audit locations at
0a15c57cb611f6a4b653a4c1bb8fb356c5e12bfc; current pinned diff base isc86ba8d935cd74c93721db7819d2db54d2fdfb85, including #144901. The additional shared SQLite row uses the current committed-source anchors; all 164 original audit anchors remain below. Original values are retained for traceability. A = owner-derived/forwarded; B = abort/recovery consequence; C = warning/skip; D = watchdog. “Static risk” identifies an observed failure branch without a slow-hardware reproduction; “potential” means update reachability/consequence still needs proof. Changed callers can bypass a retained default without changing every other caller of that owner. Persistent lock/retention policies remain unchanged pending their owning design decision.Infrastructure (
src/infra/unless noted)sqlite-readonly-worker.ts:17,22,52,161,207;sqlite-integrity-worker.ts:58;update-candidate-io.ts:68package-update-integrity.ts:14,62update-candidate-rehearsal.ts:132,242,259update-candidate-rehearsal.ts:244update-candidate-canary.ts:114,116update-candidate-canary.ts:90,95update-candidate-canary.ts:399update-candidate-state.ts:315,316update-check-package-target.ts:152update-check-package-target.ts:104,176update-check.ts:155update-check.ts:255update-check.ts:294,314,686update-check.ts:314,686; importedgit-exec.ts:18update-check.ts:645npm-install-env.ts:141npm-install-env.ts:313,314,315npm-managed-root.ts:846npm-managed-root.ts:1040update-runner-command.ts:14;update-runner.ts:38;update-runner-install-surface.ts:111update-runner-git-cleanup.ts:7,33update-runner-git-cleanup.ts:11,17,18package-update-filesystem.ts:82,83update-runner-git-recovery.ts:8update-post-core-finalize.ts:48,202update-startup.ts:224,827update-startup.ts:580update-startup.ts:737update-startup.ts:1320update-repair-protocol.ts:6,7;update-repair-worker.ts:49,65,185;update-repair-agent.ts:133,178update-repair-worker.ts:115update-triage.ts:197update-failure-report-precreate.ts:31update-campaign.ts:10,11,12,13update-startup.ts:222,223,225,226update-failure-report-receipt-store.ts:33,34update-run-timeouts.ts:2,3update-run-legacy-expiry.ts:4update-candidate-canary.ts:417CLI, installers and package lifecycle
src/cli/update-cli/update-command.ts:87,106,179src/cli/update-cli/update-command-git.ts:62,461src/cli/update-cli/update-command-service-plan.ts:196min(caller ?? 10s, 10s); selected Node executable/SQLite capability probesrc/cli/update-cli/update-command-execution.ts:356min(updateStepTimeoutMs, 5min); candidate canary validationsrc/cli/update-cli/update-command-execution.ts:464src/cli/update-cli/update-command-verification.ts:145src/cli/update-cli/update-repair-command.ts:131min(caller ?? 3s, 3s); healthy stale-history fast pathsrc/cli/update-cli/update-command-service-command.ts:13,127gateway install --forcesrc/cli/update-cli/update-command-service-load.ts:34AbortSignal.timeout(60_000); deferred staged service install/seal/loadsrc/cli/update-cli/update-command-service-load.ts:53src/cli/update-cli/update-command-migrated.ts:155--checkstartup/delegation capability probesrc/cli/update-cli/update-command-migrated.ts:230max(30min, stepBudget * 6); whole migrated finalizer processsrc/cli/update-cli/update-command-migrated.ts:158,233src/cli/update-cli/update-finalization-lifecycle.ts:24src/cli/update-cli/update-finalization-lifecycle.ts:25src/cli/update-cli/update-finalization-lifecycle.ts:26src/cli/update-cli/update-finalization-lifecycle.ts:28src/cli/update-cli/update-finalization-lifecycle.ts:30src/cli/update-cli/update-finalization-lifecycle.ts:118src/cli/update-cli/update-command-finalize.ts:272min(1000ms, completionBudget/2)reserved shutdown marginsrc/cli/update-cli/shared.ts:446,454src/cli/update-cli/update-command-fresh-doctor.ts:40,266src/cli/update-cli/update-finalization-processes.ts:36src/cli/update-cli/update-command-post-core.ts:144src/cli/update-cli/update-command-post-core.ts:213src/cli/update-cli/update-command-post-core.ts:58,439src/cli/update-cli/status.ts:39src/cli/update-cli/wizard.ts:45src/cli/update-cli/restart-helper.ts:659/Endsrc/cli/update-cli/restart-helper.ts:667-690src/cli/update-cli/restart-helper.ts:693/Runsrc/cli/one-shot-exit.ts:154(imported by finalization)scripts/install.sh:156,163scripts/install.sh:169,172scripts/install-cli.sh:179scripts/install-cli.sh:184scripts/install.sh:157,164;scripts/install-cli.sh:180scripts/install.ps1:476scripts/install.ps1:485,891scripts/install.ps1:574,604,949scripts/install.sh:3173scripts/install.sh:3202scripts/preinstall-package-manager-warning.mjs:17,217Daemon, restart and Doctor
src/cli/daemon-cli/install-load.ts:33src/cli/daemon-cli/restart-health.constants.ts:1src/cli/daemon-cli/lifecycle.ts:80src/cli/daemon-cli/restart-health.ts:46,47src/cli/daemon-cli/restart-health-probe.ts:73,82/healthzand/readyzrequestsrc/cli/daemon-cli/restart-health-probe.ts:264src/cli/daemon-cli/lifecycle.ts:97src/cli/daemon-cli/lifecycle.ts:297,312src/cli/daemon-cli/lifecycle-safe-restart.ts:14src/cli/daemon-cli/lifecycle-safe-restart.ts:96src/daemon/launchd-plist.ts:258plutildecodesrc/daemon/launchd-runtime.ts:57src/daemon/launchd-lifecycle.ts:40launchctl printbefore stale-process cleanupsrc/daemon/launchd-plist.ts:17ExitTimeOutsrc/daemon/launchd-stop.ts:25src/daemon/launchd-runtime.ts:82src/daemon/launchd-runtime.ts:397,403src/daemon/launchd-restart-handoff.ts:32src/daemon/launchd-restart-handoff.ts:33src/daemon/schtasks-state-probe.ts:24src/daemon/schtasks-exec.ts:5,6schtaskssrc/daemon/schtasks-runtime.ts:48,109src/daemon/schtasks-control.ts:142src/daemon/schtasks-runtime.ts:339src/daemon/schtasks-process.ts:283src/daemon/schtasks-process.ts:326,337,346src/daemon/schtasks-process.ts:353;schtasks-control.ts:359,443src/daemon/schtasks-process.ts:381src/daemon/systemd-loaded-runtime.ts:33src/daemon/systemd-service-files.ts:35,98src/daemon/systemd-system.ts:116src/daemon/systemd-definition-mutation.ts:195src/daemon/systemd-definition-mutation.ts:385,387src/daemon/service-operation-lock.ts:63,64src/daemon/runtime-paths.ts:126src/daemon/service-audit.ts:74,188src/daemon/systemd-linger.ts:36src/daemon/systemd-linger.ts:61src/commands/doctor-update.ts:55src/commands/doctor-completion.ts:24,91src/commands/doctor-config-flow.ts:134,144src/commands/doctor-gateway-health.ts:114src/commands/doctor-gateway-health.ts:137src/commands/doctor-gateway-health.ts:180,181,187src/commands/doctor-gateway-health.ts:280src/commands/doctor-gateway-daemon-flow.ts:484,516src/commands/doctor-service-repair-policy.ts:9,45src/commands/doctor-gateway-services.ts:129,370,371src/commands/doctor-platform-notes.ts:21,113src/commands/doctor-project-clone-shape.ts:38src/commands/doctor-ui.ts:99src/commands/doctor-claude-cli.ts:32src/commands/doctor-whatsapp-responsiveness.ts:17,60src/commands/doctor-web-fetch-proxy.ts:12src/commands/doctor-device-pairing.ts:131src/commands/doctor-sandbox.ts:77src/commands/doctor-sandbox.ts:99,122src/commands/doctor-sandbox.ts:192src/commands/doctor-sandbox-legacy-registry.ts:194,195src/commands/doctor-sqlite-maintenance-lock.ts:14,192src/commands/doctor/cron/warnings.ts:20,241src/commands/doctor-host-desktop.ts:89src/daemon/launchd-foreign-jobs.ts:27,229,321,339src/daemon/launchd-foreign-jobs.ts:384,403,410Managed-service handoff (
src/infra/)update-managed-service-handoff.ts:57,:2193-2195,:1612-1616,:1178-118830_000reserve added torestartDrainTimeoutMs; capped at2_147_483_647update-managed-service-handoff.ts:58,:2088-209130_000update-managed-service-handoff.ts:231PRAGMA busy_timeout = 5000update-managed-service-handoff-database.ts:84busyTimeoutMs: 5000update-managed-service-handoff-database.ts:122setSqliteBusyTimeout(db, 5000)update-managed-service-handoff.ts:437min(recoveryTimeoutMs, 60_000)update-managed-service-handoff.ts:581(non-bootout branch),:5905000, further limited to remaining absolute deadline when suppliedupdate-managed-service-handoff.ts:581(bootout branch),:89730000update-managed-service-handoff.ts:972Date.now() + 30000update-managed-service-handoff.ts:1109PARENT_EXIT_SHUTDOWN_RESERVE_MS= 30supdate-managed-service-handoff.ts:113910_000update-managed-service-handoff.ts:1198timeout: 5000update-managed-service-handoff.ts:145930000update-managed-service-handoff.ts:1475-1478,:2256timeoutMs; default recovery budget30 * 60_000update-managed-service-handoff.ts:1564min(recoveryTimeoutMs, 60_000)update-managed-service-handoff-lease.ts:74,:1545000default control timeoutupdate-managed-service-handoff-lease.ts:901000(Windows only)update-managed-service-handoff-lease.ts:1255000, macOS1000update-managed-service-handoff-lease.ts:69130000Supplementary exclusions and traced boundaries
src/daemon/hosted-stop.ts:87,156;src/daemon/hosted-stop-executor.ts:121,146; callersrc/cli/gateway-cli/host-lifecycle.ts:92src/daemon/launchd-restart-handoff.ts:69src/daemon/launchd-exec.ts;src/daemon/systemd-exec.ts:279;src/cli/daemon-cli/start-health.ts:19;restart-health-external.ts;restart-lock-replacement.tssrc/cli/daemon-cli/status.gather.ts:388;register-service-commands.ts:74src/commands/doctor-config-preflight.ts:219;doctor-usage-cost-cache.ts:14src/daemon/schtasks-control.ts:438src/infra/update-managed-service-handoff.ts:2247;update-managed-service-handoff-cleanup.ts:35,44src/infra/update-managed-service-handoff.ts:1010,1025,1117,1129,1104,1190,1606,1744,1469,1913,2194src/cli/update-cli/restart-helper.ts:157,206,281;progress.ts;update-command-post-core.tsscripts/update-gateway.sh;scripts/postinstall-bundled-plugins.mjs