fix(copilot): mark internal hook injections as agent-initiated

Apply the internal initiator marker to automated continuation, recovery, babysitter, stop-hook, and hook-message injections so Copilot attribution consistently sets x-initiator=agent for system-generated prompts.
This commit is contained in:
Maxim Harizanov
2026-02-18 21:54:20 +02:00
parent a85f7efb1d
commit 850fb0378e
10 changed files with 39 additions and 15 deletions
@@ -1,7 +1,7 @@
import type { PluginInput } from "@opencode-ai/plugin"
import type { BackgroundManager } from "../../features/background-agent"
import { log } from "../../shared/logger"
import { resolveInheritedPromptTools } from "../../shared"
import { createInternalAgentTextPart, resolveInheritedPromptTools } from "../../shared"
import { HOOK_NAME } from "./hook-name"
import { BOULDER_CONTINUATION_PROMPT } from "./system-reminder-templates"
import { resolveRecentPromptContextForSession } from "./recent-model-resolver"
@@ -53,7 +53,7 @@ export async function injectBoulderContinuation(input: {
agent: agent ?? "atlas",
...(promptContext.model !== undefined ? { model: promptContext.model } : {}),
...(inheritedTools ? { tools: inheritedTools } : {}),
parts: [{ type: "text", text: prompt }],
parts: [createInternalAgentTextPart(prompt)],
},
query: { directory: ctx.directory },
})