summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAiden Cline <[email protected]>2026-04-15 15:50:33 -0500
committerGitHub <[email protected]>2026-04-15 15:50:33 -0500
commite83b22159d0c6b393acf9b04fdd6798397bb782d (patch)
tree02af39b724b94b52452a93834e9cc5e0fcb55db8
parent348a84969de64cc1623d8ddcf73336b449c5b1f5 (diff)
downloadopencode-e83b22159d0c6b393acf9b04fdd6798397bb782d.tar.gz
opencode-e83b22159d0c6b393acf9b04fdd6798397bb782d.zip
tweak: ensure auto continuing compaction is tracked as agent initiated for github copilot (#22567)
Co-authored-by: opencode-agent[bot] <opencode-agent[bot]@users.noreply.github.com>
-rw-r--r--packages/opencode/src/plugin/github-copilot/copilot.ts10
-rw-r--r--packages/opencode/src/session/compaction.ts4
-rw-r--r--packages/opencode/test/session/compaction.test.ts1
3 files changed, 14 insertions, 1 deletions
diff --git a/packages/opencode/src/plugin/github-copilot/copilot.ts b/packages/opencode/src/plugin/github-copilot/copilot.ts
index ac685f74d..e12d182e4 100644
--- a/packages/opencode/src/plugin/github-copilot/copilot.ts
+++ b/packages/opencode/src/plugin/github-copilot/copilot.ts
@@ -355,7 +355,15 @@ export async function CopilotAuthPlugin(input: PluginInput): Promise<Hooks> {
})
.catch(() => undefined)
- if (parts?.data.parts?.some((part) => part.type === "compaction")) {
+ if (
+ parts?.data.parts?.some(
+ (part) =>
+ part.type === "compaction" ||
+ // Auto-compaction resumes via a synthetic user text part. Treat only
+ // that marked followup as agent-initiated so manual prompts stay user-initiated.
+ (part.type === "text" && part.synthetic && part.metadata?.compaction_continue === true),
+ )
+ ) {
output.headers["x-initiator"] = "agent"
return
}
diff --git a/packages/opencode/src/session/compaction.ts b/packages/opencode/src/session/compaction.ts
index de0f8d078..4978ef547 100644
--- a/packages/opencode/src/session/compaction.ts
+++ b/packages/opencode/src/session/compaction.ts
@@ -345,6 +345,10 @@ When constructing the summary, try to stick to this template:
messageID: continueMsg.id,
sessionID: input.sessionID,
type: "text",
+ // Internal marker for auto-compaction followups so provider plugins
+ // can distinguish them from manual post-compaction user prompts.
+ // This is not a stable plugin contract and may change or disappear.
+ metadata: { compaction_continue: true },
synthetic: true,
text,
time: {
diff --git a/packages/opencode/test/session/compaction.test.ts b/packages/opencode/test/session/compaction.test.ts
index ddfe85911..251447762 100644
--- a/packages/opencode/test/session/compaction.test.ts
+++ b/packages/opencode/test/session/compaction.test.ts
@@ -843,6 +843,7 @@ describe("session.compaction.process", () => {
expect(last?.parts[0]).toMatchObject({
type: "text",
synthetic: true,
+ metadata: { compaction_continue: true },
})
if (last?.parts[0]?.type === "text") {
expect(last.parts[0].text).toContain("Continue if you have next steps")