Skip to content

fix(update): settle candidate progress before cleanup - #161104

Merged
steipete merged 8 commits into
mainfrom
codex/update-canary-progress-worker-20260929
Sep 29, 2026
Merged

steipete merged 8 commits into
mainfrom
codex/update-canary-progress-worker-20260929

Conversation

@steipete

@steipete steipete commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Related: #160592

What Problem This Solves

Update candidate validation writes snapshot, startup, and cleanup progress synchronously on the updater’s event loop. Moving those receipts to a worker also requires the caller to retain accepted writes through interruption and uncertain I/O outcomes.

User Impact

Candidate progress uses the existing shared-state worker and synchronous ledger mutation. The updater awaits receipts with current database, executor, and requester authority. Unknown accepted-write outcomes retain rehearsal state and pending interruption history instead of falsely reporting safe cleanup. Stored formats, schemas, public SDK contracts, and configuration are unchanged.

Why This Change Was Made

The worker checks admission at transaction and commit, applies the existing recovery policy, and reuses the ledger’s step mutation. The execution guard supplies captured write options; the unused alternate capture path is removed. Snapshot, readiness-warning, and cleanup paths preserve uncertainty and original cancellation errors.

An actual installed update exposed a second necessary boundary: after replacing the package, the retained parent could no longer resolve a deferred-migration chunk. The existing execution preparation now asks each original deferred/lease importer to prime its own lazy imports before replacement. This prepares code only and adds no SQL or state cache.

The current-main composition preserves original-state capture, initialized executor custody, service-root selection and refusal handling. This is the first ordinary-write consumer cut; general progress, phase/terminal/finalization writes and native authority SQL remain subsequent migration work.

Evidence

Exact head 66b1246a passed Package Acceptance 36604490105 and a real Linux/systemd installed two-hop test: genuine published 2026.9.4 → 66b1246 → authenticated f2fed5f. The final target is a preceding same-version build, not a newer release.

Both updates exited 0 with succeeded/finished parent rows and no running update-history rows. The installed 66b1246a parent recorded completed, exit-zero snapshot, Gateway-startup and cleanup receipts. Post-plugin verification passed on both hops. Complete installed application inventories matched both authenticated archives, and the explicitly installed services answered health/readiness successfully. All 65 supervised commands joined with complete raw output; cleanup left no owned processes. The full private archive and four embedded package/archive hashes were independently verified before the lease was stopped.

The fixture explicitly stopped its named-profile service before each --no-restart update and explicitly installed/readied it afterward. This proves the selected compatibility and receipt path; it does not claim automatic restart, rollback-to-running, peer continuity, populated-agent migration, Windows, provider turns or steady-state performance. Startup CPU telemetry and Doctor advisory warnings are retained.

The final receiving composition passed 181 runtime cases, core/CLI test types and cycle checks. A two-line consolidation fixed its 702/700 line-count failure without changing the limit; exact-head type/lint checks then passed. Earlier registered-worker controls causally reproduce host writes, authority loss, interruption and unknown outcomes. Import preparation passed 108 owner cases and all 27 test type graphs; its explicit private binding passed the export guard and 25 direct-owner cases. Independent source, integration, cleanup and proof-packet reviews are clean through P2.

Exact-head CI 36604411432 remains failed/cancelled because one main-side frozen-admission fixture expected 76 Docker groups after main deliberately removed an aggregate, producing 75. The same case reproduces on the exact CI baseline; a one-token causal control identifies the cause. Canonical 7098bf6 fixes the fixture by checking the complete actual plan and reconstructed evaluations while preserving byte/digest/status/no-side-effect bounds. The separate 89 cancelled jobs remain incomplete coverage. Landing uses the explicitly authorized native pre-existing-failure path with source, run, job, cancellation and current security bindings; this is not a claim of green CI.

The preceding c7dd487b installed failure remains preserved: its return hop failed the missing-chunk import after all three canary receipts completed; package rollback succeeded, while recovery health verification found the service that the fixture had intentionally stopped. The exact current compiled flow now succeeds with the same target and assertions. No rollback-to-running result is inferred from either run.

Retained test timing

The earlier qualified 79-case canary command used --maxWorkers=1 and took 62.653 seconds including worker preparation; its reported 26.342-second file span is not a standalone measurement. The final narrow type/lint receiving command took 267.697 seconds. These are retained correctness runs, not timing-only reruns or performance claims. No timeout, concurrency cap, expected-failure allowance or assertion was weakened.

Record candidate snapshot, startup, and cleanup progress through the existing
shared-state worker and step mutation policy. Keep original source and executor
authority, drain accepted writes before interruption settlement, and retain
rehearsal state when a write outcome is unknown.

Preserve shipped synchronous ledger APIs and schemas. General command progress,
terminal writes, and native authority reads remain separate migration cuts.

Proven through real-worker canary and signal entry points, causal error-ordering
regressions, scoped type and lint checks, and independent review.
@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: XL labels Sep 29, 2026
@steipete
steipete marked this pull request as ready for review September 29, 2026 09:07
@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: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 29, 2026
@clawsweeper

clawsweeper Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 29, 2026, 1:32 PM ET / 17:32 UTC (Revision 8).

ClawSweeper review

What this changes

The branch moves update-candidate progress receipts to the shared SQLite worker, settles accepted writes before interruption cleanup, and prepares deferred migration imports before package replacement.

Merge readiness

⛔ Blocked before merge - 3 items remain

Current main still records candidate progress synchronously, so this PR remains useful. The source review found no discrete patch defect, but upgrade safety remains unproved for the current head after an earlier installed hop failed plugin verification and did not restore a healthy managed Gateway.

Priority: P2
Reviewed head: 66b1246ad7e4cf3dfe91e29dca34deac1fdc927c

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The worker cutover has focused authority and failure coverage, but the current installed-runtime repair remains unqualified after an observed earlier-hop failure.
Proof confidence 🦐 gold shrimp (3/6) Not applicable: The ordinary contributor proof gate does not apply to this member-authored PR. Real-worker tests cover the SQLite write and refusal boundary, and an earlier Linux/systemd installed two-hop run succeeded; the later import repair still lacks the published-driver compiled rerun required by update policy. No stored-data contract changes.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The ordinary contributor proof gate does not apply to this member-authored PR. Real-worker tests cover the SQLite write and refusal boundary, and an earlier Linux/systemd installed two-hop run succeeded; the later import repair still lacks the published-driver compiled rerun required by update policy. No stored-data contract changes.
Evidence reviewed 10 items Current main still uses a synchronous receipt: The candidate progress callback calls the synchronous ledger writer on the updater thread.
Worker admission and mutation: The introduced worker operation checks admission at transaction and commit, checks recovery in the transaction, and reuses the ledger's step mutation.
Live write custody: The execution guard captures the current executor and handoff state for candidate writes; the worker writer carries that check through dispatch.
Findings None None.
Security None None.

How this fits together

The update CLI checks a candidate package using a state snapshot and temporary Gateway. It records the results in SQLite update history, which also informs interruption and cleanup handling.

flowchart LR
A[Installed updater] --> B[Candidate validation]
B --> C[Snapshot and Gateway checks]
C --> D[Shared state worker]
D --> E[SQLite update history]
B --> F[Interruption cleanup]
E --> F
Loading

Before merge

  • Resolve merge risk (P1) - The current head has no successful compiled installed-update result for its import-preparation repair; an earlier head failed plugin verification after package replacement.
  • Resolve merge risk (P1) - The failed installed hop's recovery verification did not find a running managed Gateway, so service availability after rollback is unproved for the current head.
  • Complete next step (P2) - Complete a current-head compiled published-driver-to-candidate and authenticated return-hop update, verifying plugin checks, progress receipts, and managed-service health after success and rollback.
Agent review details

Security

None.

PR surface

Source +523, Tests +984, Docs +15. Total +1522 across 31 files.

View PR surface stats
Area Files Added Removed Net
Source 23 698 175 +523
Tests 7 1061 77 +984
Docs 1 15 0 +15
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 31 1774 252 +1522

Review metrics

Metric Value Why it matters
Production and regression-test growth production +523 net lines; tests +984 net lines The production growth serves worker admission and settlement; the added tests exercise write outcomes and interruption at the worker boundary.

Merge-risk options

Maintainer options:

  1. Qualify the compiled update (recommended)
    Run the current-head published-driver-to-candidate and authenticated return-hop checks, including plugin verification and managed-service health after success and rollback.

Technical review

Best possible solution:

Keep candidate receipts with the existing SQLite worker and ledger mutation while retaining live database and executor custody; leave uncertain outcomes pending for recovery.

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

Yes, at source level: current main calls the synchronous ledger writer from candidate progress. This read-only review did not run an update.

Is this the best way to solve the issue?

Yes in design: the branch uses the existing worker and ledger mutation instead of adding another write owner. Installed-package compatibility remains to be verified.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

No label changes.

Label justifications:

  • P2: This is a bounded update-responsiveness and recovery improvement without an established current emergency.
  • merge-risk: 🚨 compatibility: An installed update crosses package generations, and the preceding head failed plugin verification when it loaded a replaced chunk.
  • merge-risk: 🚨 availability: The failed installed hop's recovery verification did not find a running managed Gateway.
  • 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: The ordinary contributor proof gate does not apply to this member-authored PR. Real-worker tests cover the SQLite write and refusal boundary, and an earlier Linux/systemd installed two-hop run succeeded; the later import repair still lacks the published-driver compiled rerun required by update policy. No stored-data contract changes.

Evidence

What I checked:

Likely related people:

  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; confidence: low)

Rank-up moves

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

  • Record a current-head compiled installed update that verifies plugin checks and managed-service health after success and rollback.

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 (7 earlier review cycles)
  • reviewed 2026-09-29T09:17:20.249Z sha f2fed5f :: blocked before merge. :: [P1] Require the execution guard for candidate progress writes | [P3] Report the added suite's measured test cost
  • reviewed 2026-09-29T10:15:21.958Z sha 1f97a21 :: blocked before merge. :: none
  • reviewed 2026-09-29T13:29:25.091Z sha 1f97a21 :: blocked before merge. :: none
  • reviewed 2026-09-29T14:04:57.397Z sha c7dd487 :: blocked before merge. :: none
  • reviewed 2026-09-29T15:33:37.142Z sha c7dd487 :: blocked before merge. :: none
  • reviewed 2026-09-29T16:28:29.009Z sha 6c4e545 :: blocked before merge. :: none
  • reviewed 2026-09-29T16:54:39.868Z sha ce362c7 :: blocked before merge. :: none

Both candidate-validation callers already pass the execution guard capture.
Require that private contract and remove the unused alternate capture helper
so progress writes have one source for live authority and recovery policy.
@clawsweeper clawsweeper Bot added 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. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 29, 2026
@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label Sep 29, 2026
@clawsweeper clawsweeper Bot added merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. 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 29, 2026
@clawsweeper clawsweeper Bot removed the proof: sufficient ClawSweeper judged the real behavior proof convincing. label Sep 29, 2026
@openclaw-barnacle openclaw-barnacle Bot reopened this Sep 29, 2026
@steipete
steipete merged commit ce38326 into main Sep 29, 2026
138 of 230 checks passed
@steipete
steipete deleted the codex/update-canary-progress-worker-20260929 branch September 29, 2026 18:52
@steipete

Copy link
Copy Markdown
Contributor Author

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

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 30, 2026
* fix(update): settle candidate progress before cleanup

Record candidate snapshot, startup, and cleanup progress through the existing
shared-state worker and step mutation policy. Keep original source and executor
authority, drain accepted writes before interruption settlement, and retain
rehearsal state when a write outcome is unknown.

Preserve shipped synchronous ledger APIs and schemas. General command progress,
terminal writes, and native authority reads remain separate migration cuts.

Proven through real-worker canary and signal entry points, causal error-ordering
regressions, scoped type and lint checks, and independent review.

* refactor(update): require captured candidate write authority

Both candidate-validation callers already pass the execution guard capture.
Require that private contract and remove the unused alternate capture helper
so progress writes have one source for live authority and recovery policy.

* fix(update): prepare deferred migration imports before replacement

* refactor(update): make deferred runtime preparation binding explicit

* refactor(update): reuse common finalization options
steipete added a commit that referenced this pull request Sep 30, 2026
* 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: #161104, #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
…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.
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: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. 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: 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