diff options
| author | Aiden Cline <[email protected]> | 2026-03-14 10:46:24 -0500 |
|---|---|---|
| committer | GitHub <[email protected]> | 2026-03-14 10:46:24 -0500 |
| commit | 88226f30610d6038a431796a8ae5917199d49c74 (patch) | |
| tree | ec7ed908a4272a26035f0560ab72945c1a20ffa1 | |
| parent | 8c53b2b47033c579b46b02b1ba9638004de0154f (diff) | |
| download | opencode-88226f30610d6038a431796a8ae5917199d49c74.tar.gz opencode-88226f30610d6038a431796a8ae5917199d49c74.zip | |
tweak: ensure that compaction message is tracked as agent initiated (#17431)
| -rw-r--r-- | packages/opencode/src/plugin/copilot.ts | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/packages/opencode/src/plugin/copilot.ts b/packages/opencode/src/plugin/copilot.ts index 3945c63ce..ddb4d9046 100644 --- a/packages/opencode/src/plugin/copilot.ts +++ b/packages/opencode/src/plugin/copilot.ts @@ -309,6 +309,24 @@ export async function CopilotAuthPlugin(input: PluginInput): Promise<Hooks> { output.headers["anthropic-beta"] = "interleaved-thinking-2025-05-14" } + const parts = await sdk.session + .message({ + path: { + id: incoming.message.sessionID, + messageID: incoming.message.id, + }, + query: { + directory: input.directory, + }, + throwOnError: true, + }) + .catch(() => undefined) + + if (parts?.data.parts?.some((part) => part.type === "compaction")) { + output.headers["x-initiator"] = "agent" + return + } + const session = await sdk.session .get({ path: { |
