Skip to content

Node-based terminal manager for AI coding agents — tmux-backed terminals and parallel agent sessions as draggable nodes on an infinite pan/zoom canvas. macOS, Linux, and a browser Server Edition.

fix(agents): idle_prompt notification resurrected NEEDS YOU on finished nodes

enescd5c9361b120
diff --git a/src/shared/agents/normalize.test.ts b/src/shared/agents/normalize.test.ts
index f967eef29..b687635a6 100644
--- a/src/shared/agents/normalize.test.ts
+++ b/src/shared/agents/normalize.test.ts
@@ -86,4 +86,32 @@ describe('normalizeClaude — permission signals', () => {
)
expect(e).toMatchObject({ kind: 'state', state: 'blocked' })
})
+
+ // Claude Code fires an idle_prompt Notification AFTER a turn completes normally (after
+ // Stop). Mapping it to waiting resurrected NEEDS YOU on a finished node and left it
+ // stuck there until the next prompt.
+ it('Notification idle_prompt after Stop does NOT change state', () => {
+ const e = normalizeClaude(
+ env({
+ hook_event_name: 'Notification',
+ notification_type: 'idle_prompt',
+ message: 'Claude is waiting for your input'
+ })
+ )
+ expect(e).toBeNull()
+ })
+
+ it('Notification elicitation_dialog / agent_needs_input → waiting', () => {
+ for (const t of ['elicitation_dialog', 'agent_needs_input']) {
+ const e = normalizeClaude(env({ hook_event_name: 'Notification', notification_type: t }))
+ expect(e).toMatchObject({ kind: 'state', state: 'waiting' })
+ }
+ })
+
+ it('informational / unknown Notification types do not change state', () => {
+ for (const t of ['auth_success', 'elicitation_complete', 'elicitation_response', 'agent_completed', 'something_new', undefined]) {
+ const e = normalizeClaude(env({ hook_event_name: 'Notification', notification_type: t }))
+ expect(e).toBeNull()
+ }
+ })
})
diff --git a/src/shared/agents/normalize.ts b/src/shared/agents/normalize.ts
index a2860f54f..ab0b5b405 100644
--- a/src/shared/agents/normalize.ts
+++ b/src/shared/agents/normalize.ts
@@ -163,8 +163,18 @@ export function normalizeClaude(env: RawHookEnvelope): NormalizedAgentEvent | nu
return { ...base, kind: 'state', state: 'blocked', lastMessage: p.last_assistant_message }
}
if (ev === 'Notification') {
- const state: AgentState = p.notification_type === 'permission_prompt' ? 'blocked' : 'waiting'
- return { ...base, kind: 'state', state, lastMessage: p.last_assistant_message }
+ // Only the types that genuinely need the user flip the state. Everything else —
+ // idle_prompt fires AFTER Stop on a normally-finished turn (mapping it to waiting
+ // stuck NEEDS YOU on done nodes), and auth_success / elicitation_complete /
+ // elicitation_response / agent_completed are informational — must not touch state,
+ // so unknown future types default to no-op rather than a sticky badge.
+ if (p.notification_type === 'permission_prompt') {
+ return { ...base, kind: 'state', state: 'blocked', lastMessage: p.last_assistant_message }
+ }
+ if (p.notification_type === 'elicitation_dialog' || p.notification_type === 'agent_needs_input') {
+ return { ...base, kind: 'state', state: 'waiting', lastMessage: p.last_assistant_message }
+ }
+ return null
}
if (ev === 'SessionStart') return { ...base, kind: 'session', sessionPhase: 'start' }
if (ev === 'SessionEnd') return { ...base, kind: 'session', sessionPhase: 'end' }