Skip to content

fix(review): release lease after close race - #163

Merged
777genius merged 1 commit into
mainfrom
fix/release-post-acquire-lease
Aug 15, 2026
Merged

fix(review): release lease after close race#163
777genius merged 1 commit into
mainfrom
fix/release-post-acquire-lease

Conversation

@777genius

@777genius 777genius commented Aug 15, 2026

Copy link
Copy Markdown
Owner

A pull request can close while the invocation lease acquire request is still in flight. The post-acquire revision check then cancels the review before provider execution, but previously skipped lease cleanup and blocked the provider lane until TTL expiry.

This change releases the acquired lease when any post-acquire revision check or progress event fails. The regression test reproduces closure after acquisition and verifies one release, no provider invocation, and a cancelled outcome.

E2E evidence: PadelApp PR #669 closed during review; PR #670 immediately afterward exhausted as required_provider_lane_busy because the late third lease remained active.

Summary by CodeRabbit

  • Bug Fixes
    • Improved review orchestration reliability when a pull request closes during lease acquisition.
    • Ensured acquired leases are released exactly once when validation or event reporting fails.
    • Prevented review providers from being invoked for cancelled reviews.
  • Tests
    • Added regression coverage for concurrent lease acquisition and pull-request closure.

@coderabbitai

coderabbitai Bot commented Aug 15, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: f7879cf6-3c68-4623-9aa2-30fbee9d4d4b

📥 Commits

Reviewing files that changed from the base of the PR and between f453b33 and 9147d06.

⛔ Files ignored due to path filters (2)
  • dist/index.js is excluded by !**/dist/**
  • dist/index.js.map is excluded by !**/dist/**, !**/*.map
📒 Files selected for processing (2)
  • __tests__/unit/review-orchestration/run-t0-review-orchestration.test.ts
  • src/review-orchestration/application/run-t0-review-orchestration.ts

📝 Walkthrough

Walkthrough

The orchestration now releases an acquired invocation lease when event reporting or revision validation fails. A regression test covers concurrent pull-request closure and confirms cancellation, single lease release, and no provider invocation.

Changes

Invocation lease cleanup

Layer / File(s) Summary
Post-acquisition lease failure handling
src/review-orchestration/application/run-t0-review-orchestration.ts, __tests__/unit/review-orchestration/run-t0-review-orchestration.test.ts
The orchestration releases the lease before rethrowing reporting or validation errors. The test covers cancellation during concurrent pull-request closure and verifies that the provider is not invoked.
Estimated code review effort: 2 (Simple) ~10 minutes

Merge Risk: ⚪ Minimal · up to 9147d

The change releases a review lease when closure occurs during acquisition, preventing the provider lane from remaining blocked until lease expiry; no actionable merge-blocking risk remains.

Possibly related PRs

Poem

A lease was caught in a closing PR,
The rabbit checked the gate ajar.
It freed the lease, skipped provider flight,
And marked the review cancelled right.
Clean paws, clear path, hop hop hooray!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: releasing the lease after a pull request close race.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/release-post-acquire-lease

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@777genius
777genius merged commit 3618a43 into main Aug 15, 2026
3 checks passed
@777genius
777genius deleted the fix/release-post-acquire-lease branch August 15, 2026 05:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant