fix(copilot): mark internal background notifications as agent-initiated

This commit is contained in:
Maxim Harizanov
2026-02-18 19:55:36 +02:00
parent 11d41d3bdd
commit dcfe72e989
7 changed files with 179 additions and 4 deletions
+2 -1
View File
@@ -13,6 +13,7 @@ import {
normalizeSDKResponse,
promptWithModelSuggestionRetry,
resolveInheritedPromptTools,
createInternalAgentTextPart,
} from "../../shared"
import { setSessionTools } from "../../shared/session-tools-store"
import { ConcurrencyManager } from "./concurrency"
@@ -1311,7 +1312,7 @@ Use \`background_output(task_id="${task.id}")\` to retrieve this result when rea
...(agent !== undefined ? { agent } : {}),
...(model !== undefined ? { model } : {}),
...(tools ? { tools } : {}),
parts: [{ type: "text", text: notification }],
parts: [createInternalAgentTextPart(notification)],
},
})
log("[background-agent] Sent notification to parent session:", {
@@ -1,7 +1,7 @@
import type { BackgroundTask } from "./types"
import type { ResultHandlerContext } from "./result-handler-context"
import { TASK_CLEANUP_DELAY_MS } from "./constants"
import { log } from "../../shared"
import { createInternalAgentTextPart, log } from "../../shared"
import { getTaskToastManager } from "../task-toast-manager"
import { formatDuration } from "./duration-formatter"
import { buildBackgroundTaskNotificationText } from "./background-task-notification-template"
@@ -72,7 +72,7 @@ export async function notifyParentSession(
...(agent !== undefined ? { agent } : {}),
...(model !== undefined ? { model } : {}),
...(tools ? { tools } : {}),
parts: [{ type: "text", text: notification }],
parts: [createInternalAgentTextPart(notification)],
},
})