Repository navigation
Description
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):
- Marks the request approved
- Inserts into
agent_sharing - Optionally whitelists the email
- Broadcasts an
agent_sharedWebSocket 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.channelcolumn (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_requestsalready records'telegram' | 'slack' | 'whatsapp' | 'web'(seearchitecture.mdschema) - Proactive send building block:
services/proactive_message_service.pyresolves verified-email → channel binding and dispatches - Channel adapters expose
send_message/ equivalent viaadapters/base.py:ChannelAdapter - Skip notification when
channel == 'web'(web users see the change in the dashboard via the existingagent_sharedWebSocket event) - Don't block the decision response on send — fire-and-forget with audit-logged outcome
Activity
test: snapshot/restore sys.modules in #951 unit test (lint baseline)
feat(sharing): notify requester on channel access-request approval (#951
docs: document v0.6.0 features (avatars, workspace mode, build-info, …
fix(channels): persist proactive messages to channel session history (#…