fix: avoid unrelated macOS OAuth local-lock collisions - #266
Conversation
|
Warning Review limit reachedYou’ve reached a temporary PR review limit under our Fair Usage Limits Policy. Next review available in: 5 minutes 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: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughmacOS OAuth local-lock acquisition now derives bounded deterministic fallback TCP endpoints, probes them after unrelated legacy-port collisions, preserves same-key and older-version coordination, and fails closed for ambiguous listeners. Tests cover collisions, fallback success, serialization, and holder detection. ChangesmacOS OAuth lock fallback
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant OAuthOperation
participant acquireLocalLock
participant inspectLocalLockEndpoint
participant tryAcquireMacOSFallback
OAuthOperation->>acquireLocalLock: request lock
acquireLocalLock->>inspectLocalLockEndpoint: inspect canonical endpoint
inspectLocalLockEndpoint-->>acquireLocalLock: unrelated occupied state
acquireLocalLock->>tryAcquireMacOSFallback: probe deterministic fallbacks
tryAcquireMacOSFallback->>inspectLocalLockEndpoint: inspect fallback endpoints
inspectLocalLockEndpoint-->>tryAcquireMacOSFallback: endpoint states
tryAcquireMacOSFallback-->>acquireLocalLock: acquired fallback
acquireLocalLock-->>OAuthOperation: release function
Possibly related PRs
Poem
Caution Pre-merge checks failedPlease resolve all errors before merging. Addressing warnings is optional.
❌ Failed checks (1 error)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/oauth/local-lock.ts`:
- Around line 7-9: Export macOSFallbackCandidateCount from
src/oauth/local-lock.ts as the shared source of truth. In
tests/oauth-local-lock.test.ts, import that symbol and replace the hardcoded 7
used as the loop bound; no direct changes are needed elsewhere.
- Around line 168-186: Update tryAcquireMacOSFallback to inspect all endpoints
concurrently, such as by collecting the inspectLocalLockEndpoint results with
Promise.all, while preserving the full-scan semantics: any “held” or “unknown”
result must return undefined, “occupied” candidates must be skipped, and the
first available endpoint must remain the selected candidate for
tryAcquireLocalLock.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 15231118-d2ad-4717-9360-0d3a7f5f80a1
📒 Files selected for processing (2)
src/oauth/local-lock.tstests/oauth-local-lock.test.ts
cc14ec0 to
9c4bf75
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/oauth/local-lock.ts`:
- Around line 211-218: Update the local-lock acquisition loop around
canUseMacOSFallback and the primary tryAcquireLocalLock call so an occupied
legacy endpoint with an available macOS fallback skips the doomed legacy bind
and proceeds directly to fallback scanning. Preserve the existing primary
acquisition behavior for all other endpoint states and platforms.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 4fe30311-92a5-4c3a-8df3-09e1f87e141a
📒 Files selected for processing (2)
src/oauth/local-lock.tstests/oauth-local-lock.test.ts
9c4bf75 to
599c855
Compare
|
Addressed the remaining CodeRabbit thread in e734176: when the canonical macOS legacy endpoint is positively identified as unrelated and occupied, Miftah now goes directly to the deterministic fallback scan. The focused regression failed before this change and passes after it; full tests, coverage, lint, typecheck, build, CLI smoke, and package validation are green locally. |
|
Review-gate exception, documented before dismissal: CodeRabbit's current-head check for e734176 explicitly reports Review rate limited, so it cannot produce a new decision for this final commit. All three CodeRabbit threads are resolved, including the final occupied-legacy-bind regression. The full current-head matrix is green: Linux, macOS, Windows 20/22/24, Linux quality, and Verify. Dismissing only the two stale CodeRabbit change requests from earlier commits under the repository's documented rate-limit exception. |
All associated threads are resolved; current-head CodeRabbit review is rate-limited.
Summary
Security and compatibility
Closes #264
Validation
Summary by CodeRabbit