Skip to content

fix(update): stop runtime retention from hard-linking released activation journals that block later package swaps - #187549

Merged
steipete merged 1 commit into
mainfrom
upd/upd-l1964
Oct 29, 2026
Merged

steipete merged 1 commit into
mainfrom
upd/upd-l1964

Conversation

@steipete

Copy link
Copy Markdown
Contributor

Fixes #187468

What Problem This Solves

Fixes npm-global updates getting stuck at package-swap when runtime retention has added a hard link to recovery evidence left by a completed update.

User Impact

An updater containing this repair automatically archives an already multiply linked completed receipt, reports a warning, and continues updating. The original journal bytes are preserved. In-flight recovery still requires nlink=1. This fix must be present in the installed updater; the documentation retains the Doctor recovery steps for older updaters.

Why This Change Was Made

Runtime retention now copies owner-private files, including private recovery modules inside dist, instead of changing their link count and ctime. Package activation remains the lifecycle owner: its settlement reader can inspect a multiply linked journal only to establish completion, cannot admit a writer, and archives completed evidence under a fresh live update fence. Admission and preparation consume that same completed-evidence contract, including the existing warning fallback when archival is unavailable.

Current main already excludes recovery controls beside the package (#162246). A clean two-update sequence therefore passed before this change. The remaining producer gap was private files within the retained runtime, and the recovery gap was admission rejecting an already linked completed receipt before it could inspect completion. The regressions distinguish those cases rather than attributing the existing exclusion to this PR.

Thanks to @zigit for the cross-machine root-cause analysis and inode evidence in the issue report.

Evidence

  • Real-filesystem npm-root activation → runtime retention → second package-swap, both clean and with an alias left by an affected updater. The regression checks private source nlink=1, unchanged inode/ctime, byte-preserving archival, and successful activation of the next version. A separate negative control preserves and refuses multiply linked in-flight recovery.
  • Base d207f65438410ecfc78789133d870773428bcf23: two regression cases fail (private source becomes nlink=2; linked completed journal refuses admission), and the in-flight safety case passes.
  • Node 26.12.1: all 57 selected consumer files completed (54 passed, 3 pre-existing skips); 766 tests passed and 66 pre-existing skips, 376.16 s wall. No individual test exceeded 30 s.
  • Pinned Bun 1.4.4: all 4 owner files and 35 tests passed, 10.37 s wall.
  • Final regression file: 3/3 on Node (8.18 s wall, 6.40 s file duration) and 3/3 on Bun (6.30 s wall, 4.74 s file duration), including the existing POSIX-only activation guard.
  • One initial consumer invocation was invalidated by an unused-import edit after compilation began; the complete consumer selection was rerun successfully with sources frozen.
  • Core and services-test typechecks pass; focused oxlint, oxfmt, git diff --check, and madge pass (0 cycles).
  • Both ratchets pass: 404 grandfathered max-lines suppressions; environment names 458/458; test lines 6,257,795 against ceiling 6,322,835. No baseline changes.
  • Codex autoreview of the final local change against the base above: scoped-clean at P0/P1, no actionable findings. Simplification pass kept the existing settlement and archive owners, with no new state or dependency.
  • Full check:changed / SQLite inventory omitted under the campaign's local gate budget; PR CI supplies broad validation. No remote lease used.

Production: +51/-19 lines (net +32). Regression tests: +119 lines. Documentation: +8/-1 lines.

Copy owner-private retained runtime files instead of changing recovery link
counts and ctime. Inspect multiply linked completed receipts read-only and
archive their original bytes under a fresh update fence; keep in-flight
recovery and writer admission strict.

Prove successful activation, runtime retention, and a second package swap,
including already-affected installations and an in-flight negative control.
Thanks to @zigit for the root-cause analysis and inode evidence.

Fixes #187468
@clawsweeper

clawsweeper Bot commented Oct 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 size: S labels Oct 29, 2026
@steipete
steipete marked this pull request as ready for review October 29, 2026 09:24
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-29T09:27:20.883909Z 41b42d9 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 29, 2026
@clawsweeper

clawsweeper Bot commented Oct 29, 2026

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge.

What this changes

This PR copies private retained-runtime files and archives multiply linked completed activation journals so later package updates can proceed.

Example: A completed npm-global update leaves operation.sqlite with nlink=2.

  • Before: The next updater rejects the journal before inspecting its completion receipt.
  • After: The patched updater reads completion without admitting a journal writer, preserves the evidence through archival, and allows the next update.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) A focused, useful patch with meaningful boundary regressions and no correctness findings; released-installation compatibility remains unqualified.
Proof confidence 🦐 gold shrimp (3/6) 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.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: An npm-global update can repeatedly refuse package publication because retained recovery evidence has extra hard links.
Reason: The linked discussion records owner approval, the failure is source-verifiable, and the patch preserves the existing recovery ownership and safety contract.

Merge readiness

⛔ Blocked before merge - 1 item remains

Keep this PR open: it addresses a source-verifiable recovery gap that remains on main, preserves unfinished-recovery protections, and has no discrete correctness finding.

Priority: P2
Reviewed head: 41b42d986c065a413b55324326064578a29fc431

Before merge

  • Add data-model compatibility proof - The review found that existing stored data may not work after upgrade. Show that existing data still loads and works with this change.

Findings

None.

Tests

  • Missing end-to-end proof: Provide released-installation upgrade evidence exercising linked completed evidence through the patched updater, with settings, data, and archived journal bytes preserved.
Agent review details

How this fits together

Runtime retention preserves files needed by updater workers; package activation consumes staged packages and recovery journals to publish installations or settle completed recovery.

flowchart LR
  A[Installed runtime files] --> B[Runtime retention]
  B --> C[Private retained runtime]
  D[Activation journal] --> E[Completion inspection]
  E --> F[Fenced evidence archival]
  F --> G[Next package activation]
Loading

Technical review

Best possible solution:

Keep prevention in runtime materialization and completed-evidence handling in the existing activation owner, preserving strict unfinished recovery and the documented older-updater recovery route.

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

Current source exposes both failure paths, and the added regressions exercise them through real filesystem and activation owners; no target code was executed during this read-only review.

Is this the best way to solve the issue?

The patch is a focused complete repair using existing owners: prevent private-file link mutation, inspect only completed shared journals, and archive under current update authority.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Private runtime materialization changes intended behavior with a stated reason (fdb7463: Simplify ordinary hard-link retention while preserving independent copies for safety-sensitive files and portable copy fallback.)
  • Journal single-link enforcement changes intended behavior with a stated reason (4d2617d: Retain unsafe-object protections while making link-count and permission refusals diagnosable.)
  • Completed evidence archival keeps the original intent (4821885: Completed recovery history must not regain restoration authority or permanently block updates; archival failure remains a warned availability fallback.)
  • Admission and preparation settlement keeps the original intent (ff6f58a: Use the existing settlement owner for eligible stale recovery and archive completed receipts before preparing another operation.)
  • Older-updater recovery documentation keeps the original intent (60cfa39: Guide operators to Doctor reclamation for retained runtime links while preserving recovery evidence.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Dallin Romney: Raw commit 4821885 adds src/infra/package-update-activation-journal.ts:284 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 4821885e5b4d; files: src/infra/package-update-activation-journal.ts)

PR surface

Source +32, Tests +119, Docs +7. Total +158 across 6 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 4 51 19 +32
Tests 1 119 0 +119
Docs 1 8 1 +7
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 6 178 20 +158

Review metrics

Metric Value Why it matters
Production versus regression growth Production +51/-19; regression tests +119 The growth adds completed-only inspection to existing owners and distinct filesystem regressions without new state, dependencies, or parallel recovery machinery.

Labels

Label changes:

  • add P2: Affected npm-global installations cannot complete later updates, while the previous Gateway continues serving and an existing recovery route remains available.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.

Label justifications:

  • P2: Affected npm-global installations cannot complete later updates, while the previous Gateway continues serving and an existing recovery route remains available.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.

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 execution lanes are retired.

Reviewed October 29, 2026, 5:40 AM ET / 09:40 UTC.

@steipete
steipete merged commit a7a8c39 into main Oct 29, 2026
210 of 211 checks passed
@steipete
steipete deleted the upd/upd-l1964 branch October 29, 2026 09:47
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 30, 2026
…tion journals that block later package swaps (openclaw#187549)

Runtime retention hard-linked the released package activation journal into its payload (nlink 1 -> 2), so the next update's package-swap preflight, which requires single-link publication-recovery objects, refused every subsequent update and rolled back. Retention now copies owner-private runtime files, and the activation owner archives completed journals that already carry an extra link (bytes preserved, warning logged) so affected installs heal on their next update. In-flight recovery keeps the nlink=1 safety check.

Fixes openclaw#187468. Root-cause analysis by @zigit.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update failure: package-swap (2026.9.8)

1 participant