Skip to content

fix(pr): recover dependency caches after device identity changes - #192855

Merged
vincentkoc merged 2 commits into
mainfrom
fix/pr-cache-identity-recovery-20261104
Nov 5, 2026
Merged

vincentkoc merged 2 commits into
mainfrom
fix/pr-cache-identity-recovery-20261104

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Nov 4, 2026 •

Copy link
Copy Markdown
Member

What Problem This Solves

Fixes maintainer PR operations remaining blocked when the dependency-cache ledger's recorded device numbers no longer match the independently inspected filesystem identities.

User Impact

Operators can explicitly adopt the audited device identities and resume ordinary PR tooling. Recovery requires authenticated official-main tooling, a sealed exact-state plan, and operator confirmation. Matching inodes or a reboot alone do not establish that adoption is safe.

Why This Change Was Made

The new recovery operation uses the existing lifetime owner to validate the complete physical inventory and logical preimage under its metadata mutex and one synchronous SQLite transaction. It updates only cache, database, and installation device cells. Historical holds, sequence, settlement, reuse order, and installed contents remain intact; an exact postimage reconciles a lost response.

The command authenticates the official repository and complete source closure before opening the ledger, without package installation. The existing current-workflow recovery path shares the unchanged official-origin policy. Materialized recovery wrappers are explicitly retained on success and failure. Exit cleanup must not open SQLite and roll back an unresolved journal after recovery refuses it. Production grows by 243 lines for explicit adoption, source admission, reconciliation, and this cleanup boundary; 548 test lines have a matching allocation.

Evidence

  • Representative six-installation/twelve-hold fixture changes exactly eight device cells; subsequent anchor acquisition and retirement preserve historical holds. Refusal, rollback, and exact replay cases pass.
  • 57 cache-lifetime/anchor tests passed before lint-only cleanup; 11 affected recovery cases passed after that cleanup. The workflow sibling and both origin-ordering regressions passed after the early admission fix. Four final wrapper cases passed after the cleanup fix: canonical/developer/extracted source admission, both linked/anchor re-entry refusals, and an actual hot-journal refusal. The hot-journal regression failed on the previous cleanup because it deleted the journal; the repaired route preserves both database and journal bytes. Successful extracted replay retains its wrapper and leaves database bytes unchanged.
  • Targeted native lint, formatting, Bash/Node syntax, whitespace, docs lint, and the scoped line-cap ratchet passed.
  • Historical local proof: the test-line ratchet failed at the 340-line candidate, 6,465,126 lines against a 6,464,910 ceiling (216 over). The final branch adds and allocates 548 lines. The local global counter was not repeated; this historical 216-line result is separate from the final CI result below.
  • Independent source review accepted the final patch. Local ClawSweeper was unavailable for this scope, so the prescribed autoreview fallback reviewed the complete authored diff and selected owner context through P2: no actionable findings. Reviewed base 1835c9cad10a936fbd079a52e65bb2ede5ef1e38, local snapshot SHA-256 83c6bea9751b9cc39c0a5901f1d27da119844700fb2b5219d7d8ed32339fbea2; signed commit 5ae4c8eccca4cc76797ae4ced662731fe5ed6aaa has the identical patch. That local model result is historical proof for 5ae4c8. Final head b5c82053c1c7c39ebb85c9639a171cff6ac98cd0 adds only two independently reviewed fixture non-null annotations; Node type stripping confirms unchanged runtime code, and both affected fixture cases plus targeted lint pass.
  • Initial CI identified two fixture indexing type errors; both are corrected. Final CI executed merge f2ef3284daf775944704fd50f931244157e574e2 (baseline e81ab22955018b2f15adf50eac6bfcb86ea56ae3 plus head b5c82053c1c7c39ebb85c9639a171cff6ac98cd0). Its tooling compiler leaf passed with exit code 0. This does not claim the whole type job passed.
  • Final CI remains failed: seven type jobs report the same UI browser-panel error, with identical UI, dependency, configuration, and checker inputs between the actual baseline and tested merge. Core type shards have matching main failure signatures; the native aggregate classifications remain unknown and are covered by the inspected source attribution.
  • The final CI test-line count is 6,466,467 against a 6,466,276 ceiling: 191 over, net delta +548. Only two test files add 239 + 309 LF bytes, matched by the sole new 548-line allocation; the scalar and all existing allocations are unchanged. Subtracting those changes derives baseline total 6,465,919 and ceiling 6,465,728, preserving the same 191-line excess. This is source/count arithmetic, not a separately executed baseline. The unchanged ratchet permits an over-budget tree when delta is nonpositive, so this PR activates its absolute-debt check while adding zero excess. The native NEW classification against a passing main comparator is preserved. Other baseline ratchets and security-fast passed; the CI gate propagates the identified failures. Independent review accepted this attribution; CI is not relabeled green.
  • The completed hosted review covers exact head b5c82053c1c7c39ebb85c9639a171cff6ac98cd0 and reports no findings or before-merge actions.
  • Shared live-cache recovery has not been run. Final merge approval remains reserved; any inherited-failure admission must retain the failed CI evidence and all enforced review/security checks.

@vincentkoc vincentkoc self-assigned this Nov 4, 2026
@clawsweeper

clawsweeper Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation scripts Repository scripts size: L labels Nov 4, 2026
@vincentkoc
vincentkoc marked this pull request as ready for review November 4, 2026 15:40
@vincentkoc

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@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. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. 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 Nov 4, 2026
@clawsweeper

clawsweeper Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR adds an explicit command to adopt inspected dependency-cache device numbers while preserving installations and lifetime holds.

Example: A cache and its installations now report device 2049, while their ledger records device 2048.

  • Before: Ordinary PR operations refuse the mismatched ledger.
  • After: An operator can submit a sealed recovery plan that updates only device-number cells, then retry ordinary admission.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Useful and coherent recovery with meaningful production-owner fixture coverage, no actionable finding, and limited operational proof.
Proof confidence 🦐 gold shrimp (3/6) This maintainer-authored PR is outside the ordinary contributor proof gate; supplied tests exercise real wrapper admission, recovery, replay, and hot-journal refusal, while the body explicitly disclaims shared live-cache execution.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Feature · Worth it: Yes · Fix scope: Complete
User problem: Maintainer PR operations cannot resume after an independently verified cache device-number change.
Reason: The maintainer-authored direction adds a bounded recovery capability while retaining the deliberate refusal in ordinary operations.

Merge readiness

✅ Ready for maintainer review

Keep this maintainer-authored PR open: it adds useful, narrowly scoped recovery, and no actionable introduced defect was found.

Priority: P2
Reviewed head: b5c82053c1c7c39ebb85c9639a171cff6ac98cd0

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: Recovery of a shared cache outside synthetic fixtures has not been demonstrated.
Agent review details

How this fits together

The PR wrapper authenticates tooling source and passes an operator-sealed plan to the existing SQLite cache-lifetime owner, which validates identities and commits the narrow repair.

flowchart TD
  A[Operator recovery plan] --> B[PR wrapper]
  B --> C[Official main source verification]
  C --> D[Cache metadata mutex]
  D --> E[Lifetime ledger transaction]
  E --> F[Device identity adoption]
  F --> G[Ordinary PR admission]
Loading

Technical review

Best possible solution:

Retain the explicit recovery operation in the existing lifetime owner, with ordinary identity admission and historical holds preserved.

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

Source establishes that changed device numbers trigger ordinary ledger-owner refusal, and the supplied fixtures exercise that condition; no reproduction was run during this read-only review.

Is this the best way to solve the issue?

The change uses the existing mutex and lifetime ledger, preserves collection authority, and provides exact replay without adding a competing state owner.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Cache ownership and historical holds keeps the original intent (39b3d94: Prevent collection while inherited consumers may still use projected packages; disappearance and creator death are insufficient release authority.)
  • Official-origin policy for current-workflow recovery keeps the original intent (649f269: Allow qualified recovery through current official tooling while preserving workflow and merge admission.)
  • Frozen dependency materialization keeps the original intent (8776378: Resume retained workflows after dependency refreshes without replacing their binding or shared installation.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

  • Current-main refusal remains intentional: Current main rejects cache and database identities that differ from the recorded owner; the reviewed recovery operation is absent from the corresponding main files. (scripts/pr-lib/cache-lifetime.mjs:317, e81ab2295501)
  • Narrow recovery owner: The introduced operation compares the complete logical preimage and physical inventory, updates only device cells in one synchronous transaction, and recognizes the exact postimage on replay. (scripts/pr-lib/cache-lifetime.mjs:386, b5c82053c1c7)
  • Source admission and refusal cleanup: Recovery verifies the official-main closure before importing its owner, bypasses dependency installation, and retains materialized wrappers without exit-time ledger access. (scripts/pr:1329, b5c82053c1c7)
  • Existing-state compatibility: The schema is extracted unchanged rather than migrated; recovery fixtures populate existing installations and historical holds, verify only eight device cells change, and exercise replay, subsequent acquisition, retirement, rollback, and refusal. The latest stable tag has no cache-lifetime module, so there is no stable v3 ledger migration to perform. (test/scripts/pr-dependency-cache.test.ts:272, b5c82053c1c7)
  • Original lifetime contract: The merged fix(scripts): preserve PR tooling across process handoffs #185964 established durable holds because creator death or path disappearance cannot authorize collection; this PR preserves that contract. (scripts/pr-lib/cache-lifetime.mjs:384, 39b3d94413ba)
  • Re-review and validation scope: The previous review reported no findings; the final commit changes only two fixture non-null annotations. The body reports focused passes and unresolved earlier CI attribution, while the current-head check query returned no failed or timed-out checks; this does not establish completed green CI. (test/scripts/pr-wrappers.test.ts:1140, b5c82053c1c7)

Likely related people:

  • Vincent Koc: Raw commit 39b3d94 adds scripts/pr-lib/cache-lifetime.mjs:306 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 39b3d94413ba; files: scripts/pr-lib/cache-lifetime.mjs)

PR surface

Tests +548, Docs +62, Other +244. Total +854 across 7 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 2 549 1 +548
Docs 1 62 0 +62
Config 0 0 0 0
Generated 0 0 0 0
Other 4 280 36 +244
Total 7 891 37 +854

Review metrics

Metric Value Why it matters
Recovery surface 1 new operator subcommand; 0 new configuration keys Recovery is explicit and leaves ordinary cache admission unchanged.
Production versus tests Production/declarations +279/-36; tests +549/-1 Growth covers source admission, transactional adoption, reconciliation, and distinct refusal and cleanup boundaries.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: This restores a limited maintainer tooling workflow after audited filesystem identity changes.
  • 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 execution lanes are retired.

History

Review history (1 earlier review cycle)
  • reviewed 2026-11-04T15:49:01.090Z sha 5ae4c8e :: needs maintainer review before merge. :: none

Reviewed November 4, 2026, 10:59 AM ET / 15:59 UTC (Revision 2).

@vincentkoc

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:feature Preliminary submission classification; full source review pending. and removed clawsweeper:intake:feature Preliminary submission classification; full source review pending. labels Nov 4, 2026
@vincentkoc
vincentkoc merged commit cce57b2 into main Nov 5, 2026
122 of 132 checks passed
@vincentkoc
vincentkoc deleted the fix/pr-cache-identity-recovery-20261104 branch November 5, 2026 09:36
@vincentkoc

Copy link
Copy Markdown
Member 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 Nov 6, 2026
…nclaw#192855)

* fix(pr): recover dependency caches after device identity changes

* test(pr): narrow verified cache recovery fixture identities
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. scripts Repository scripts 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