fix(notifications): use user-friendly title and dedup keys for permission/question notifications
- Change permission notification title from `req.permission || 'Permission requested'`
to the user-friendly 'Agent needs approval'; permission type + patterns now appear
in the body (e.g. 'bash: echo hello') for context.
- Add `dedupeKey: `perm-${req.id}`` and `dedupeKey: `question-${req.id}``
(60 s cooldown) to both events so a SSE reconnect after disconnect() clears state
can't fire a second notification for the same pending request.
- Fix stale CUA-test comment that claimed 'Agent needs approval' did not exist;
fallback assertion already matched correct title; update the comment to reflect
the real events.ts behavior.
Closes #39
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -269,9 +269,18 @@ export const useEvents = create<EventsState>((set, get) => ({
|
||||
}))
|
||||
notify({
|
||||
category: "permissions",
|
||||
title: req.permission || "Permission requested",
|
||||
body: sanitizeBody(req.patterns?.join(", "), "A tool needs your approval"),
|
||||
title: "Agent needs approval",
|
||||
body: sanitizeBody(
|
||||
req.permission
|
||||
? req.patterns?.length
|
||||
? `${req.permission}: ${req.patterns.join(", ")}`
|
||||
: req.permission
|
||||
: req.patterns?.join(", "),
|
||||
"A tool needs your approval",
|
||||
),
|
||||
sessionId: req.sessionID,
|
||||
dedupeKey: `perm-${req.id}`,
|
||||
dedupeCooldownMs: 60_000,
|
||||
})
|
||||
break
|
||||
}
|
||||
@@ -305,6 +314,8 @@ export const useEvents = create<EventsState>((set, get) => ({
|
||||
title: req.questions?.[0]?.header || "Input needed",
|
||||
body: sanitizeBody(req.questions?.[0]?.question, "The assistant has a question"),
|
||||
sessionId: req.sessionID,
|
||||
dedupeKey: `question-${req.id}`,
|
||||
dedupeCooldownMs: 60_000,
|
||||
})
|
||||
break
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user