Skip to content

fix(update): keep progress display from blocking package preparation - #162345

Merged
steipete merged 1 commit into
mainfrom
upd/upd-updater-subprocess-contract
Oct 1, 2026
Merged

steipete merged 1 commit into
mainfrom
upd/upd-updater-subprocess-contract

Conversation

@steipete

@steipete steipete commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

Closes #161867
Refs #161866

What Problem This Solves

Fixes stalls during package preparation while openclaw update displays progress.

User Impact

Progress follows committed phase changes without synchronously copying shared state every 250 ms. Disabled progress performs no reads. Phase rendering and the final authoritative report are preserved.

This improves updates launched by the fixed updater; a candidate cannot retrofit the progress reader already running in a published older driver. There are no schema, configuration, package dependency, or CLI option changes.

Why This Change Was Made

The 250 ms progress poll used an artifact-preserving reader that copied the full SQLite database synchronously. The active updater already writes its ledger, so its display now uses the existing state owner's reusable read-only worker connection, with the same admission and identity checks. Other history readers retain their artifact-preserving snapshot contract. Progress allows one asynchronous read at a time and cancels pending observations across activation, suspension, disposal, and final reporting.

This is the part B only path. The read-only owner review found #161920 correct for the pnpm terminal defect; this PR does not duplicate or supersede it. Thanks @alkor2000 for the pnpm terminal diagnosis and repair. The contributor's exact published-driver/pnpm proof and landing gates remain with that PR.

Evidence

  • Linux Testbox: original progress code fails the new regression with expected 6 to be less than or equal to 1 after the initial read and five ticks. The candidate passes while observing a later committed phase; disabled progress launches no reads.

  • The two progress files passed all 27 tests in three runs. The real-state regression took 366 ms of test time; the first combined run took 25.62 s, dominated by shared compiler preparation. Subsequent combined runs took 2.82 s and 2.98 s.

  • Focused ledger, error-mapping, and worker-lifecycle suites passed. The importer run exposed synchronous fixture teardown racing a pending progress borrower; switching the fixture to the canonical awaited database close made its 42 tests and the original CLI group pass.

  • The required slow-test audit found 156.378 s in the existing release-only foreground handoff file. Reusing the existing compiled fixture entrypoints reduced the same 21 cases to 67.108 / 67.199 / 67.253 s in three runs. The longest case was 13.302 s. All process, IPC, ownership, and lease assertions remain; the real 10-second notice timeout remains covered.

  • Fresh Codex P1 review: scoped-clean, no accepted/actionable findings. The selected importer runs passed, including the final seven files (53 tests). A clean candidate replay also passed all 69 tests in the three progress/command files in 34.05 s.

  • Final node scripts/check-changed.mjs --base 42e3cffdae5d3f6e25205c673e0ab9012b1ce14a exited 0 on Linux Testbox tbx_01m3tp1cwsc1x65xn26nemyhb6, after fetching the exact pushed commit and installing with pnpm install --frozen-lockfile. All 27 test-type graphs passed (1,017 s total); lint reported 0 warnings and 0 errors; all remaining guards and dead-export scans passed.

The performance fixture retains real parent/helper/updater processes because their PID identity, lease custody, port closure, and cancellation are the tested contracts. Shared compiler/build preparation is reported separately from test time.

Production: +94 / −30 lines (net +64); tests and test support: +149 / −56; docs: +4 / −1. The production growth supplies asynchronous read cancellation, observation ordering, and a narrow live-read mode at the existing database owner; it removes the synchronous progress polling path.

The two pre-existing paired-node E2E suites passed but remain slow: lifecycle 187.170 s and upgrade 113.115 s of test time. These are the existing L1347 follow-up; the campaign lead explicitly waived them as a blocker for this PR. They exercise repeated worker installation, serialized turns, and restart/recovery contracts. Their separate runtime build took 10m 21.5s.

The plugin authority fixture permission failure was resolved by incorporating its existing main owner fix, 42e3cffdae5d3f6e25205c673e0ab9012b1ce14a. The earlier dirty-source QA bootstrap failure disappeared with the verified clean candidate and matching build; no publication guard was weakened.

Observe active update progress through the existing live read worker instead of repeatedly taking synchronous full-state snapshots. Cancel pending reads across activation and final reporting while preserving artifact-safe history reads.

Keep disabled progress read-free, await asynchronous fixture cleanup, and reuse compiled entrypoints in the existing foreground handoff proof.

Closes #161867
@clawsweeper

clawsweeper Bot commented Oct 1, 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 size: M labels Oct 1, 2026
@steipete
steipete marked this pull request as ready for review October 1, 2026 03:30
@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: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 1, 2026
@clawsweeper

clawsweeper Bot commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge. Reviewed September 30, 2026, 11:36 PM ET / October 1, 2026, 03:36 UTC.

ClawSweeper review

What this changes

The branch makes update progress read committed SQLite records asynchronously, cancels pending observations during lifecycle transitions, and reduces foreground-handoff test preparation overhead.

Merge readiness

⛔ Needs changes before merge - 1 item remains

This remains a useful repair: current main and the latest release still use synchronous progress reads. No introduced correctness or security defect was found, but the repository-required published-driver × candidate update evidence remains incomplete.

Priority: P1
Reviewed head: a54612bd646e91fb9a822f83d8a220a986a36649

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The focused implementation and meaningful regression coverage are solid, but the required production update evidence is incomplete.
Proof confidence 🦐 gold shrimp (3/6) Not applicable: Real behavior proof is not required for maintainer- or bot-authored pull requests.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: Real behavior proof is not required for maintainer- or bot-authored pull requests.
Evidence reviewed 10 items Introduced patch identity: Reviewed the pinned merge-base-to-head patch. Its production changes concern progress observation and the existing state-read owner; dependency, schema, configuration, and CLI-option changes are absent.
Still necessary on current main: Fetched main still calls the synchronous display reader at initialization, during polling, and from callbacks and disposal. It does not contain the branch’s asynchronous progress reader.
Latest release retains the affected path: The v2026.9.7 progress implementation also uses synchronous ledger polling; this repair is not present in the supplied latest release.
Findings None None.
Security None None.

How this fits together

The updater records its phases in OpenClaw’s shared state database. The CLI progress observer reads those records to display progress, while a separate report owner produces the final authoritative outcome.

flowchart TD
  A[Update command] --> B[Committed update ledger]
  B --> C[Read-only database worker]
  C --> D[Progress observer]
  E[Activation or final reporting] --> F[Cancel pending observation]
  F --> D
  D --> G[Terminal phase display]
  B --> H[Final update report]
Loading

Before merge

  • Complete next step (P2) - Provide the repository-required published-driver × candidate update evidence covering the changed progress observer before merge.
Agent review details

Security

None.

PR surface

Source +64, Tests +93, Docs +3. Total +160 across 10 files.

View PR surface stats
Area Files Added Removed Net
Source 4 94 30 +64
Tests 5 149 56 +93
Docs 1 4 1 +3
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 10 247 87 +160

Review metrics

Metric Value Why it matters
Production and test growth production net +64 lines; tests and test support net +93 lines The body justifies production growth with cancellation, observation ordering, and reuse of the existing database owner.
Foreground-handoff test cost reported 156.378 s → 67.108–67.253 s Compiled fixture reuse reduces preparation overhead while retaining the existing process and lease assertions.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #161867
Summary: This PR directly addresses the canonical progress-polling report; pnpm terminal handling is separate work.

Members:

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

Technical review

Best possible solution:

Keep progress observation within the existing asynchronous state-reader owner, with bounded polling and reliable retirement across package activation.

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

Yes, source establishes the synchronous polling-to-snapshot path, and the reporter supplies bounded installed-release measurements. This read-only review did not execute the reproduction.

Is this the best way to solve the issue?

Yes, reusing the existing worker reader is a focused repair that preserves snapshot-based history and final reporting; production update evidence must still cover the lifecycle boundary.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P1: The reported production update workflow repeatedly blocks its event loop on database copies and incurs substantial avoidable delay.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: Real behavior proof is not required for maintainer- or bot-authored pull requests.

Label justifications:

  • P1: The reported production update workflow repeatedly blocks its event loop on database copies and incurs substantial avoidable delay.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: Real behavior proof is not required for maintainer- or bot-authored pull requests.

Evidence

What I checked:

  • Introduced patch identity: Reviewed the pinned merge-base-to-head patch. Its production changes concern progress observation and the existing state-read owner; dependency, schema, configuration, and CLI-option changes are absent. (src/cli/update-cli/progress.ts:145, a54612bd646e)
  • Still necessary on current main: Fetched main still calls the synchronous display reader at initialization, during polling, and from callbacks and disposal. It does not contain the branch’s asynchronous progress reader. (src/cli/update-cli/progress.ts:139, b4836fcbb487)
  • Latest release retains the affected path: The v2026.9.7 progress implementation also uses synchronous ledger polling; this repair is not present in the supplied latest release. (src/cli/update-cli/progress.ts:139, c074824a27c9)
  • Reader ownership and admission: The live observation mode exits inherited snapshot selection but continues through the existing retained read operation. That operation checks admission, database identity, cancellation, queued dispatch authority, and result acceptance; canonical database closure owns worker retirement. Historical readers retain artifact preservation. (src/state/openclaw-state-db-readonly.ts:406, a54612bd646e)
  • Meaningful regression coverage: The new regression exercises the production progress observer with real SQLite state, counts snapshot preparations across five ticks, observes a subsequent committed phase, and verifies disabled progress performs no reads. The captured PR body reports baseline failure and candidate success on Linux Testbox; this reviewer did not execute tests. (src/cli/update-cli/progress.observation.test.ts:21, a54612bd646e)
  • Scoped update-proof requirement: Root policy requires a published-driver × candidate cell for update changes. The captured body supplies regression, lifecycle, and check results, but no such cell exercising this progress-enabled repair. The foreground-handoff fixture uses a synthetic updater command with JSON output and does not exercise the changed progress observer. (AGENTS.md, a54612bd646e)

Likely related people:

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

Rank-up moves

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

  • Add the required published-driver × candidate update evidence, including progress-enabled observation and retirement around activation; redact private details. Update the PR body for automatic re-review, or ask a maintainer to comment @clawsweeper re-review.

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.

@steipete
steipete merged commit 6e6458a into main Oct 1, 2026
256 of 317 checks passed
@steipete

steipete commented Oct 1, 2026

Copy link
Copy Markdown
Contributor Author

Landed via the admin exception for an inherited failure (squash 6e6458a98ff3894117b0449a64b6dbfd1ca348d1, head a54612bd646e). Only red: checks-windows-node-test-3 → src/infra/package-update-swap.windows.test.ts, the main red from #162231 fixed by #162352 (d7b029347fd0) after this run; this PR touches no package-update swap files. Lead review scoped-clean (0.86); no CI re-spent.

@steipete
steipete deleted the upd/upd-updater-subprocess-contract branch October 1, 2026 05:34
steipete added a commit that referenced this pull request Oct 1, 2026
Live update progress can leave committed data in an orphan WAL. Windows
rollback closes its native exclusion probe before replacing files, which
checkpoints that WAL and makes the saved physical write generation look
changed. The updater then refuses recovery and leaves the failed candidate
package installed.

Run the same Windows exclusion probe before eligible snapshot capture,
under the existing maintenance owner. Keep snapshot-only manual recovery
when another SQLite connection prevents exclusion, and preserve strict
fingerprint, ownership, and cleanup checks. The existing Windows lifecycle
regression and all its restoration/autostart assertions remain unchanged.

Regressed by 6e6458a (#162345), confirmed
by reverting only its progress.ts changes. This repair belongs to the
installed updater; a candidate cannot repair an already-running driver.

Validation: 252 selected lifecycle, rollback, progress, and direct-caller
tests passed. The known admission-ledger "Phase: verifying" failure
remains unchanged and is owned by #162495. Core types, all 27 core test
type graphs, changed-file checks, formatting, diff checks, and managed
Codex review through P2 passed.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 2, 2026
…oll (openclaw#162345)

The CLI update progress display polled getUpdateRun every 250 ms and, on the shared-state path, each synchronous read staged a full SQLite snapshot in a worker and blocked the updater's event loop. Progress now uses one reusable live read per session (at most one snapshot launch across all polls, none when the display is disabled) with cancellation fenced during suspension and disposal; phase rendering is unchanged. A foreground-handoff wait in the same owner dropped from 156 s to about 67 s. The pnpm stdin contract (openclaw#161866) is covered separately by openclaw#161920.

Closes openclaw#161867
Refs openclaw#161866
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 2, 2026
Live update progress can leave committed data in an orphan WAL. Windows
rollback closes its native exclusion probe before replacing files, which
checkpoints that WAL and makes the saved physical write generation look
changed. The updater then refuses recovery and leaves the failed candidate
package installed.

Run the same Windows exclusion probe before eligible snapshot capture,
under the existing maintenance owner. Keep snapshot-only manual recovery
when another SQLite connection prevents exclusion, and preserve strict
fingerprint, ownership, and cleanup checks. The existing Windows lifecycle
regression and all its restoration/autostart assertions remain unchanged.

Regressed by 9989f92 (openclaw#162345), confirmed
by reverting only its progress.ts changes. This repair belongs to the
installed updater; a candidate cannot repair an already-running driver.

Validation: 252 selected lifecycle, rollback, progress, and direct-caller
tests passed. The known admission-ledger "Phase: verifying" failure
remains unchanged and is owned by openclaw#162495. Core types, all 27 core test
type graphs, changed-file checks, formatting, diff checks, and managed
Codex review through P2 passed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI command changes 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. size: M 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.

[Bug]: update progress polling repeatedly creates synchronous full SQLite snapshots and blocks preparation

1 participant