Repository navigation
fix(pr): dependency cache holds leak when a reader closes scripts/pr output early - #194520
Conversation
`scripts/pr --help | head -40` closes stderr while a frozen install is still printing. The creator trapped HUP, INT, QUIT, and TERM but not PIPE. Bash 5 died without its EXIT trap; Bash 3.2 ran it from the fatal-signal handler, where bootstrap verification failed and retained the anchor, with the warning lost to the closed pipe. The hold never released, so the installation could never settle or be collected. Handle PIPE like the other signals so retirement runs from an ordinary exit. The exit status stays 141. Repeated hold setup in the cache tests moves to one helper, keeping net test lines at zero.
|
🦞👀 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 handles SIGPIPE during wrapper creation so authenticated cleanup releases dependency-cache holds while preserving exit status 141. Example: Run scripts/pr --help 2>&1 | head -40 while frozen dependencies are being installed.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this PR fixes an evidenced resource leak that remains on main, with a minimal lifecycle repair and no actionable findings. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe scripts/pr shell wrapper selects trusted tooling and projects dependencies; creator retirement removes its temporary anchor and settles holds in the existing SQLite lifetime ledger. flowchart TD
A[PR command] --> B[Trusted wrapper selection]
B --> C[Creator holds anchor descriptor]
C --> D[Dependency installation and ledger hold]
D --> E[Output reader closes]
E --> F[PIPE trap exits 141]
F --> G[Authenticated anchor retirement]
G --> H[Release hold and settle installation]
Technical reviewBest possible solution: Use the existing creator retirement owner for SIGPIPE, preserving authenticated settlement and status 141. Do we have a high-confidence way to reproduce the issue? The base lacks PIPE handling on the creator cleanup paths, and the PR reports matching red/green wrapper results on Bash; no target code was executed during this read-only review. Is this the best way to solve the issue? This is the smallest complete repair: extend both existing signal-trap sets, clear the added trap with its siblings, and retain one regression without changing settlement policy. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against cba7c0ec2ecc. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceTests 0, Docs +3, Other +3. Total +6 across 4 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. LabelsLabel changes:
Label justifications:
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, 1:56 AM ET / 06:56 UTC. |
|
Merged via squash.
|
…er (openclaw#194520) `scripts/pr --help | head -40` closes stderr while a frozen install is still printing. The creator trapped HUP, INT, QUIT, and TERM but not PIPE. Bash 5 died without its EXIT trap; Bash 3.2 ran it from the fatal-signal handler, where bootstrap verification failed and retained the anchor, with the warning lost to the closed pipe. The hold never released, so the installation could never settle or be collected. Handle PIPE like the other signals so retirement runs from an ordinary exit. The exit status stays 141. Repeated hold setup in the cache tests moves to one helper, keeping net test lines at zero.
What Problem This Solves
Fixes:
scripts/prdependency cache entries stay pinned forever when a run's output reader closes early, as inscripts/pr --help 2>&1 | head -40.User Impact
User impact: maintainers and agents can pipe
scripts/prthroughheadwithout permanently pinning a cache installation. The exit status stays 141. Holds that already leaked are not released by this change.Why This Change Was Made
Eviction already works: each materialization keeps the current entry and the four most recently used settled, unheld entries. It never reached these entries because their holds never released.
The creator process trapped HUP, INT, QUIT, and TERM so that anchor retirement runs, but not PIPE. Installs are the case that hits this, because
pnpm installoutput overruns ahead -Nreader before the wrapper's next write. Bash 5 then dies without running its EXIT trap. Bash 3.2 does run it, from the fatal-signal handler, but bootstrap verification fails there and takes the fail-closed retain branch, with its warning lost to the closed pipe.Handling PIPE like the other signals makes retirement run from an ordinary
exit. The collector and its retain-on-uncertainty rules are unchanged.Evidence
mainwith the hold retained andsettled: false, green with this change. Run locally on Bash 3.2; Linux CI covers Bash 5.mainunknown-commandand--help: 0 holds and 0 anchors retained.pr-dependency-cache,pr-materialized-anchor,pr-wrappers): 169 passed, 6 skipped. Test lines net 0, by moving repeated hold setup into one helper.scripts/pr ... | head -N-style commands; the other was not found in logs.Known gaps, not addressed here: