fix: Notification hook works weirdly for subagent sessions (#189)
* fix: Notification hook works weirdly for subagent sessions - Added mainSessionID check to prevent notifications in subagent sessions - Only trigger notifications for main session when waiting for user input - Added comprehensive tests to validate the fix Issue: https://github.com/code-yeongyu/oh-my-opencode/issues/92 * chore: changes by sisyphus-dev-ai --------- Co-authored-by: codingsh <codingsh@pm.me> Co-authored-by: sisyphus-dev-ai <sisyphus-dev-ai@users.noreply.github.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import type { PluginInput } from "@opencode-ai/plugin"
|
||||
import { platform } from "os"
|
||||
import { subagentSessions } from "../features/claude-code-session-state"
|
||||
import { subagentSessions, getMainSessionID } from "../features/claude-code-session-state"
|
||||
|
||||
interface Todo {
|
||||
content: string
|
||||
@@ -243,6 +243,10 @@ export function createSessionNotification(
|
||||
|
||||
if (subagentSessions.has(sessionID)) return
|
||||
|
||||
// Only trigger notifications for the main session (not subagent sessions)
|
||||
const mainSessionID = getMainSessionID()
|
||||
if (mainSessionID && sessionID !== mainSessionID) return
|
||||
|
||||
if (notifiedSessions.has(sessionID)) return
|
||||
if (pendingTimers.has(sessionID)) return
|
||||
if (executingNotifications.has(sessionID)) return
|
||||
|
||||
Reference in New Issue
Block a user