Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion packages/opencode/src/plugin/github-copilot/copilot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
4 changes: 4 additions & 0 deletions packages/opencode/src/session/compaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down
1 change: 1 addition & 0 deletions packages/opencode/test/session/compaction.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
Loading