From 41a318df66c0f6e6e2539cd433bc466b4a4d1346 Mon Sep 17 00:00:00 2001 From: YeonGyu-Kim Date: Sat, 13 Dec 2025 13:36:31 +0900 Subject: [PATCH] fix(background-task): send notification to parent session instead of main session MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 🤖 GENERATED WITH ASSISTANCE OF [OhMyOpenCode](https://github.com/code-yeongyu/oh-my-opencode) --- src/features/background-agent/manager.ts | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/src/features/background-agent/manager.ts b/src/features/background-agent/manager.ts index a98af78..bec6cd1 100644 --- a/src/features/background-agent/manager.ts +++ b/src/features/background-agent/manager.ts @@ -4,7 +4,6 @@ import type { LaunchInput, } from "./types" import { log } from "../../shared/logger" -import { getMainSessionID } from "../claude-code-session-state" type OpencodeClient = PluginInput["client"] @@ -240,25 +239,19 @@ export class BackgroundManager { const message = `[BACKGROUND TASK COMPLETED] Task "${task.description}" finished in ${duration}. Use background_output with task_id="${task.id}" to get results.` - const mainSessionID = getMainSessionID() - if (!mainSessionID) { - log("[background-agent] No main session ID available, relying on pending queue") - return - } - - log("[background-agent] Sending notification to main session:", mainSessionID) + log("[background-agent] Sending notification to parent session:", { parentSessionID: task.parentSessionID }) setTimeout(async () => { try { await this.client.session.prompt({ - path: { id: mainSessionID }, + path: { id: task.parentSessionID }, body: { parts: [{ type: "text", text: message }], }, query: { directory: this.directory }, }) this.clearNotificationsForTask(task.id) - log("[background-agent] Successfully sent prompt to main session") + log("[background-agent] Successfully sent prompt to parent session:", { parentSessionID: task.parentSessionID }) } catch (error) { log("[background-agent] prompt failed:", String(error)) }