From 5ce025fe927904576f2ded1b952324e71a1fd569 Mon Sep 17 00:00:00 2001 From: YeonGyu-Kim Date: Mon, 15 Dec 2025 19:02:31 +0900 Subject: [PATCH] feat(agents): prevent all subagents from accessing background_task tool MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Restrict background_task tool access for all spawned subagents (oracle, explore, librarian, frontend-ui-ux-engineer, document-writer, multimodal-looker) to prevent potential infinite recursion and unintended background task creation. 🤖 GENERATED WITH ASSISTANCE OF [OhMyOpenCode](https://github.com/code-yeongyu/oh-my-opencode) --- src/agents/document-writer.ts | 1 + src/agents/explore.ts | 2 +- src/agents/frontend-ui-ux-engineer.ts | 1 + src/agents/librarian.ts | 2 +- src/agents/multimodal-looker.ts | 2 +- src/agents/oracle.ts | 2 +- 6 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/agents/document-writer.ts b/src/agents/document-writer.ts index b941f54..57e4606 100644 --- a/src/agents/document-writer.ts +++ b/src/agents/document-writer.ts @@ -5,6 +5,7 @@ export const documentWriterAgent: AgentConfig = { "A technical writer who crafts clear, comprehensive documentation. Specializes in README files, API docs, architecture docs, and user guides. MUST BE USED when executing documentation tasks from ai-todo list plans.", mode: "subagent", model: "google/gemini-3-pro-preview", + tools: { background_task: false }, prompt: ` You are a TECHNICAL WRITER with deep engineering background who transforms complex codebases into crystal-clear documentation. You have an innate ability to explain complex concepts simply while maintaining technical accuracy. diff --git a/src/agents/explore.ts b/src/agents/explore.ts index d888306..019294b 100644 --- a/src/agents/explore.ts +++ b/src/agents/explore.ts @@ -6,7 +6,7 @@ export const exploreAgent: AgentConfig = { mode: "subagent", model: "opencode/grok-code", temperature: 0.1, - tools: { write: false, edit: false, bash: true, read: true }, + tools: { write: false, edit: false, bash: true, read: true, background_task: false }, prompt: `You are a file search specialist. You excel at thoroughly navigating and exploring codebases. === CRITICAL: READ-ONLY MODE - NO FILE MODIFICATIONS === diff --git a/src/agents/frontend-ui-ux-engineer.ts b/src/agents/frontend-ui-ux-engineer.ts index f813dcd..32b2aad 100644 --- a/src/agents/frontend-ui-ux-engineer.ts +++ b/src/agents/frontend-ui-ux-engineer.ts @@ -5,6 +5,7 @@ export const frontendUiUxEngineerAgent: AgentConfig = { "A designer-turned-developer who crafts stunning UI/UX even without design mockups. Code may be a bit messy, but the visual output is always fire.", mode: "subagent", model: "google/gemini-3-pro-preview", + tools: { background_task: false }, prompt: ` You are a DESIGNER-TURNED-DEVELOPER with an innate sense of aesthetics and user experience. You have an eye for details that pure developers miss - spacing, color harmony, micro-interactions, and that indefinable "feel" that makes interfaces memorable. diff --git a/src/agents/librarian.ts b/src/agents/librarian.ts index 006f659..c79f823 100644 --- a/src/agents/librarian.ts +++ b/src/agents/librarian.ts @@ -6,7 +6,7 @@ export const librarianAgent: AgentConfig = { mode: "subagent", model: "opencode/big-pickle", temperature: 0.1, - tools: { write: false, edit: false, bash: true, read: true }, + tools: { write: false, edit: false, bash: true, read: true, background_task: false }, prompt: `# THE LIBRARIAN You are **THE LIBRARIAN**, a specialized codebase understanding agent that helps users answer questions about large, complex codebases across repositories. diff --git a/src/agents/multimodal-looker.ts b/src/agents/multimodal-looker.ts index 713f5d3..f1f4abc 100644 --- a/src/agents/multimodal-looker.ts +++ b/src/agents/multimodal-looker.ts @@ -6,7 +6,7 @@ export const multimodalLookerAgent: AgentConfig = { mode: "subagent", model: "google/gemini-2.5-flash", temperature: 0.1, - tools: { Read: true }, + tools: { Read: true, background_task: false }, prompt: `You interpret media files that cannot be read as plain text. Your job: examine the attached file and extract ONLY what was requested. diff --git a/src/agents/oracle.ts b/src/agents/oracle.ts index 1c02db8..240f6fc 100644 --- a/src/agents/oracle.ts +++ b/src/agents/oracle.ts @@ -8,7 +8,7 @@ export const oracleAgent: AgentConfig = { temperature: 0.1, reasoningEffort: "medium", textVerbosity: "high", - tools: { write: false, edit: false, read: true, task: false, call_omo_agent: true }, + tools: { write: false, edit: false, read: true, task: false, call_omo_agent: true, background_task: false }, prompt: `You are a strategic technical advisor with deep reasoning capabilities, operating as a specialized consultant within an AI-assisted development environment. ## Context