Skip to content

fix(update): retain immutable release provenance for inspection - #168403

Merged
steipete merged 2 commits into
mainfrom
steipete/perf-micro-update-slice9-release-gc-20260919
Oct 10, 2026
Merged

steipete merged 2 commits into
mainfrom
steipete/perf-micro-update-slice9-release-gc-20260919

Conversation

@steipete

@steipete steipete commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Immutable preparation replaces its single prepared-generation receipt, losing historical ownership evidence even though the old release directory remains. Cleanup cannot safely infer ownership from a release name or absence from current references.

User Impact

This adds the approved inspect-only foundation, with no change to existing installations. The optional version-3 descriptor records a three-generation policy and exact SHA/identity pins; its normalized inventory preserves native publication and acceptance evidence. No release, backup, recovery runtime, or snapshot is deleted, and earlier directories are not implicitly backfilled.

Real adoption stays gated. This package deliberately does not advertise openclaw.immutableInstallDescriptorVersion: 3; the combined descriptor readers and runtime contracts must qualify a bridge before a later change publishes that marker. The future adopt-immutable --inspect-release-retention entrypoint refuses before executor metadata is created when the physically installed bridge is unsupported. Ordinary v1/v2 updates remain unchanged.

Why This Change Was Made

The existing immutable control store remains the owner. Its immutable_release_generations table records SHA, contained path, directory identity, build digest, publication revision, and acceptance revision. Publication and acceptance update the table in the same transaction and revision check as their existing receipts. Moving current/prepared/previous references preserves inventory; failed receipt writes roll back inventory writes. Legacy acceptance never creates a missing inventory row.

The stored shape is maintainer-approved (2026-10-10) and documented in the database layout reference. The guarded bridge path upgrades the separately installed launcher only from known v1/v2 bytes before a v3 write. Pending recovery blocks adoption, and subsequent v3 updates reject unsupported candidate/recovery readers before drain. Build isolation (#168237) is integrated through main, retaining its unprivileged builder and root-owned publication boundary. Migration preservation (#168321) adds no persisted descriptor version. The inventory uses descriptor v3 in the same strict schema and control owner; coordination is recorded on #168237. The package capability remains unpublished until the combined bridge and retained readers qualify.

Actual collection, mount-safe removal, recovery-aware deletion and orphaned maintenance-child settlement remain outside this inspect-only change. This foundation adds production code because persistent ownership evidence and reader compatibility did not previously exist; it reuses the original control store, executor, service and launcher owners.

Evidence

Reviewed candidate: 82840d3a829b4fd4fa6544d4f1267a941f1e7111. The final independent review is clean through P2; the source bytes match the remote proof.

  • Baseline: two native preparations left three directories but only two durable current/prepared references. The provenance regression fails against the pre-change owner, then passes with historical inventory preserved.
  • Blacksmith Testbox tbx_01m4j1v0c94esaygx9t1jzcj1m: immutable sibling suites, protocol schema and CLI option tests; rollback, legacy non-backfill, stale revision, identity conflict, accepted versus rolled-back activation, and unsupported-reader refusal covered.
  • Same Testbox, real Linux root fixture: all 12 launcher tests passed, including frozen v1/v2 launcher upgrades, a v2 reader refusing v3 without executing Gateway code, and retained original launcher bytes. Launcher command wall time: 23.46 seconds (Vitest 21.72 seconds).
  • An initial focused run caught an over-broad downgrade guard in two pre-existing v1 fixtures; narrowed it to preserving v3 retention. The corrected owner/activation run passed all 55 tests in 45.56 seconds (Vitest 43.80 seconds).
  • Independent Codex review of the final gated design: scoped clean, no actionable P0–P2 findings.

The pre-integration staged check-changed gate passed on Hetzner cbx_0e7f9b4e3cde, including core types, all core-test type graphs, core/script lint, dead-export scans and structural guards. The export-name collision guard and both closure suites passed (20 checks). The same final run passed 118 focused tests, including 12 real root launcher tests.

After integrating the landed build-isolation and migration-preservation slices, Hetzner cbx_bdfe27e44ab7 verified the exact 21 source files byte-for-byte against the reviewed checkout. Integrated proof run: node scripts/run-vitest.mjs src/infra/*immutable*.test.ts src/cli/update-cli/status.test.ts src/cli/update-cli.immutable.test.ts src/cli/update-cli.option-collisions.test.ts packages/gateway-protocol/src/schema/config.test.ts --maxWorkers=1 passed 250 cases; the separate root launcher command passed all 12 root-only cases. Vitest phase durations were 4.55 s, 141.82 s, 26.73 s, and 42.97 s. This covers the integrated builder/publication path and the new receipt/status siblings. The integrated staged gate passed core types, all 27 core-test type graphs (1,761.95 s), and its preceding structural guards, then stopped at three inherited unused exports: isPollVoteEchoText, PUBLIC_SESSION_ENTRY_SCRIPT, and isClaudeLikeLiveAgent. The same three failures reproduce on a clean, unchanged worktree at base cdeb1e37adc6ecfba8db436f5372c37799d2f931. Baseline and remaining checks continue the native plan after that verified inherited failure; all remaining native commands passed (core/script lint, native schema, storage, media, sidecar, cycle, webhook and pairing guards), as did the export-name collision guard and both closure suites (20 tests, 64.11 s Vitest / 65.71 s wrapper). The continuation completed with exit 0 in 20m30.67s, including baseline installation and reproduction. The failed full gate is not represented as green.

Pre-integration per-file wall times (node scripts/run-vitest.mjs <file> --maxWorkers=1; launcher runs as root):

File Tests Wall seconds
packages/gateway-protocol/src/schema/config.test.ts 12 6.00
src/cli/update-cli.option-collisions.test.ts 14 6.26
src/infra/package-update-activation-immutable-recovery.test.ts 7 31.97
src/infra/package-update-activation-immutable.test.ts 26 67.61
src/infra/update-immutable-activation.test.ts 29 31.27
src/infra/update-immutable-install.adoption.test.ts 18 28.42
src/infra/update-immutable-launcher.test.ts 12 39.35

The slower file totals include existing SQLite crash/recovery fixtures and compiled-worker preparation; the added transaction/format cases themselves are millisecond-scale. Docs inventory includes both changed pages. The final report-filter command lacked rg on the image; its already-produced artifact was retrieved and checked with Python without replaying tests.

Production/tooling delta is +338/-31 (net +307); test/fixture delta is +630/-51, including the 215-line frozen v2 launcher required for real old-reader proof. The requested broad production filter reports net +520 because it also counts that frozen fixture and the removed ratchet entries. Growth is required for the newly approved persistent ownership and compatible-reader contracts; there is no existing release collector to remove in this foundation.

Infrastructure recovery: Testbox synchronization timed out, so validation moved to AWS. AWS passed the full typecheck and preceding guards, then identified the now-removed unused export. Its final pass hit the original lease lifetime; an undersized quota-fallback replacement was released, and Hetzner completed the final proof. No failed product check was waived.

No live Gateway adoption, published-package bridge qualification, or disk-reclamation claim is made.

Remote validation lineage
  • Blacksmith Testbox tbx_01m4hxbv6sba80d9qpadqd6sbt: interrupted before a verdict; released. Replacement tbx_01m4hxrdhkymf0b18kz954she2: node scripts/run-vitest.mjs src/infra/package-update-activation-immutable.test.ts --maxWorkers=1 passed 24 cases (47.56 s Vitest; 49.06 s wrapper), including the baseline provenance probe.
  • Blacksmith Testbox tbx_01m4j1v0c94esaygx9t1jzcj1m: focused immutable/CLI/protocol proof, corrected owner/activation rerun and real root launcher proof passed as recorded above; later synchronization timed out. Released.
  • AWS Crabbox cbx_e40e8c93eb78: node scripts/check-changed.mjs --staged passed full typechecking and preceding guards, then found the removed unused export. Its follow-up expired at the lease's original lifetime. Released. Quota-fallback cbx_0b3c22aff799 was unsuitable and released without running validation.
  • Hetzner Crabbox cbx_0e7f9b4e3cde: final pre-integration staged gate, export/closure guards, and 118 focused cases passed. A subsequent docs-report filter lacked rg; the generated inventory was downloaded and independently checked. Released.
  • Hetzner Crabbox cbx_0f0a5aa69e3b: first rebase proof passed core production typechecking before cancellation to integrate the newly landed build owner. Released; remaining checks are covered by the final integrated run.
  • Hetzner Crabbox cbx_bdfe27e44ab7: runs run_8c0ef3186af509c141e0dc2e3cc233b6 and run_2735d54eb2576330eda4533263eeefe8 stopped before tests at a textual Git-diff hash assertion. Direct comparison confirmed all 21 file contents matched; the final proof uses per-file SHA-256 admission. These were harness failures, not passing test runs. The final integrated command and results are recorded above. The subsequent native-plan continuation and unchanged-base reproduction passed as described above. The lease was released after the final result.

CI follow-up

Initial run 38046619071 identified four typed raw CASE expressions in the inventory reader. They now use Kysely's expression builder, preserving the exact byte bounds and nullable rejection while letting the query owner infer row types. Fresh independent review is clean.

Hetzner Crabbox cbx_76a1a50f67de, focused correction and baseline proof: core types passed, 38 immutable owner/recovery cases passed (70.13 s Vitest), and focused lint passed. The broad Kysely scan's 14 remaining diagnostics exactly match unchanged base cdeb1e37adc6ecfba8db436f5372c37799d2f931; none involve this diff. The first broad scan stopped on those inherited diagnostics before tests; the continuation compared them with the clean base and finished the focused proof.

The same lease reproduced the other CI leaves on unchanged main parent 123d5a1331a8307969767b34e8f8808461ea205b:

  • ui/src/e2e/chat-github-publication-guest.e2e.test.ts: the same two missing “Publish PR” button assertions failed; 1 case passed (56.19 s Vitest). Command: node scripts/run-vitest.mjs run --config test/vitest/vitest.ui-e2e.config.ts --configLoader runner ui/src/e2e/chat-github-publication-guest.e2e.test.ts --maxWorkers=1.
  • src/gateway/control-ui-public-session-refresh.test.ts:51: the same TS2345 (string | undefined passed as string) under node scripts/run-tsgo.mjs -p test/tsconfig/tsconfig.core.test.gateway-root.json.

Those UI/Gateway test files are untouched by this PR. No CI rerun or unrelated source change was used to clear them. The lease was released after proof.

Current head CI run 38050053802 reports four mobile-shell-geometry.e2e.test.ts cases. The same desktop-zero, landscape-zero, standalone-landscape-contract and compact-landscape failures occur on scheduled main run 38048680925, shard 4/9, main commit b0e5f302dd8d7ad6e2c141c9e9667bd11b8de645. This PR changes no UI files. All other selected current-head CI checks passed; the aggregate is red only because of that inherited UI leaf.

Record publication and accepted activation in the existing immutable control
store without backfilling legacy releases or enabling collection. Keep v3
adoption gated until a qualified serving bridge advertises compatibility.
@clawsweeper

clawsweeper Bot commented Oct 10, 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 app: web-ui App: web-ui gateway Gateway runtime cli CLI command changes scripts Repository scripts size: XL labels Oct 10, 2026
@steipete
steipete marked this pull request as ready for review October 10, 2026 10:55
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. 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 Oct 10, 2026
@clawsweeper

clawsweeper Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR preserves immutable release publication and successful activation evidence in an inspect-only inventory.

Example: A compatible version-3 installation prepares generations cccccccccccccccccccccccccccccccccccccccc and dddddddddddddddddddddddddddddddddddddddd.

  • Before: The second preparation replaces the first preparation receipt, losing its durable publication evidence.
  • After: Both generations remain inventoried with their publication revisions, without deleting directories or backfilling older releases.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Coherent, useful foundation with owner-boundary coverage; operational adoption remains deliberately gated, and inherited CI failures are independently attributed.
Proof confidence 🦐 gold shrimp (3/6) Maintainer-directed, gated foundation: supplied evidence reports real SQLite owner fixtures and root launcher execution, while explicitly deferring live adoption; the linked remote run was inaccessible from this review environment.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Feature · Worth it: Yes · Fix scope: Complete
User problem: Operators cannot reliably distinguish previously published immutable releases from unknown directories once preparation receipts are replaced.
Reason: The feature owner explicitly accepts this bounded inventory foundation and its deferred operational rollout.

Merge readiness

✅ Ready for maintainer review

Keep this PR open as a useful, maintainer-directed foundation. Matching GitHub annotations resolve the previous CI attribution blocker; no actionable introduced defects remain.

Priority: P2
Reviewed head: 82840d3a829b4fd4fa6544d4f1267a941f1e7111

Before merge

None.

Findings

None.

Agent review details

How this fits together

The immutable updater consumes installation bindings and sealed generations, writes revision-checked SQLite receipts, and exposes release facts through update status.

flowchart TD
A[Immutable update CLI] --> B[Existing executor owner]
B --> C[Sealed generation preparation]
C --> D[Immutable control transaction]
E[Successful activation] --> D
D --> F[Release inventory]
F --> G[Update status]
Loading

Technical review

Best possible solution:

Retain this inspect-only foundation with the package capability unpublished until the coordinated bridge rollout qualifies.

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

Current-main preparation replaces its sole prepared receipt without retaining historical publication rows; this read-only review ran no target code.

Is this the best way to solve the issue?

The existing control store is the appropriate owner, and transactional inventory avoids directory-name inference or a competing persistence path.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Preparation and control-store ownership keeps the original intent (99babf2: Record exact-SHA preparation without activating or deleting generations.)
  • Activation acceptance and retained recovery keeps the original intent (1c88dd2: Keep pointer effects, acceptance, recovery, and live authority under the immutable control owner.)
  • Launcher and descriptor compatibility changes intended behavior with a stated reason (1c88dd2: Explicit version-2 adoption enabled activation and allowed only known launcher upgrades with retained original bytes.)
  • Build isolation keeps the original intent (ec2c1fa: Separate unprivileged build execution from privileged materialization and publication.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

PR surface

Source +297, Tests +579, Docs +93, Other +8. Total +977 across 21 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 9 327 30 +297
Tests 8 630 51 +579
Docs 2 107 14 +93
Config 0 0 0 0
Generated 0 0 0 0
Other 2 11 3 +8
Total 21 1075 98 +977

Review metrics

Metric Value Why it matters
Production versus test growth Production/tooling +338/-31; tests/fixtures +630/-51 Growth implements durable inventory and reader admission in existing owners; test support includes a frozen historical launcher for compatibility checks.
Explicit adoption surface 1 new CLI flag, descriptor version 3, 1 SQLite table The accepted additions remain gated by the installed generation's capability marker.

Labels

Label changes:

  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • remove status: ⏳ waiting on author: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P2: This is a bounded provenance improvement for the staged immutable updater, with no automatic adoption or release deletion.
  • 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.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only; repair and merge need explicit maintainer commands such as @clawsweeper autofix or @clawsweeper automerge.

History

Review history (2 earlier review cycles)
  • reviewed 2026-10-10T11:02:24.636Z sha 96cf69d :: needs changes before merge. :: none
  • reviewed 2026-10-10T12:02:32.905Z sha 82840d3 :: needs changes before merge. :: none

Reviewed October 10, 2026, 8:17 AM ET / 12:17 UTC (Revision 3).

@steipete

steipete commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor Author

The review's CI-classification item is resolved for the source change. The architecture guard found four typed raw CASE expressions; 82840d3a829b4fd4fa6544d4f1267a941f1e7111 replaces them with Kysely CASE builders while preserving exact bounds and NULL rejection. Fresh independent review, core types, 38 immutable owner/recovery cases, and focused lint passed.

The other initial CI failures reproduce on unchanged main parent 123d5a1331a8307969767b34e8f8808461ea205b: both missing Publish PR button cases in chat-github-publication-guest.e2e.test.ts (56.19 s), and the TS2345 at control-ui-public-session-refresh.test.ts:51. Their files are untouched here. Baseline and focused correction proof: https://crabbox.openclaw.ai/portal/runs/run_20d99598d8b6cd52690c4ae198f9c175 (Hetzner cbx_76a1a50f67de, now released).

The updated PR body preserves the failed results and the exact reproduction commands. The new head's CI is allowed to finish normally; no CI rerun was requested.

Current head CI run 38050053802 reports four mobile-shell-geometry.e2e.test.ts cases. The same desktop-zero, landscape-zero, standalone-landscape-contract and compact-landscape failures occur on scheduled main run 38048680925, shard 4/9, main commit b0e5f302dd8d7ad6e2c141c9e9667bd11b8de645. This PR changes no UI files. Other current-head checks are still finishing.

@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

The current open item is now attributed with matching main evidence. All four failures in mobile-shell-geometry.e2e.test.ts occur on scheduled main run https://github.com/openclaw/openclaw/actions/runs/38048680925/job/114203387180 at b0e5f302dd8d7ad6e2c141c9e9667bd11b8de645: desktop-zero (159 versus 142), landscape-zero and standalone-landscape-contract (173 versus 150), and compact-landscape (175 versus 150). The current PR run has the same cases, locations and measured bounds. This PR touches no UI source or tests.

Current head is 82840d3a829b4fd4fa6544d4f1267a941f1e7111. All other selected CI checks passed, including the corrected Kysely architecture guard, core/test types and security reviews. The only red leaf is UI E2E shard 2/4; the CI gate is its downstream aggregate. The body and previous response retain the remote owner proof, initial failure classification, and main-run link. No CI rerun or unrelated source edit was used to chase green.

@clawsweeper

clawsweeper Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Oct 10, 2026
@steipete
steipete merged commit bfe5853 into main Oct 10, 2026
158 of 161 checks passed
@steipete
steipete deleted the steipete/perf-micro-update-slice9-release-gc-20260919 branch October 10, 2026 12:21
@steipete

Copy link
Copy Markdown
Contributor Author

Merged as bfe58537cadc92d945e053406942a600a96b37c0 under the maintainer-authorized inherited-failure exception.

The only failing leaf on reviewed head 82840d3a829b4fd4fa6544d4f1267a941f1e7111 was checks-ui-e2e (2/4) in CI run 38050053802: the four mobile-shell geometry cases. Scheduled main run 38048680925, shard 4/9 reproduces the same cases and bounds (159 versus 142; 173/175 versus 150). This PR changes no UI files. The aggregate CI gate reflects that leaf; all other selected checks and security reviews passed. Independent review and the refreshed PR review have no findings or remaining items.

The approved foundation remains inspect-only: no collection, deletion, implicit backfill, published v3 capability, or live adoption was enabled. Remote validation, baseline reproductions, the corrected Kysely guard issue, and production growth are recorded in the PR body. All validation leases were released.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 11, 2026
…claw#168403)

* fix(update): retain immutable release provenance for inspection

Record publication and accepted activation in the existing immutable control
store without backfilling legacy releases or enabling collection. Keep v3
adoption gated until a qualified serving bridge advertises compatibility.

* fix(update): infer bounded release inventory query results
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: web-ui App: web-ui cli CLI command changes docs Improvements or additions to documentation gateway Gateway runtime P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. scripts Repository scripts 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