Repository navigation
perf: reuse owned directory identity during cleanup - #760
Conversation
|
🦞👀 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: blocked before merge. Reviewed September 30, 2026, 8:24 PM ET / October 1, 2026, 00:24 UTC (Revision 6). ClawSweeper reviewWhat this changesThe branch reuses an open child directory’s captured identity during Linux and macOS bounded cleanup, adds a replacement-race regression test, and records the optimization in the changelog. Merge readiness⛔ Blocked before merge - 3 items remain Current main still performs the extra descriptor metadata read, so this PR remains useful. The code review found no blocking defect, but the declared async depth-64 performance limit still needs a recorded disposition. Priority: P2 Review scores
Verification
How this fits togetherTemporary-workspace cleanup passes retained directory handles to native bounded cleanup. Native code traverses descendants through opened handles, checks each name before removal, and returns a removal result or error to the JavaScript caller. flowchart LR
A[Temporary workspace cleanup] --> B[Retained directory handles]
B --> C[Native bounded traversal]
C --> D[Open child and capture identity]
D --> E[Traverse descendants]
E --> F{Child name still matches?}
F -- Yes --> G[Remove directory]
F -- No --> H[Report mismatch]
Decision needed
Why: The safety and syscall evidence supports the code change, but accepting or resolving the predeclared performance limit is a maintainer choice. Before merge
Agent review detailsSecurityNone. Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep the captured-descriptor identity and fresh no-follow name check, then land the optimization once the declared performance limit has an explicit, recorded disposition. Do we have a high-confidence way to reproduce the issue? Not applicable as a bug reproduction. The PR provides installed-package cleanup measurements and syscall observations for its performance claim. Is this the best way to solve the issue? Yes for code scope: the open descriptor supplies stable identity while a fresh no-follow name check still gates removal. The declared performance limit needs a recorded disposition. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 678401b6f906. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (5 earlier review cycles)
|
|
The coordinator has reviewed this diff and lifted the performance hold. |
1ea38bb to
aac046c
Compare
aac046c to
6816230
Compare
Bounded native directory cleanup repeats
fstaton each already-opened descendant solely for its unchanged type, device and inode. Reuse those captured facts while retaining the fresh no-follow pathname check immediately before removal. This removes nine production code lines and one metadata syscall per successfully traversed descendant. The child remains owned throughout recursion; root descriptor rechecks, Linux mount fences, macOS mount checks and unlink handling remain intact. Removing the syscall also removes its distinct possible late operational-error observation.Held as a draft: the fixed Linux installed-package comparison does not exclude a material regression for asynchronous depth-64 cleanup. Its 95% upper ratio bound is 1.1343, exceeding the predeclared 1.10 limit. This is uncertainty, not an established repeatable slowdown. The complete measurements are retained; there was no measurement retry, exclusion or threshold change.
Each of two independently built and installed artifacts ran two warmup pairs and twenty measured pairs per workload, four cleanups per sample, with balanced A/B order. Setup and syscall tracing were outside timed regions. Results use the geometric mean of paired ratios and a fixed 10,000-draw paired bootstrap on Linux x64, Node 24.21.0, on a 16-vCPU AWS runner. There is no macOS timing claim.
Correctness and mechanism validation passed: thirteen related Rust tests on each implementation, including the new post-descent replacement regression; 175 focused TypeScript tests with zero skips; installed async/sync symlink and public-name replacement safety, descriptor cleanup, and real
openat2ENOSYS/EPERM refusal. Eight syscall traces show exactly 128 or 64 fewer descriptor stats with all other traced filesystem counts and mount flags unchanged. Both macOS native CI jobs ran and passed the new regression and quarantine-swap proof. Independent review passed through P2, andgit diff --checkpassed.CI run: the initial run had one Windows Node 22 package-smoke failure reporting only exit code 1. The single failed job passed one retry on the unchanged commit; CI is now green. The original failure is retained and its cause remains unclassified. The performance hold remains regardless of CI outcome.