From b984bfd9f3d2e424a626285019b20d7fcb081c3d Mon Sep 17 00:00:00 2001 From: YeonGyu-Kim Date: Tue, 16 Dec 2025 23:01:48 +0900 Subject: [PATCH] fix(session-notification): skip notification for subagent sessions (#70) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Import subagentSessions from claude-code-session-state in both manager.ts and session-notification.ts - Add sessionID to subagentSessions Set when creating background task session - Remove sessionID from subagentSessions when background task session is deleted - Check if session is in subagentSessions before triggering notification Fixes #70: Notification hook no longer triggers for subagent idle events 🤖 Generated with assistance of [OhMyOpenCode](https://github.com/code-yeongyu/oh-my-opencode) --- src/features/background-agent/manager.ts | 3 +++ src/hooks/session-notification.ts | 3 +++ 2 files changed, 6 insertions(+) diff --git a/src/features/background-agent/manager.ts b/src/features/background-agent/manager.ts index 5282c99..bf0678e 100644 --- a/src/features/background-agent/manager.ts +++ b/src/features/background-agent/manager.ts @@ -10,6 +10,7 @@ import { findNearestMessageWithFields, MESSAGE_STORAGE, } from "../hook-message-injector" +import { subagentSessions } from "../claude-code-session-state" type OpencodeClient = PluginInput["client"] @@ -82,6 +83,7 @@ export class BackgroundManager { } const sessionID = createResult.data.id + subagentSessions.add(sessionID) const task: BackgroundTask = { id: `bg_${crypto.randomUUID().slice(0, 8)}`, @@ -236,6 +238,7 @@ export class BackgroundManager { this.tasks.delete(task.id) this.clearNotificationsForTask(task.id) + subagentSessions.delete(sessionID) } } diff --git a/src/hooks/session-notification.ts b/src/hooks/session-notification.ts index d9ff5a8..04acc59 100644 --- a/src/hooks/session-notification.ts +++ b/src/hooks/session-notification.ts @@ -1,5 +1,6 @@ import type { PluginInput } from "@opencode-ai/plugin" import { platform } from "os" +import { subagentSessions } from "../features/claude-code-session-state" interface Todo { content: string @@ -219,6 +220,8 @@ export function createSessionNotification( const sessionID = props?.sessionID as string | undefined if (!sessionID) return + if (subagentSessions.has(sessionID)) return + if (notifiedSessions.has(sessionID)) return if (pendingTimers.has(sessionID)) return