Skip to content

Commit eb41ddf

Browse files
committed
Fix notifications not firing for PermissionRequest waiting states
The NOTIFY_TOOLS whitelist in checkAndNotify only included interactive tools (ExitPlanMode, AskUserQuestion, Write, Edit, NotebookEdit), so PermissionRequest events for tools like Bash never triggered browser notifications despite correctly showing "waiting" status. Removed the NOTIFY_TOOLS filter since the state machine already correctly determines when user input is needed. Fixes #51
1 parent 45eeef0 commit eb41ddf

2 files changed

Lines changed: 5 additions & 7 deletions

File tree

src/dashboard.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,10 @@ describe("getDashboardHtml", () => {
5858
assert.ok(html.includes("claude-waiting-"));
5959
});
6060

61-
it("only notifies for interactive tools, not Bash", () => {
62-
assert.ok(html.includes("NOTIFY_TOOLS"));
63-
assert.ok(html.includes("NOTIFY_TOOLS[s.lastEvent]"));
64-
assert.ok(html.includes("AskUserQuestion"));
61+
it("notifies for all waiting status transitions", () => {
62+
assert.ok(html.includes("s.status === 'waiting'"));
63+
assert.ok(html.includes("previousStatuses[s.sessionId] !== 'waiting'"));
64+
assert.ok(!html.includes("NOTIFY_TOOLS"));
6565
});
6666

6767
it("contains Stop and Restart buttons", () => {

src/dashboard.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -516,8 +516,6 @@ export function getDashboardHtml(): string {
516516
517517
var STATUS_LABELS = { running: 'Running', waiting: 'Waiting for input', done: 'Done' };
518518
var STATUS_ORDER = { running: 0, waiting: 1, done: 2 };
519-
var NOTIFY_TOOLS = { ExitPlanMode: 1, AskUserQuestion: 1, Write: 1, Edit: 1, NotebookEdit: 1 };
520-
521519
function timeAgo(ts) {
522520
var diff = Math.floor((Date.now() - ts) / 1000);
523521
if (diff < 5) return 'just now';
@@ -583,7 +581,7 @@ export function getDashboardHtml(): string {
583581
}
584582
if (notificationsEnabled && 'Notification' in window && Notification.permission === 'granted') {
585583
newSessions.forEach(function(s) {
586-
if (s.status === 'waiting' && previousStatuses[s.sessionId] !== 'waiting' && NOTIFY_TOOLS[s.lastEvent]) {
584+
if (s.status === 'waiting' && previousStatuses[s.sessionId] !== 'waiting') {
587585
new Notification('Claude Code - Waiting for input', {
588586
body: folderName(s.cwd),
589587
tag: 'claude-waiting-' + s.sessionId

0 commit comments

Comments
 (0)