fix(core): propagate subagent context to policy engine (#22086)

This commit is contained in:
N. Taylor Mullen
2026-03-11 16:01:45 -07:00
committed by GitHub
parent 1a7f50661a
commit 4a6d1fad9d
6 changed files with 44 additions and 1 deletions
@@ -19,6 +19,8 @@ import type { EditorType } from '../utils/editor.js';
export interface AgentSchedulingOptions {
/** The unique ID for this agent's scheduler. */
schedulerId: string;
/** The name of the subagent. */
subagent?: string;
/** The ID of the tool call that invoked this agent. */
parentCallId?: string;
/** The tool registry specific to this agent. */
@@ -46,6 +48,7 @@ export async function scheduleAgentTools(
): Promise<CompletedToolCall[]> {
const {
schedulerId,
subagent,
parentCallId,
toolRegistry,
signal,
@@ -69,6 +72,7 @@ export async function scheduleAgentTools(
messageBus: toolRegistry.getMessageBus(),
getPreferredEditor: getPreferredEditor ?? (() => undefined),
schedulerId,
subagent,
parentCallId,
onWaitingForConfirmation,
});
@@ -1099,6 +1099,7 @@ export class LocalAgentExecutor<TOutput extends z.ZodTypeAny> {
toolRequests,
{
schedulerId: this.agentId,
subagent: this.definition.name,
parentCallId: this.parentCallId,
toolRegistry: this.toolRegistry,
signal,