Skip to content

fix(notifications): show approve/deny for scope-request notifications in bell#2107

Open
hognek wants to merge 2 commits into
jaylfc:devfrom
hognek:fix/notification-centre-scope-requests
Open

fix(notifications): show approve/deny for scope-request notifications in bell#2107
hognek wants to merge 2 commits into
jaylfc:devfrom
hognek:fix/notification-centre-scope-requests

Conversation

@hognek

@hognek hognek commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Fixes scope-request notification UI gap from #1921.

Problem

PR #1921 (agent scope-requests) emits notifications with source: "agent_scope_requests", but NotificationCentre and NotificationToast only render ConsentActions (approve/deny buttons) for source === "auth_requests". Scope-request approve/deny was invisible in the UI — approving required hand-rolled curl.

Fix

  • Branch the source check in NotificationCentre.tsx and NotificationToast.tsx to also match "agent_scope_requests"
  • ConsentActions accepts optional source (defaults to "auth_requests") and canonicalId props; routes approve/deny to the scope-request endpoints (/api/agents/registry/{id}/scope-requests/{req_id}/approve|deny) when source is "agent_scope_requests"
  • consentPayload() extracts canonical_id from notification data for scope-request endpoint path construction
  • Backward compatible: existing callers (DecisionsApp, existing tests) continue to work with source="auth_requests" default

Files

  • desktop/src/components/ConsentActions.tsx — added source/canonicalId props + URL branching + consentPayload canonicalId extraction
  • desktop/src/components/NotificationCentre.tsx — branched source check + passes source/canonicalId
  • desktop/src/components/NotificationToast.tsx — same

Tests

  • npm run build passes (tsc + vite build)
  • vitest run ConsentActions.test.tsx — 7/7 pass (backward compatibility confirmed)

Ref: #1921 — PR adding scope-request flow

Summary by CodeRabbit

  • New Features
    • Added support for approving or denying agent scope requests from notifications and toast messages.
    • Consent actions now handle additional request metadata to route decisions correctly.
    • Expanded consent information to include canonical request identifiers.

…s in bell and toast

PR jaylfc#1921 (agent scope-requests) emits notifications with source
'agent_scope_requests' but NotificationCentre and NotificationToast
only rendered ConsentActions for source === 'auth_requests'. Scope-
request approve/deny was invisible in the UI.

- Branch source check in NotificationCentre and NotificationToast to
  also accept 'agent_scope_requests'
- ConsentActions now accepts optional source + canonicalId props and
  routes approve/deny to the scope-request endpoints when source is
  'agent_scope_requests' (/api/agents/registry/{id}/scope-requests/...)
- consentPayload() extracts canonical_id from notification data for
  the scope-request endpoint path
- Backward compatible: source defaults to 'auth_requests' for existing
  callers (DecisionsApp, tests)

Ref: jaylfc#1921
@hognek
hognek marked this pull request as ready for review July 22, 2026 15:59
@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@hognek, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 52 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 998784e0-96c0-40af-9b9b-40500a46f3bf

📥 Commits

Reviewing files that changed from the base of the PR and between ebd1834 and de9d6e8.

📒 Files selected for processing (1)
  • desktop/src/components/ConsentActions.tsx
📝 Walkthrough

Walkthrough

Consent notifications now recognize agent_scope_requests, propagate source and canonicalId, and route approve/deny actions through registry scope-request endpoints while preserving existing auth-request routing.

Changes

Consent scope-request flow

Layer / File(s) Summary
Consent metadata and notification propagation
desktop/src/components/ConsentActions.tsx, desktop/src/components/NotificationCentre.tsx, desktop/src/components/NotificationToast.tsx
consentPayload extracts canonical_id; notification centre and toast flows recognize agent scope requests and pass consent metadata to ConsentActions.
Approve/deny endpoint routing
desktop/src/components/ConsentActions.tsx
Agent scope requests use registry scope-request routes built from canonicalId or requestId, while other requests retain auth-request routes.

Estimated code review effort: 2 (Simple) | ~10 minutes

Sequence Diagram(s)

sequenceDiagram
  participant NotificationCentre
  participant NotificationToast
  participant ConsentActions
  participant ConsentAPI
  NotificationCentre->>ConsentActions: pass source and canonicalId
  NotificationToast->>ConsentActions: pass source and canonicalId
  ConsentActions->>ConsentAPI: approve or deny using selected endpoint
Loading

Possibly related PRs

Suggested reviewers: jaylfc

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
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.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: adding approve/deny actions for scope-request notifications in the bell UI.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@gitar-bot

gitar-bot Bot commented Jul 22, 2026

Copy link
Copy Markdown

Gitar is working

Gitar

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 `@desktop/src/components/ConsentActions.tsx`:
- Around line 140-143: Update the URL construction and action handling in
ConsentActions so agent_scope_requests requires a non-empty canonicalId before
proceeding; reject or disable the approval/denial action when it is missing, and
never substitute requestId for the registry path segment. Preserve the
requestId-based URL behavior for auth requests only.
🪄 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: CHILL

Plan: Pro Plus

Run ID: a4ecf06d-cfbe-4167-a84b-c208adc2bf2b

📥 Commits

Reviewing files that changed from the base of the PR and between 8a8b6cb and ebd1834.

📒 Files selected for processing (3)
  • desktop/src/components/ConsentActions.tsx
  • desktop/src/components/NotificationCentre.tsx
  • desktop/src/components/NotificationToast.tsx

Comment thread desktop/src/components/ConsentActions.tsx
Per CodeRabbit review: the canonicalId ?? requestId fallback could produce
malformed URLs like /registry/{requestId}/scope-requests/... when
canonical_id is missing from the notification data. Now explicitly
rejects scope-request approve/deny with a clear error when the
canonicalId is absent.
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