fix(continuation): mark resumes synthetic

This commit is contained in:
YeonGyu-Kim
2026-05-13 13:09:12 +09:00
parent 3f92264311
commit 38b1433ff5
6 changed files with 90 additions and 10 deletions
@@ -46,7 +46,14 @@ describe("injectContinuation", () => {
test("inherits tools from resolved message info when reinjecting", async () => {
// given
let capturedTools: Record<string, boolean> | undefined
let capturedText: string | undefined
let capturedPart:
| {
text: string
synthetic?: boolean
metadata?: Record<string, unknown>
}
| undefined
let capturedNoReply: boolean | undefined
const ctx = {
directory: "/tmp/test",
client: {
@@ -55,11 +62,18 @@ describe("injectContinuation", () => {
promptAsync: async (input: {
body: {
tools?: Record<string, boolean>
parts?: Array<{ type: string; text: string }>
noReply?: boolean
parts?: Array<{
type: string
text: string
synthetic?: boolean
metadata?: Record<string, unknown>
}>
}
}) => {
capturedTools = input.body.tools
capturedText = input.body.parts?.[0]?.text
capturedNoReply = input.body.noReply
capturedPart = input.body.parts?.[0]
return {}
},
},
@@ -83,7 +97,10 @@ describe("injectContinuation", () => {
// then
expect(capturedTools).toEqual({ question: false, bash: true })
expect(capturedText).toContain(OMO_INTERNAL_INITIATOR_MARKER)
expect(capturedNoReply).toBeUndefined()
expect(capturedPart?.text).toContain(OMO_INTERNAL_INITIATOR_MARKER)
expect(capturedPart?.synthetic).toBe(true)
expect(capturedPart?.metadata?.compaction_continue).toBe(true)
})
test("skips injection when agent is plan (prevents Plan Mode infinite loop)", async () => {
@@ -6,7 +6,7 @@ import {
resolveRegisteredAgentName,
} from "../../features/claude-code-session-state"
import {
createInternalAgentTextPart,
createInternalAgentContinuationTextPart,
normalizeSDKResponse,
resolveInheritedPromptTools,
} from "../../shared"
@@ -191,7 +191,7 @@ ${todoList}`
...(launchModel ? { model: launchModel } : {}),
...(launchVariant ? { variant: launchVariant } : {}),
...(inheritedTools ? { tools: inheritedTools } : {}),
parts: [createInternalAgentTextPart(prompt)],
parts: [createInternalAgentContinuationTextPart(prompt)],
},
query: { directory: ctx.directory },
})