Repository navigation
Fix permission notifications after auto-allow - #3924
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…-notifications-after-autoallow
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughFeedCoordinator posts native permission-request notifications only while the request's waiter remains unresolved; notifications are cancelled on resolution or timeout. A DEBUG-only FeedCoordinatorTestHooks and isAwaitingDecision(requestId:) gate posting. A private notification extension handles authorization, policy evaluation, delivery, and cancellation. Tests updated to verify behavior. ChangesNotification Eligibility and Conditional Posting
Sequence Diagram(s)sequenceDiagram
participant Client
participant FeedCoordinator
participant MainActorStore
participant PIDWatcher
participant UNUserNotificationCenter
Client->>FeedCoordinator: trigger PermissionRequest event
FeedCoordinator->>MainActorStore: ingest(event)
FeedCoordinator->>PIDWatcher: armWatcher(requestId)
FeedCoordinator->>UNUserNotificationCenter: postNotificationIfStillAwaiting(requestId) (auth & policy checks)
alt permission resolves before display
Client->>FeedCoordinator: deliverReply(requestId, decision)
FeedCoordinator->>UNUserNotificationCenter: cancelNotification(requestId)
else still awaiting
UNUserNotificationCenter-->>Client: show banner
Client->>FeedCoordinator: deliverReply(requestId, decision) (later)
FeedCoordinator->>UNUserNotificationCenter: cancelNotification(requestId)
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Poem
Caution Pre-merge checks failedPlease resolve all errors before merging. Addressing warnings is optional.
❌ Failed checks (2 errors, 1 warning)
✅ Passed checks (12 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
Greptile SummaryThis PR fixes stale native Feed notification banners appearing after a blocking permission request has already been auto-resolved, by gating every step of the notification pipeline on a waiter-backed
Confidence Score: 5/5Safe to merge — all notification paths are now correctly gated on waiter state and the race between auto-allow and banner display is closed. The waiter-backed No files require special attention. Important Files Changed
Reviews (23): Last reviewed commit: "Merge remote-tracking branch 'origin/mai..." | Re-trigger Greptile |
…-notifications-after-autoallow
…-notifications-after-autoallow
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 `@Sources/Feed/FeedCoordinator.swift`:
- Around line 414-521: The DEBUG test-observer is currently invoked before the
NSApp.isActive early return, causing tests to observe notifications that
production would suppress; move the MainActor.assumeIsolated block that reads
FeedCoordinatorTestHooks.notificationPostObserver so it runs after the
NSApp.isActive check (inside postNotificationIfStillAwaiting) and still returns
early when the observer handles the event, or alternatively add a clear comment
on FeedCoordinatorTestHooks.notificationPostObserver documenting that observers
are invoked regardless of app focus. Ensure you update the code path around
postNotificationIfStillAwaiting, the MainActor.assumeIsolated call, and the
FeedCoordinatorTestHooks.notificationPostObserver usage so test behavior matches
production gating by NSApp.isActive.
🪄 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: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: cbbce97c-f618-439e-a143-ba8bc43b099c
📒 Files selected for processing (1)
Sources/Feed/FeedCoordinator.swift
…-notifications-after-autoallow
…-notifications-after-autoallow
|
@coderabbitai review\n\nThe prior actionable feedback about FeedCoordinatorTestHooks.notificationPostObserver running before the NSApp.isActive gate is addressed in 975182e: the observer now runs after the app-focus early return in postNotificationIfStillAwaiting. |
|
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit c351823. Configure here.
|
@coderabbitai review Latest review follow-up is in 1864d62: add failures now use the same waiter-gated fallback path as other fallback cases, preserving sound and command effects while avoiding stale resolved-request effects. |
|
✅ Actions performedReview triggered.
|
Dismissed as stale: current head moves the DEBUG notificationPostObserver after the app-active gate, and the corresponding inline thread is resolved/confirmed addressed.
…-notifications-after-autoallow
…-notifications-after-autoallow
…-notifications-after-autoallow
…-notifications-after-autoallow
…-notifications-after-autoallow

Summary
Closes #3702
Testing
Note
Medium Risk
Touches blocking hook wait/notification flow and asynchronous UNUserNotificationCenter delivery, which can regress user-visible notifications and cleanup timing if waiter state or cancellation is wrong.
Overview
Prevents native Feed notification banners from appearing after a blocking request has already been auto-resolved (or timed out) by gating all notification posting/delivery/fallback effects on a new waiter-backed
isAwaitingDecisioncheck and re-checking after policy-hook authorization/evaluation and notification-center callbacks.Adds explicit cleanup by calling
cancelNotification(requestId:)on reply and on ingest completion/timeout, refactors the notification pipeline intopostNotificationIfStillAwaiting/deliverFeedNotificationIfStillAwaiting/addNotificationIfStillAwaiting, and adds DEBUG test hooks plus a regression test ensuring auto-allowed permissions do not post notifications.Reviewed by Cursor Bugbot for commit 0841a38. Bugbot is set up for automated code reviews on this repo. Configure here.
Summary by cubic
Prevents stale native Feed banners after auto-allow by gating all notification steps on waiter state and canceling pending/delivered notifications on resolve, reply, or timeout; addresses #3702.
Bug Fixes
isAwaitingDecision; skip when app is active (DEBUG override).Refactors
postNotificationIfStillAwaiting,deliverFeedNotificationIfStillAwaiting,addNotificationIfStillAwaiting,runFallbackEffectsIfStillAwaiting,cancelNotification, andisAwaitingDecision.afterBlockingEventIngested,isAppActiveOverride,notificationPostObserver) and a regression test with teardown reset.Written for commit 0841a38. Summary will update on new commits. Review in cubic
Summary by CodeRabbit
Bug Fixes
New Features
Tests