Repository navigation
fix(lock): age the admitted sidecar snapshot during contention - #1045
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 SummaryThis 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 makes async lock stale detection use the admitted record’s timestamp instead of looking up its pathname again. Example: A Root-backed lock contains {"owner":"original"}, omits createdAt, and has staleMs set to 60000; its owner releases after the waiter reads it.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this maintainer-authored PR fixes a source-confirmed contention race still present on main and in v0.26.13; no actionable patch defect was found. Priority: P2 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherThe sidecar lock layer accepts target paths, optional Root capabilities, and lock policies, then reads ownership records and either retries exclusive creation or performs separately authorized stale recovery. flowchart TD
A[Lock acquisition] --> B[Exclusive sidecar creation]
B --> C[Read admitted snapshot on contention]
C --> D[Age captured timestamp]
D --> E[Retry exclusive creation]
D --> F[Confirm identity and authorize stale recovery]
Technical reviewBest possible solution: Use the existing snapshot-age algorithm for both lock routes while retaining strict confirmation and separately authorized removal. Do we have a high-confidence way to reproduce the issue? The released source shows the extra pathname stat and catch-to-stale path, and the deterministic regression supplies the two-handoff schedule; the author reports failure on base and success on head, but no target code was executed during this review. Is this the best way to solve the issue? This is a focused root-cause repair: age the record already admitted rather than consult a pathname that may identify another owner, reusing the synchronous implementation without relaxing Root errors. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 4362e5695886. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Review metrics
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 October 27, 2026, 4:41 PM ET / 20:41 UTC. |
Async Root-backed lock acquisition can reject with
path-mismatchduring an ordinary owner handoff when the payload omitscreatedAt. After reading an admitted snapshot, the async default stale policy stats its pathname again. A release in that gap producesENOENT, incorrectly classifies the fresh record as stale, and enters a strict confirmation read that can race another release/re-create.Use the admitted snapshot's timestamp, sharing the existing synchronous policy: valid
createdAttakes precedence, otherwise use the captured modification time. The normal retry budget still governs contention. Exact identity checks, symlink/hardlink rejection, Root/ancestor validation, strict confirmation reads, and owner/reclamation authorization remain unchanged.The deterministic regression uses real lock handles to release the sampled owner, return the real missing-path result from the historical timestamp lookup, and release/recreate a successor at the strict read's final fence. It fails on unchanged main with
path-mismatchand passes with this fix. The test is also included in native-required Root admission CI. Changelog and lock documentation are updated.Validation:
path-mismatch; 46 focused tests pass after the fix.pnpm check: lint, build, allocator artifact, and documentation examples pass. Local broad tests encounter temp-workspace refusals because the external scratch volume has a group-writable ancestor without sticky protection, plus watcher event/timing failures. A narrow unchanged-main control reproduces the temp/corpus and watcher failures; the volume permissions are unchanged. Local packaging also lacks the .NET-built Windows helper. Clean-runner exact-head CI supplies the broad/package gates.Initial head
e99c4b3bpassed all CI, including Intel native-required proof. Main then advanced with #1044, so the branch now includes that change atfa4ed81223f2d93df651e5ec3cd69395f51f6f23. The integrated head passes 106 native-required focused tests and another 4,000/4,000 contention acquisitions; the regression also fails on the updated main base and passes on the integrated head. Final exact-head CI is green: 49 successful checks and 8 intentional skips. The final Intel native-required job confirms darwin/x64, Node 24.22.1, native require, all four cases at 100/100 and the new regression passing. Two successful Intel runs across the two heads; zero manual reruns. SHA-pinned squash merge:dc034469e1114aa784e74e71b3e9892a37f58bdb.