From f6bdc45fe71541b30c9a4cc4fb1ed690d5421910 Mon Sep 17 00:00:00 2001 From: YeonGyu-Kim Date: Fri, 12 Dec 2025 11:48:39 +0900 Subject: [PATCH] feat(background-task): disable tools in child sessions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Background task tool이 child session을 생성할 때 background_task, background_output, background_cancel 도구를 자동으로 비활성화합니다. OpenCode Task tool 패턴과 동일하게 무한 재귀 호출을 방지합니다. - manager.ts: promptAsync 호출 시 tools 설정 추가 - index.ts: 불필요한 agent 레벨 disable 설정 제거 (manager에서 처리) - notification: tool calls 카운트 제거 (정확하게 트래킹되지 않음) 🤖 GENERATED WITH ASSISTANCE OF [OhMyOpenCode](https://github.com/code-yeongyu/oh-my-opencode) --- src/features/background-agent/manager.ts | 8 ++++++-- src/index.ts | 2 -- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/features/background-agent/manager.ts b/src/features/background-agent/manager.ts index 075c5ff..51acedb 100644 --- a/src/features/background-agent/manager.ts +++ b/src/features/background-agent/manager.ts @@ -77,6 +77,11 @@ export class BackgroundManager { path: { id: sessionID }, body: { agent: input.agent, + tools: { + background_task: false, + background_output: false, + background_cancel: false, + }, parts: [{ type: "text", text: input.prompt }], }, }).catch((error) => { @@ -215,7 +220,6 @@ export class BackgroundManager { private notifyParentSession(task: BackgroundTask): void { const duration = this.formatDuration(task.startedAt, task.completedAt) - const toolCalls = task.progress?.toolCalls ?? 0 log("[background-agent] notifyParentSession called for task:", task.id) @@ -232,7 +236,7 @@ export class BackgroundManager { }).catch(() => {}) } - const message = `[BACKGROUND TASK COMPLETED] Task "${task.description}" finished in ${duration} (${toolCalls} tool calls). Use background_output with task_id="${task.id}" to get results.` + 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) { diff --git a/src/index.ts b/src/index.ts index 28d882c..a69fc6a 100644 --- a/src/index.ts +++ b/src/index.ts @@ -206,14 +206,12 @@ const OhMyOpenCodePlugin: Plugin = async (ctx) => { config.agent.explore.tools = { ...config.agent.explore.tools, omo_task: false, - background_task: false, }; } if (config.agent.librarian) { config.agent.librarian.tools = { ...config.agent.librarian.tools, omo_task: false, - background_task: false, }; }