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>
This commit is contained in:
@@ -355,7 +355,15 @@ export async function CopilotAuthPlugin(input: PluginInput): Promise<Hooks> {
|
|||||||
})
|
})
|
||||||
.catch(() => undefined)
|
.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"
|
output.headers["x-initiator"] = "agent"
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -345,6 +345,10 @@ When constructing the summary, try to stick to this template:
|
|||||||
messageID: continueMsg.id,
|
messageID: continueMsg.id,
|
||||||
sessionID: input.sessionID,
|
sessionID: input.sessionID,
|
||||||
type: "text",
|
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,
|
synthetic: true,
|
||||||
text,
|
text,
|
||||||
time: {
|
time: {
|
||||||
|
|||||||
@@ -843,6 +843,7 @@ describe("session.compaction.process", () => {
|
|||||||
expect(last?.parts[0]).toMatchObject({
|
expect(last?.parts[0]).toMatchObject({
|
||||||
type: "text",
|
type: "text",
|
||||||
synthetic: true,
|
synthetic: true,
|
||||||
|
metadata: { compaction_continue: true },
|
||||||
})
|
})
|
||||||
if (last?.parts[0]?.type === "text") {
|
if (last?.parts[0]?.type === "text") {
|
||||||
expect(last.parts[0].text).toContain("Continue if you have next steps")
|
expect(last.parts[0].text).toContain("Continue if you have next steps")
|
||||||
|
|||||||
Reference in New Issue
Block a user