Repository navigation
fix(update): avoid decoder errors when releasing stale leases - #160288
Conversation
Compare the stored owner, payload bytes, and timestamp before decoding a lease generation. Preserve strict decoding for unchanged rows, database errors, and the transactional release recheck.
|
🦞👀 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: needs maintainer review before merge. Reviewed September 28, 2026, 7:25 AM ET / 11:25 UTC (Revision 4). ClawSweeper reviewWhat this changesThe branch makes managed-update lease release return a stale refusal when stored row identity has changed, and updates four custody test cases to expect that result. Regression provenancePossible regression — suspected (reviewed change). No predecessor PR is attributed. Merge readiness✅ Ready for maintainer review Keep open. Current main still throws when a stale lease points to an incompatible replacement row. The reported exact-head installed-updater run addresses the prior review’s proof request, and source review found no introduced correctness defect. Priority: P2 Review scores
Verification
How this fits togetherOpenClaw stores managed-update leases in SQLite while an updater or recovery worker controls an installation. Release compares a captured lease with the stored row before deciding whether to delete it. flowchart LR
A[Updater or recovery worker] --> B[Lease release request]
B --> C[Read stored lease]
C --> D{Same owner payload and time?}
D -- No --> E[Return stale refusal]
D -- Yes --> F[Decode and validate]
F --> G[Guarded row deletion]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +7, Tests -2. Total +5 across 2 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Release a captured lease only when its stored generation still matches, while incompatible current records remain visible to strict inspection and continue blocking source mutation. Do we have a high-confidence way to reproduce the issue? Yes, from source: on current main, replacing an acquired lease’s stored payload with an incompatible record reaches decoding before the stale-generation comparison. I did not execute the case in this read-only review. Is this the best way to solve the issue? Yes. The raw identity check refuses the stale caller before decoding, while matching rows retain strict validation and exact-row deletion. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against dd3fb2bd9cf2. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (3 earlier review cycles)
|
Integrate current main and restore the four stale-generation release assertions. The owning predicate compares the raw row before strict decoding in both preflight and transactional settlement, while source admission, row preservation, and paired release checks remain intact.
|
@clawsweeper re-review The required installed-updater proof is now complete for exact head The body now records that result and the separate CI failure. CI attempt 1 failed a requester-wake serial case; the complete 18-case file independently reproduces exactly that failure on the actual main parent |
|
🦞👀 Re-review progress:
|
|
Merged via explicitly authorized admin squash with attributed pre-existing CI failures.
|
Preserve #160288 when integrating main: a stale stored generation is rejected before its replacement payload is decoded, so release returns false. Keep the callback refusal and exact sidecar and database-row preservation assertions.
…aw#160288) Compare the stored owner, payload bytes, and timestamp before decoding a lease generation. Preserve strict decoding for unchanged rows, database errors, and the transactional release recheck.
#158916) * refactor(runtime): deslop tasks, daemon, node-host and tui second pass * test(update): mock canonical systemd activation admission Keep native-start and retained-restart fixtures on the lifecycle admission owner after consolidation. Preserve real executor revocation, native command ordering and every assertion. * test(runtime): track relocated decoder suppression * test(tui): synchronize terminal fixture readiness Inspect the current completed target screen instead of cumulative terminal output. Wait for startup readiness and command publication while isolating unrelated fd discovery in the exact-argument completion fixture. * test(tui): isolate fallback projection from vendor policy loading Use distinct synthetic provider/model identities while retaining foreign-run and malformed-event rejection, exact footer replacement, unchanged backend calls, and clean exit. Include captured terminal output when the exit assertion fails. * test(tui): group session mode proof with identity fixtures Move the self-contained mode-scoping case out of the general harness to retain the line cap. Preserve every assertion, the 20-second operation budget, the 25-second test budget, and owned fixture cleanup. * refactor(runtime): reuse projection and worker dispatch values Inline the one-use row identity before keyed refresh and integrate the deferred plugin-migration write-options cleanup from main (ad31034, #159426). Preserve worker admission, transaction ownership, options, and refresh order. Also use the synchronized current screen for the sibling stale-display-name assertion without changing its timeout or cleanup. * test(tui): fence reused-session fixture transitions * refactor(ui): colocate omitted media status rendering (#159938) * fix(tui): preserve CLI lifecycle context for terminal events Bind input and resize callbacks at terminal startup so later stdin events retain the existing CLI resource host and scheduler. Keep ingress authority and shutdown ownership unchanged. Add a focused callback-context regression; the real built CLI reproduces the original MCP scheduler error and passes with the adapter. * fix(ci): keep chat attachment controls within lint limit (#160159) Move the unchanged image data-URL decoder into the existing image helper to restore the 700-line lint limit. Validated on Blacksmith Testbox: 34 attachment tests, all core lint stripes, targeted changed checks, and the UI build. Independent review found no actionable issues. * test(daemon): assert incompatible custody release diagnostics Align the four retained historical custody cases with b107d4a. Release now validates the stored generation directly rather than using the mutation-authority predicate, allowing paired cancellation settlement without hiding incompatible-row diagnostics. Require the full incompatibility error while preserving service callback refusal and exact sidecar identity, bytes, and stored-row assertions. Production behavior is unchanged. Blacksmith Testbox tbx_01m3kf15jgcthvq4f69nxn8t28: pristine main ff8c752 fails 3/3 runs with the same four failures; the fix passes 24/24 tests in each of three runs through ci-run-node-test-shard with the daemon config, agentic-command-support shard, CI=1, and two workers. Three sibling files pass 32/32 tests. The single-worker pnpm test cost is 28.05s wall including cold compiler preparation. Targeted lint, formatting, and git diff --check pass. check-changed runs but stops at pre-existing services graph TS2459 errors: package-update-activation-journal.test.ts:7 and package-update-activation-lifetime.test.ts:11 import assertReliabilityForcedExit, made private by 9491d5a. A clean baseline checkout with independent dependencies reproduces both exact errors. No unrelated fix, local validation, autoreview, or push is included; review and publication remain with the lead. * fix(node-host): retain container timeout diagnostics Restore the configured deadline and safe engine operation when runExec reports a sanitized timeout. Keep arguments and executable paths out of the diagnostic, preserve the original cause, and leave deadlines, daemon pinning, and cleanup unchanged. Reproduced the container supervisor failure on main at 8b549de. The focused file now passes all 22 cases; the full supervisor, container, and process families pass 1193 tests with 49 skips across 110 files. Core typecheck, targeted lint/format, docs syntax, and independent P2 review pass. The new four-case deterministic file takes 1.82s Vitest wall; the existing integration file takes 41.03s, with no added processes or waits. * fix(scripts): export assertReliabilityForcedExit for package update tests #158491 imports it from two infra tests after #159362 made it module-local, so the core test-types infra stripe failed on main with TS2459. * fix(ci): keep test planning within its existing budgets Apply the canonical planner repairs from #160408, #160458, #160531, and #160517 to the runtime cleanup branch. Preserve complete source facts, canonical command ownership, and the existing PR-exempt test inventory. The merged cohort passed its old-reader regression control, owner suites, scoped changed checks, and 20 full original-group repetitions on two CPUs. * test(daemon): retain canonical stale-lease release expectation Preserve #160288 when integrating main: a stale stored generation is rejected before its replacement payload is decoded, so release returns false. Keep the callback refusal and exact sidecar and database-row preservation assertions. * fix(ci): adopt canonical Doctor repair lint fix Apply #160715 so the pinned runtime branch includes the canonical repair module split. Version and cohort planning use the existing targets owner; installation retirement and transaction ordering stay with repair. * ci: refresh runtime checks after canonical contract repairs Refresh the PR merge ref after main fixed the unused 1Password dependency in 4ed0cb3 and the retired runtime API inventory in 5b76930. The runtime source tree remains cd5b525, matching the reviewed and completed Testbox proof. * ci: refresh runtime validation after main CI fixes * ci: refresh runtime checks after duplicate route repair
openclaw#158916) * refactor(runtime): deslop tasks, daemon, node-host and tui second pass * test(update): mock canonical systemd activation admission Keep native-start and retained-restart fixtures on the lifecycle admission owner after consolidation. Preserve real executor revocation, native command ordering and every assertion. * test(runtime): track relocated decoder suppression * test(tui): synchronize terminal fixture readiness Inspect the current completed target screen instead of cumulative terminal output. Wait for startup readiness and command publication while isolating unrelated fd discovery in the exact-argument completion fixture. * test(tui): isolate fallback projection from vendor policy loading Use distinct synthetic provider/model identities while retaining foreign-run and malformed-event rejection, exact footer replacement, unchanged backend calls, and clean exit. Include captured terminal output when the exit assertion fails. * test(tui): group session mode proof with identity fixtures Move the self-contained mode-scoping case out of the general harness to retain the line cap. Preserve every assertion, the 20-second operation budget, the 25-second test budget, and owned fixture cleanup. * refactor(runtime): reuse projection and worker dispatch values Inline the one-use row identity before keyed refresh and integrate the deferred plugin-migration write-options cleanup from main (13f2174, openclaw#159426). Preserve worker admission, transaction ownership, options, and refresh order. Also use the synchronized current screen for the sibling stale-display-name assertion without changing its timeout or cleanup. * test(tui): fence reused-session fixture transitions * refactor(ui): colocate omitted media status rendering (openclaw#159938) * fix(tui): preserve CLI lifecycle context for terminal events Bind input and resize callbacks at terminal startup so later stdin events retain the existing CLI resource host and scheduler. Keep ingress authority and shutdown ownership unchanged. Add a focused callback-context regression; the real built CLI reproduces the original MCP scheduler error and passes with the adapter. * fix(ci): keep chat attachment controls within lint limit (openclaw#160159) Move the unchanged image data-URL decoder into the existing image helper to restore the 700-line lint limit. Validated on Blacksmith Testbox: 34 attachment tests, all core lint stripes, targeted changed checks, and the UI build. Independent review found no actionable issues. * test(daemon): assert incompatible custody release diagnostics Align the four retained historical custody cases with 82ab893. Release now validates the stored generation directly rather than using the mutation-authority predicate, allowing paired cancellation settlement without hiding incompatible-row diagnostics. Require the full incompatibility error while preserving service callback refusal and exact sidecar identity, bytes, and stored-row assertions. Production behavior is unchanged. Blacksmith Testbox tbx_01m3kf15jgcthvq4f69nxn8t28: pristine main 5f12b85 fails 3/3 runs with the same four failures; the fix passes 24/24 tests in each of three runs through ci-run-node-test-shard with the daemon config, agentic-command-support shard, CI=1, and two workers. Three sibling files pass 32/32 tests. The single-worker pnpm test cost is 28.05s wall including cold compiler preparation. Targeted lint, formatting, and git diff --check pass. check-changed runs but stops at pre-existing services graph TS2459 errors: package-update-activation-journal.test.ts:7 and package-update-activation-lifetime.test.ts:11 import assertReliabilityForcedExit, made private by 90bddde. A clean baseline checkout with independent dependencies reproduces both exact errors. No unrelated fix, local validation, autoreview, or push is included; review and publication remain with the lead. * fix(node-host): retain container timeout diagnostics Restore the configured deadline and safe engine operation when runExec reports a sanitized timeout. Keep arguments and executable paths out of the diagnostic, preserve the original cause, and leave deadlines, daemon pinning, and cleanup unchanged. Reproduced the container supervisor failure on main at 2d04b95. The focused file now passes all 22 cases; the full supervisor, container, and process families pass 1193 tests with 49 skips across 110 files. Core typecheck, targeted lint/format, docs syntax, and independent P2 review pass. The new four-case deterministic file takes 1.82s Vitest wall; the existing integration file takes 41.03s, with no added processes or waits. * fix(scripts): export assertReliabilityForcedExit for package update tests openclaw#158491 imports it from two infra tests after openclaw#159362 made it module-local, so the core test-types infra stripe failed on main with TS2459. * fix(ci): keep test planning within its existing budgets Apply the canonical planner repairs from openclaw#160408, openclaw#160458, openclaw#160531, and openclaw#160517 to the runtime cleanup branch. Preserve complete source facts, canonical command ownership, and the existing PR-exempt test inventory. The merged cohort passed its old-reader regression control, owner suites, scoped changed checks, and 20 full original-group repetitions on two CPUs. * test(daemon): retain canonical stale-lease release expectation Preserve openclaw#160288 when integrating main: a stale stored generation is rejected before its replacement payload is decoded, so release returns false. Keep the callback refusal and exact sidecar and database-row preservation assertions. * fix(ci): adopt canonical Doctor repair lint fix Apply openclaw#160715 so the pinned runtime branch includes the canonical repair module split. Version and cohort planning use the existing targets owner; installation retirement and transaction ordering stay with repair. * ci: refresh runtime checks after canonical contract repairs Refresh the PR merge ref after main fixed the unused 1Password dependency in 3b5b7e1 and the retired runtime API inventory in 1ed57fc. The runtime source tree remains cd5b525, matching the reviewed and completed Testbox proof. * ci: refresh runtime validation after main CI fixes * ci: refresh runtime checks after duplicate route repair
Related: #158491
What Problem This Solves
Releasing an old managed-update lease can throw a decoder error after its stored generation is replaced with an incompatible record, instead of reporting that the old lease no longer owns the row.
User Impact
Stale release attempts return false and preserve the replacement record and retained source locks. Current leases still require their existing validation and settlement checks. Schemas, stored bytes, permissions, and retention are unchanged.
Why This Change Was Made
The existing raw-row comparator now checks owner, payload bytes, and timestamp before decoding. Both the release preflight and its transactional recheck use this owner. Unchanged rows still undergo decoding and deep equality; database, schema, and physical identity failures still propagate.
Evidence
The original four historical-custody failures reproduced on the exact CI baseline. The initial candidate passed all 27 owner cases and the original 18-file CI group (880 passed, 29 skipped), using Linux/Node 24.19 and an independent frozen pnpm 12.5.1 installation. Source hashes were verified between phases. Core and all 25 test type graphs, lint, export checks, and selected guards passed.
The successor integrates main and restores the four return-false assertions changed in fa90c83. Stored-row identity mismatch is stale refusal; unchanged rows retain strict decoding. The production fix and restored tests received fresh independent P0–P2 review with no findings. The earlier runtime proof remains bound to its recorded source, not the full integrated tree.
Fresh receiving checks pass on the published successor: all four stale historical-custody refusals and three original-owner cancellation, physical-replacement, and paired-settlement cases. The official 2026.9.6 updater → freshly built candidate cell passes with legacy operator state and automatic authenticated restart. The maintained packer performed a full fresh build and tarball validation (779s); the installed upgrade lane passed in 604s, including backup/rollback and raw transcript restoration. Source and tarball hashes stayed unchanged. This proves the selected Linux scenario, not a full updater matrix.
Exact-head CI attempt 1 failed one requester-wake serial-continuation case with a worker timeout. An independent run of the entire 18-case file on its actual main parent (
fc168b2f6c16312181ce15bcb56d36a14e2c4849) reproduces the same failure: 17 passed, 1 failed. Build artifacts and security-fast passed; fail-fast cancelled 34 siblings. CI remains failed/cancelled, and cancelled coverage is not claimed as passing. The maintained native workflow qualified this pre-existing failure and merged the exact reviewed head with its failed/cancelled statuses retained. The final parent matched the admission record, and the landed tree was independently verified.