Skip to content

Notify requester on approval of channel access request #951

Closed

Description

@vybe

Summary

When a pending access request is approved via POST /api/agents/{name}/access-requests/{id}/decide, the approving owner sees the action complete, but the requesting user is never notified on the channel they used. They have no signal that they can now message the agent — they have to guess and retry. Confirmed broken on Telegram; status on Slack and WhatsApp unknown but likely the same gap.

Context

The #311 Unified Channel Access Control flow upserts a pending access_requests row when a verified-email user without sharing tries to chat an agent on Telegram / Slack / WhatsApp, and the user is told "🔒 Your access request is pending approval." (src/backend/adapters/message_router.py:426).

On approval the endpoint (src/backend/routers/sharing.py:229-258):

  1. Marks the request approved
  2. Inserts into agent_sharing
  3. Optionally whitelists the email
  4. Broadcasts an agent_shared WebSocket event for the dashboard

It does not send a proactive message back to the requester on the originating channel. Result: the user who asked for access is left waiting indefinitely with no callback, even though they're now allowed.

There is already a proactive messaging primitive (services/proactive_message_service.py, routers/messages.py, #321) that can target a verified email — so the building block exists. The decision endpoint just isn't using it.

Acceptance Criteria

  • On approval, the requester receives a message on the channel they originated the request from (Telegram / Slack / WhatsApp) telling them they can now chat the agent
  • Rejection does not notify the requester (deliberate — owners may not want to confirm the agent exists)
  • If the user has chat links on multiple channels, prefer the channel recorded on the access_requests.channel column (the one they actually asked from)
  • If the channel binding/transport is unavailable at decision time, the approval still succeeds (notification is best-effort, not blocking)
  • Audit log records whether the post-approval notification was delivered, skipped, or failed
  • Manual test path documented for each of Telegram, Slack, WhatsApp

Technical Notes

  • Decision endpoint: src/backend/routers/sharing.py:208-274
  • Channel column on access_requests already records 'telegram' | 'slack' | 'whatsapp' | 'web' (see architecture.md schema)
  • Proactive send building block: services/proactive_message_service.py resolves verified-email → channel binding and dispatches
  • Channel adapters expose send_message / equivalent via adapters/base.py:ChannelAdapter
  • Skip notification when channel == 'web' (web users see the change in the dashboard via the existing agent_shared WebSocket event)
  • Don't block the decision response on send — fire-and-forget with audit-logged outcome

Activity

  1. self-assigned this
    on May 29, 2026
  2. added a commit that references this issue on May 29, 2026
  3. added
    theme-channels
    status-in-dev
    on Jun 3, 2026
  4. removed
    status-in-dev
    on Aug 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

priority-p2theme-channelstype-bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions