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
@@ -5,7 +5,7 @@ import { MESSAGE_STORAGE, PART_STORAGE } from "./constants"
import type { MessageMeta, OriginalMessageContext, TextPart, ToolPermission } from "./types"
import { log } from "../../shared/logger"
import { isSqliteBackend } from "../../shared/opencode-storage-detection"
import { normalizeSDKResponse } from "../../shared"
import { createInternalAgentTextPart, normalizeSDKResponse } from "../../shared"
export interface StoredMessage {
agent?: string
@@ -331,7 +331,7 @@ export function injectHookMessage(
const textPart: TextPart = {
id: partID,
type: "text",
text: hookContent,
text: createInternalAgentTextPart(hookContent).text,
synthetic: true,
time: {
start: now,