[WRONG BRANCH] fix(lab): retain grace period for stale ledger locks - #297
[WRONG BRANCH] fix(lab): retain grace period for stale ledger locks#297luvs01 wants to merge 1 commit into
Conversation
|
Warning Review limit reached
Next review available in: 47 minutes Limit details: You’ve used all 3 included reviews currently available under your plan. Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
Comment |
|
✅ Deterministic PR hygiene checks passed. |
⏳ DRAFT
What to do
Its title has been prefixed with |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9a0fd13ec2
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| return Date.now() - meta.createdAt > LEDGER_LOCK_STALE_MS | ||
| && !isLockHolderAlive(meta.pid); |
There was a problem hiding this comment.
Recover recently orphaned locks without waiting a minute
When a ledger owner crashes or is killed less than 60 seconds after acquiring the lock, this new age condition treats its lock as live even though the PID check would prove the owner is gone. tryAcquireLedgerLock only waits 5 seconds (LEDGER_LOCK_WAIT_MS), so every Lab mutation during the remaining grace period synchronously blocks for five seconds and then fails with EEXIST, preventing experiment results and other ledger updates from being persisted after a normal crash/restart. Preserve the ABA protection by making recovery conditional on the identity of the lock that was inspected, rather than delaying recovery of every dead owner beyond the acquisition deadline.
Useful? React with 👍 / 👎.
Motivation
Description
isLedgerLockStaleinsrc/lab/ledger/store.tsto require that a well-formed lock is both owned by a dead PID and that itscreatedAtis older thanLEDGER_LOCK_STALE_MSbefore it is considered stale.recoverStaleLedgerLockpath intact so stale recovery remains ownership-safe while refusing to reclaim freshly-created locks.tests/lab-ledger-mutation-lock.test.tsto set the lockcreatedAtto older thanLEDGER_LOCK_STALE_MSand rename the test to reflect the aged-lock expectation.fix(lab): retain grace period for stale ledger locks.Testing
bun run typecheckwith no errors.bun run test -- tests/lab-ledger-mutation-lock.test.tsand observed all tests in that file pass (5 passed).git diff --checkand committed the changes locally as described; a full repository test run in this environment was started but large unrelated suites produce long output and were truncated, so only the focused tests were used for verification.Codex Task