Skip to content

refactor(update): persist execution phases in the worker - #161385

Merged
steipete merged 3 commits into
mainfrom
codex/update-run-phase-worker-20260929
Sep 30, 2026
Merged

steipete merged 3 commits into
mainfrom
codex/update-run-phase-worker-20260929

Conversation

@steipete

@steipete steipete commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Mutable update phase tracking still performs SQLite writes on the CLI thread.

User Impact

Validation, activation, and inspected Git target tracking await worker-owned persistence. A replaced invocation is refused before starting the candidate capability probe. There are no schema, configuration, or CLI changes.

Why This Change Was Made

The three callers use the existing shared-state worker, synchronous phase kernel, and live executor/requester checks. The existing execution guard binds phase persistence to the original invocation; callers await that operation and recheck authority before continuing, so the Git helper cannot pair a run with a different write capture. Recovery policy stays inside the transaction; the synchronous ledger companion and terminal-row no-op behavior remain intact.

The conflict integration preserves main's configuration-refresh and rehearsal loop. Its existing validation helper consumes the captured original run, retains the native-probe authority checks, and replaces the superseded helper from the earlier candidate. Phase receipts and the consuming authority checks remain awaited before activation and Git inspection continue.

Other phase callers, generic progress, creation, diagnostics, final settlement, and native authority reads remain subsequent migration work.

Evidence

The final head (ddaaa4848cd3) passed Package Acceptance and the genuine published 2026.9.4 updater → exact candidate → authenticated earlier same-version f2fed5f693b5 installed flow. Both parent runs succeeded and finished. The candidate parent recorded exactly one completed validating and activating receipt, plus completed snapshot/startup/cleanup canary receipts. All 11,263 candidate and 11,265 target application files matched their package inventories; both explicitly installed services passed health and readiness checks. All 65 commands joined, and cleanup left no running processes.

All 231 cases across nine selected caller, ledger, Doctor, signal, and executor-settlement files passed with no skips. The full changed-source gate passed production and all 27 core-test type graphs, lint, line caps, dead exports, schema checks, and runtime import-cycle checks. Fresh independent source review found no actionable P0–P2 issue. Original controls reproduced the three host phase writes and probe-after-replacement defect before the repair.

Exact-head CI remains failed: an unchanged Codex successor fixture reused its predecessor thread ID during a required runtime rotation, and the unchanged fail-fast monitor received an Actions POST HTTP 500. Independent causal qualification and matching baseline/tested-merge inputs establish the fixture failure; canonical 52e60fb fixes it. These two originating failures also failed the aggregate CI gate. The monitor did not successfully cancel sibling jobs. The remaining jobs completed with 131 successes and 19 skips; no cancelled coverage is claimed. Landing uses the explicitly authorized, source-bound pre-existing-failure route, retaining security and review gates.

The runtime test command took 95.133 seconds using two parallel plans, each with maxWorkers=2; the changed-source gate took 1,790.974 seconds. The installed proof command took 509.727 seconds. These are whole-command measurements, not standalone file costs or performance claims. The maintainer timing disposition explains why no timing-only replay was added.

The installed proof uses manual stop, --no-restart, and explicit service installation. It does not establish automatic restart, rollback-to-running, Windows, populated-agent migration, live Git, or performance. CPU-degraded startup telemetry and a portal-sync timeout after the successful run are retained. Earlier artifact-delivery failures were caused by a private input parser accepting an incomplete signed redirect; that parser was causally repaired before this successful run, without product, credential, provider, or proxy changes. Historical earlier-head proof remains separate.

Related: #161104, #160592, #161461.

Await validation, activation, and inspected Git target receipts through the existing shared-state mutation owner. Preserve phase ordering, terminal-row no-ops, and the synchronous ledger companion.

Keep native receiver preparation with candidate validation and recheck the captured invocation before its probe after schema revalidation.

Validation: original-caller causal controls; 93 final caller cases with 263 applicable surrounding-contract cases; full changed-source gate, including all 27 core-test type graphs; independent review. Installed package qualification follows in the PR.

Related: #161104, #160592.
@steipete steipete self-assigned this Sep 29, 2026
@clawsweeper

clawsweeper Bot commented Sep 29, 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: L labels Sep 29, 2026
@steipete
steipete marked this pull request as ready for review September 29, 2026 20:59
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. 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 Sep 29, 2026
@clawsweeper

clawsweeper Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 30, 2026, 12:09 AM ET / 04:09 UTC (Revision 5).

ClawSweeper review

What this changes

The branch moves validation, activation, and inspected Git-target phase writes into OpenClaw’s shared SQLite worker while retaining the existing update-history rules.

Merge readiness

⛔ Blocked before merge - 3 items remain

Current main still writes these update phases on the CLI thread, so this PR remains useful. The final head still needs installed-update proof, and a test cost item from the prior review remains open.

Priority: P2
Reviewed head: ddaaa4848cd35079e2e6f3302f9ab7fc8a20438f

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The worker path and focused tests provide useful signal, but final-head installed behavior and required test cost evidence remain open.
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) 1 actionable review finding remain.

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 9 items Current-main gap: Current main still calls the synchronous ledger writer for validation and activation; its Git path also calls the synchronous inspected-target helper.
Introduced caller path: The proposed execution path awaits the validation and activation receipts and rechecks execution authority before continuing.
Worker and authority boundary: The new phase command uses the existing worker transaction. Its write admission checks captured caller authority at transaction entry and before commit.
Findings 1 actionable finding [P3] Report the expanded test file’s one-worker cost
Security None None.

How this fits together

The update command records its progress in a SQLite history row during package and Git updates. The worker writes each phase and returns a receipt before the command continues.

flowchart LR
A[Package or Git update] --> B[Execution authority check]
B --> C[Phase write request]
C --> D[Shared SQLite worker]
D --> E[Update history row]
D --> F[Phase receipt]
F --> G{Authority current?}
G -->|Yes| H[Continue update]
G -->|No| I[Stop update]
Loading

Before merge

  • Report the expanded test file’s one-worker cost (P3) - This registration adds phase cases to an existing per-PR test file. The PR reports only a parallel whole-command time, while repository policy requires the file’s one-worker wall time and available CI seconds. Please report those figures or cite an applicable maintainer exception; this item remains from the prior review.
  • Resolve merge risk (P1) - The final head changes execution-custody composition after the demonstrated installed two-hop run. Until a published updater installs this exact candidate and its phase receipts and service readiness are observed, upgrade compatibility remains unverified.
  • Complete next step (P2) - Record exact-head published-updater installed acceptance and the expanded test file’s one-worker cost, with CI seconds when available, before merge.

Findings

  • [P3] Report the expanded test file’s one-worker cost — src/cli/update-cli/update-command-execution-validation.test.ts:40
Agent review details

Security

None.

PR surface

Source +61, Tests +548, Docs +7. Total +616 across 16 files.

View PR surface stats
Area Files Added Removed Net
Source 11 209 148 +61
Tests 4 548 0 +548
Docs 1 7 0 +7
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 16 764 148 +616

Review metrics

Metric Value Why it matters
Production and test delta production +61 net lines, tests +548 net lines Production growth extends the existing worker owner; the expanded test surface makes its per-file cost relevant before merge.

Merge-risk options

Maintainer options:

  1. Qualify the final installed update (recommended)
    Run the published updater into the exact PR head and record phase receipts, final update state, and service readiness.

Technical review

Best possible solution:

Keep the phase transition in the shared worker kernel and qualify the final head with a published-updater installed run that observes the receipts and a healthy service.

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

Yes. Current-main source identifies the three synchronous phase calls, and the PR reports causal host-write controls for an earlier candidate; this read-only review did not execute them.

Is this the best way to solve the issue?

Yes. Reusing the shared-state worker and the existing phase kernel is a narrow ownership change; installed-update proof is still needed for the final composition.

Full review comments:

  • [P3] Report the expanded test file’s one-worker cost — src/cli/update-cli/update-command-execution-validation.test.ts:40
    This registration adds phase cases to an existing per-PR test file. The PR reports only a parallel whole-command time, while repository policy requires the file’s one-worker wall time and available CI seconds. Please report those figures or cite an applicable maintainer exception; this item remains from the prior review.
    Confidence: 0.94

Overall correctness: patch is correct
Overall confidence: 0.88

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against df2a29cac9ad.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: This bounded update reliability refactor addresses synchronous history writes without evidence of an urgent user-facing regression.
  • merge-risk: 🚨 compatibility: A changed updater must work when invoked by an already-installed release, and the final caller composition has not completed that installed acceptance cell.
  • 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:

Likely related people:

  • Peter Steinberger: Raw commit ce38326 adds src/infra/update-run-write.async.ts:19 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: ce3832611436; files: src/infra/update-run-write.async.ts)
  • Vincent Koc: 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.

  • Record the published-updater installed acceptance result for the exact final head.
  • Report the expanded test file’s one-worker wall time and available CI seconds, or cite an applicable exception.

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-29T21:06:07.313Z sha 5eb2c90 :: blocked before merge. :: none
  • reviewed 2026-09-29T22:16:56.043Z sha 5eb2c90 :: blocked before merge. :: [P3] Report the expanded suite's one-worker cost
  • reviewed 2026-09-30T00:07:04.073Z sha 5eb2c90 :: blocked before merge. :: [P3] Report the expanded suite's one-worker cost
  • reviewed 2026-09-30T02:41:30.390Z sha 7f81404 :: blocked before merge. :: [P3] Report the expanded suite’s one-worker cost

@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Sep 30, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

The installed-update proof requested in the review is complete for the unchanged reviewed head 5eb2c90bb46361a4189d8cc7d05894c54060c2ce. The authentic published 2026.9.4 updater installed the exact candidate package from successful Package Acceptance run 36630463530; the candidate then updated to a separately authenticated earlier build of the same 2026.9.6 version. Both parent update records finished successfully, validation/activation receipts and the three canary steps completed, and both explicitly installed services passed health/readiness checks. The complete installed file inventories matched their package identities. This was a manual-stop, --no-restart, explicit-install proof; it does not claim automatic restart, rollback-to-running, Windows, or performance coverage.

The retained affected-caller run passed 93 cases in 82.623 seconds with two workers, and the full changed gate passed in 2,264.539 seconds. These are command measurements, not standalone per-file timings or CI-seconds estimates. Additional replay solely to populate a timing inventory would not add correctness coverage; the actual scope, concurrency and timing limits remain explicit in the body.

CI attempt 2 remains failed: its originating Gateway private-completion cancellation race is being repaired separately in #161461. That repair has a causal original-owner failure and a passing real Gateway/SQLite regression; neither its proof nor this installed proof relabels cancelled CI jobs as passing.

@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Sep 30, 2026
Keep the original run and write capture together in the existing execution guard. Callers still await each receipt and recheck live authority before continuing. Preserve the unchanged worker transaction and synchronous ledger contract.
@steipete

Copy link
Copy Markdown
Contributor Author

Maintainer disposition for the P3 timing item: the retained command measurements are sufficient for this cut; a new serial replay solely to populate a timing inventory is not a correctness gate. The final source passed all 231 selected cases in 95.133 seconds using two parallel plans, each with maxWorkers=2, and the full changed-source gate passed in 1,790.974 seconds. The expanded validation file reported a 12.204-second span within that concurrent run. That span is not a standalone one-worker measurement, and no standalone CI-seconds estimate is claimed. The normal hook preserved the tested tree exactly.

The separate installed-compatibility requirement remains active. Exact-head Package Acceptance for ddaaa4848cd35079e2e6f3302f9ab7fc8a20438f uses run 36667221752; the earlier installed proof is not being relabeled as this head.

@steipete

Copy link
Copy Markdown
Contributor Author

Final-head installed acceptance is now complete for ddaaa4848cd35079e2e6f3302f9ab7fc8a20438f. The genuine published 2026.9.4 updater installed this exact candidate; the candidate then completed the second installed update to the retained earlier same-version build. Both parent rows finished successfully, validation/activation and canary receipts completed, package inventories matched, and both explicitly installed services returned healthy/ready. All 65 commands joined and cleanup left no processes. The PR body now records the artifact/run identities and claim limits.

This resolves the final-head compatibility proof gap in the current review. The P3 timing item is covered by the existing maintainer exception/disposition; whole-command times and concurrency remain explicit. The two independently attributed CI failures stay failed in native admission evidence, with no cancelled coverage relabeled as passing.

@steipete
steipete merged commit ea4aaef into main Sep 30, 2026
220 of 224 checks passed
@steipete
steipete deleted the codex/update-run-phase-worker-20260929 branch September 30, 2026 08:29
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via explicitly authorized admin squash with attributed pre-existing CI failures.

steipete added a commit that referenced this pull request Sep 30, 2026
* fix(update): settle service receipts and interrupted rollback

Await the existing bound worker phase receipt before native service stop,
then revalidate the original executor/requester. Retain already admitted
compensation through signal settlement, including its later phase writes,
without retaining the unbounded forward operation.

Keep current-core and rollback authority policies distinct. Preserve the
existing ledger kernel, records, schema and recovery semantics.

Related: #161385
Canonical stale-baseline context: #161766

Co-authored-by: Vincent Koc <[email protected]>

* fix(test): register post-update worker fixture once

Keep its existing worker registration instead of adding a duplicate that
prevents CI compact timing generation. Preserve the strict uniqueness
guard and the three newly required worker routes.

The actual CI merge failed manifest generation and its existing registry
regression; the baseline and one-entry correction passed the same selector.

* test(update): retain real owners in module failure fixtures

Load the mutable-signal and execution-guard owners in the existing VM
fixture so post-update failures reach their original backup-retention
assertions. Keep all19 inner cases and the synthetic service boundary.

The original three-file CI group failed on the unexpected dependency call;
the two real-module additions restore17 outer passes and19 inner passes.

---------

Co-authored-by: Vincent Koc <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 1, 2026
…1385)

* refactor(update): persist execution phases in the worker

Await validation, activation, and inspected Git target receipts through the existing shared-state mutation owner. Preserve phase ordering, terminal-row no-ops, and the synchronous ledger companion.

Keep native receiver preparation with candidate validation and recheck the captured invocation before its probe after schema revalidation.

Validation: original-caller causal controls; 93 final caller cases with 263 applicable surrounding-contract cases; full changed-source gate, including all 27 core-test type graphs; independent review. Installed package qualification follows in the PR.

Related: openclaw#161104, openclaw#160592.

* refactor(update): bind phase writes to execution custody

Keep the original run and write capture together in the existing execution guard. Callers still await each receipt and recheck live authority before continuing. Preserve the unchanged worker transaction and synchronous ledger contract.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 1, 2026
…aw#161851)

* fix(update): settle service receipts and interrupted rollback

Await the existing bound worker phase receipt before native service stop,
then revalidate the original executor/requester. Retain already admitted
compensation through signal settlement, including its later phase writes,
without retaining the unbounded forward operation.

Keep current-core and rollback authority policies distinct. Preserve the
existing ledger kernel, records, schema and recovery semantics.

Related: openclaw#161385
Canonical stale-baseline context: openclaw#161766

Co-authored-by: Vincent Koc <[email protected]>

* fix(test): register post-update worker fixture once

Keep its existing worker registration instead of adding a duplicate that
prevents CI compact timing generation. Preserve the strict uniqueness
guard and the three newly required worker routes.

The actual CI merge failed manifest generation and its existing registry
regression; the baseline and one-entry correction passed the same selector.

* test(update): retain real owners in module failure fixtures

Load the mutable-signal and execution-guard owners in the existing VM
fixture so post-update failures reach their original backup-retention
assertions. Keep all19 inner cases and the synthetic service boundary.

The original three-file CI group failed on the unexpected dependency call;
the two real-module additions restore17 outer passes and19 inner passes.

---------

Co-authored-by: Vincent Koc <[email protected]>
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 merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: L 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