fix: inherit parent session tool restrictions in background task notifications

Pass parentTools from session-tools-store through the background task
lifecycle (launch → task → notify) so that when notifyParentSession
sends promptAsync, the original tool restrictions (e.g., question: false)
are preserved. This prevents the Question tool from re-enabling after
call_omo_agent background tasks complete.
This commit is contained in:
YeonGyu-Kim
2026-02-14 14:30:30 +09:00
parent 43cadc95e8
commit a466c2e220
7 changed files with 37 additions and 12 deletions
@@ -5,6 +5,7 @@ import { log } from "../../shared"
import type { CallOmoAgentArgs } from "./types"
import type { ToolContextWithMetadata } from "./tool-context-with-metadata"
import { getMessageDir } from "./message-storage-directory"
import { getSessionTools } from "../../shared/session-tools-store"
export async function executeBackgroundAgent(
args: CallOmoAgentArgs,
@@ -36,6 +37,7 @@ export async function executeBackgroundAgent(
parentSessionID: toolContext.sessionID,
parentMessageID: toolContext.messageID,
parentAgent,
parentTools: getSessionTools(toolContext.sessionID),
})
const waitStart = Date.now()
@@ -5,6 +5,7 @@ import { consumeNewMessages } from "../../shared/session-cursor"
import { findFirstMessageWithAgent, findNearestMessageWithFields } from "../../features/hook-message-injector"
import { getSessionAgent } from "../../features/claude-code-session-state"
import { getMessageDir } from "./message-dir"
import { getSessionTools } from "../../shared/session-tools-store"
export async function executeBackground(
args: CallOmoAgentArgs,
@@ -41,6 +42,7 @@ export async function executeBackground(
parentSessionID: toolContext.sessionID,
parentMessageID: toolContext.messageID,
parentAgent,
parentTools: getSessionTools(toolContext.sessionID),
})
const WAIT_FOR_SESSION_INTERVAL_MS = 50