Repository navigation
feat(pr): release dependency cache holds left behind by dead wrappers - #194546
Conversation
A creator that dies before retiring its anchor leaves dependency holds that nothing can release, because only the creator may retire an anchor. Those entries never settle, so the collector never considers them. Add `scripts/pr dependency-hold-release`. A read-only dry run lists each anchor, its entries and the evidence, and emits a sealed plan. Release takes that exact plan with --confirmed-no-running-tools, recollects evidence immediately before each anchor, retires a present anchor in the creator's order, and settles under the owner's metadata lock and transaction. Retirement and release now share one settlement path. PID death, age and path disappearance still never authorize release on their own, and nothing sweeps automatically. Authority is the operator's confirmation of a reviewed plan, plus fail-closed evidence, plus exact identity rechecks.
…erjee-12102f # Conflicts: # docs/reference/scripts/pr-tooling.md
Extend the live package reader test: while the reader survives its exited creator the anchor is blocked, and once it exits a sealed release retires the anchor without following its symlinks, settles the entry, reruns safely, and lets the next real materialization evict it. Return the fixture-level eviction test to proving creator retirement, so each contract has one owner at its strongest boundary.
|
🦞👀 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 Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex review: needs maintainer review before merge. What this changesThis PR adds an operator-confirmed command to retire finished wrapper anchors and release their dependency-cache holds. Example: A wrapper dies, leaving an anchor holding one dependency installation.
Review scores
ProductKind: Feature · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this maintainer-authored PR adds useful recovery for historical dependency holds that main cannot release, with no concrete introduced defect found. Priority: P2 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherThe scripts/pr wrapper projects cached dependencies into temporary anchors; the SQLite lifetime owner records holds and settlement, which determine whether the collector may evict installations. flowchart TD
A[Operator] --> B[Authenticated PR wrapper]
B --> C[Plan and process inspection]
C --> D[Cache lifetime owner]
D --> E[Anchor retirement and hold settlement]
E --> F[Existing dependency collector]
Technical reviewBest possible solution: Keep confirmed recovery in the existing cache lifetime owner, with exact reviewed holds, fresh process inspection, and unchanged automatic collection. Do we have a high-confidence way to reproduce the issue? Main's creator-only retirement checks explain why a crashed creator leaves holds permanently pinned; the PR also reports a real host inventory of retained holds, but no target code was executed during this review. Is this the best way to solve the issue? The change uses the existing lifetime owner, preserves conservative automatic behavior, and adds the smallest coherent operator recovery path; the test helpers consolidate repeated setup while retaining distinct failure coverage. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 38b3a0d00ae8. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceTests -6, Docs +71, Other +408. Total +473 across 13 files. Added test files: 0. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. Review metrics
LabelsLabel changes: No label changes. Label justifications:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale6/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. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed November 7, 2026, 3:21 AM ET / 08:21 UTC. |
|
Merged via squash.
|
…openclaw#194546) * feat(pr): release finished dependency holds with operator confirmation A creator that dies before retiring its anchor leaves dependency holds that nothing can release, because only the creator may retire an anchor. Those entries never settle, so the collector never considers them. Add `scripts/pr dependency-hold-release`. A read-only dry run lists each anchor, its entries and the evidence, and emits a sealed plan. Release takes that exact plan with --confirmed-no-running-tools, recollects evidence immediately before each anchor, retires a present anchor in the creator's order, and settles under the owner's metadata lock and transaction. Retirement and release now share one settlement path. PID death, age and path disappearance still never authorize release on their own, and nothing sweeps automatically. Authority is the operator's confirmation of a reviewed plan, plus fail-closed evidence, plus exact identity rechecks. * test(pr): prove hold release end to end on a real projection Extend the live package reader test: while the reader survives its exited creator the anchor is blocked, and once it exits a sealed release retires the anchor without following its symlinks, settles the entry, reruns safely, and lets the next real materialization evict it. Return the fixture-level eviction test to proving creator retirement, so each contract has one owner at its strongest boundary.
What Problem This Solves
Fixes:
scripts/prdependency cache entries stay pinned forever when the wrapper that created their anchor dies without retiring it, because only the creator may release its holds.User Impact
User impact: maintainers can review leaked dependency holds with a read-only dry run, then release exactly the reviewed anchors with an explicit confirmation, so the existing collector can evict those entries. No release happens automatically, and ordinary
scripts/prruns are unchanged.This changes a documented rule, so it is worth reading on its own:
docs/reference/scripts/pr-tooling.mdpreviously said a creator crash never authorizes releasing holds. Nothing releases them automatically now either, and PID death, age, and path disappearance still never authorize release on their own. The one new exception is an operator confirming a reviewed plan.Why This Change Was Made
Eviction already works, but it only considers settled, unheld entries. Holds from a dead creator can never release, so their entries are never considered. #194520 stopped one source of new leaks; this handles the holds that already exist and any future leak from a crash.
Holds exist because an inherited consumer can outlive its creator, so no signal alone proves an anchor finished. Authority follows
lock-recover: an explicit operator confirmation, plus evidence checks that fail closed, plus exact identity rechecks by the owner.Evidence is collected again immediately before each anchor and never trusted from the plan. Any of these blocks an anchor: a live same-uid creator, a live process in the creator's group, any process referencing the anchor or an entry it holds (by command line or open file), or a changed anchor or entry identity. A failed
psorlsofstops the command.Decisions worth a reviewer's attention:
already-releasedand never touches that path.lsofalone takes about 0.3 s, so scanning under the lock would make live wrappers fail. The ledger recheck does run under the lock, inside the transaction. A hold a live wrapper takes during a batch is safe by accounting: its anchor is not in the sealed plan, and its row keeps the entry unsettled.retireAnchorDependenciesand the new release share their snapshot and settlement code rather than forking it.Accepted edges, deliberately not coded around:
Release-note context: new maintainer command
scripts/pr dependency-hold-release.Evidence
End to end on a real projection. The existing live package reader test drives the real embedded materializer, leaving a real
node_modulesprojection, an exited creator, and a live reader, which is exactly a leaked hold. It now continues:blockedwithprocess-references;already-released;Refusals leave the ledger byte-identical: missing confirmation, wrong seal, a hold added after review, and an anchor replaced at the same path (the replacement survives).
Live holds are never released, even through a sealed, confirmed plan. Using real
psandlsofwith no mocks, the cases are a live creator, an orphaned process group whose leader has exited, a process with its cwd in the anchor, and a process whose command line names the entry key. For the creator and group cases, the test deliberately promotes the blocked record into a sealed plan, because a dead PID cannot be made live; this proves evidence is recollected rather than read from the plan.Negative controls, each failing for the intended reason: release blockers disabled (4 live-hold cases fail), reviewed-holds comparison removed (the added-hold case fails), anchor removal skipped (the end-to-end test fails). All were restored afterward.
Live dry run on one maintainer host, read-only:
Ledger bytes were unchanged and no lock remained. Two runs produced the same seal. An independent raw
psandlsofcheck agreed: no references, and no same-uid process with a creator PID as its pid or pgid. No live hold has been released; that awaits the maintainer's decision on this output.Test cost. Net test lines are -6 against the merge base (422 added, 428 removed), through consolidation that keeps every existing assertion. Measured with
--maxWorkers=1:pr-dependency-cache.test.tspasses 62 tests in about 30 to 50 s depending on host load, of which the 10 new cases take about 11 s. The extended reader test takes about 8 s. CI seconds to follow.Local suites run:
pr-dependency-cache, the dependency-cache-recovery, closed-reader and live-reader cases ofpr-wrappers,pr-materialized-anchor,check-deadcode-exports, and the wrapper inventory check. Autoreview reported no P0 to P2 findings, though one of its 9 chunks contained only file statistics, so it carries little weight there.Known gaps:
psandlsofbehavior there.