fix(continuation): mark fallback resumes synthetic

This commit is contained in:
YeonGyu-Kim
2026-05-13 13:36:25 +09:00
parent 1189b96d42
commit 36f51ddb16
3 changed files with 60 additions and 8 deletions
@@ -18,14 +18,26 @@ function setupConnectedProviderCacheMocks(): void {
type PromptBody = {
path: { id: string }
body: {
parts: Array<{ type: "text"; text: string }>
parts: Array<{
type: "text"
text: string
synthetic?: boolean
metadata?: Record<string, unknown>
}>
agent?: string
model?: { providerID: string; modelID: string }
variant?: string
noReply?: boolean
}
query: { directory: string }
}
function expectSyntheticContinuation(body: PromptBody["body"]): void {
expect(body.noReply).toBeUndefined()
expect(body.parts[0]?.synthetic).toBe(true)
expect(body.parts[0]?.metadata?.compaction_continue).toBe(true)
}
describe("createEventHandler - model-fallback auto-continuation pins agent/model/variant", () => {
const createHandler = (args?: {
hooks?: any
@@ -127,6 +139,7 @@ describe("createEventHandler - model-fallback auto-continuation pins agent/model
providerID: "anthropic",
modelID: "claude-opus-4-7",
})
expectSyntheticContinuation(body)
})
test("pins agent/model on promptAsync body when continuing after session.error fallback", async () => {
@@ -167,6 +180,7 @@ describe("createEventHandler - model-fallback auto-continuation pins agent/model
providerID: "anthropic",
modelID: "claude-opus-4-7",
})
expectSyntheticContinuation(body)
})
test("pins agent/model on fallback prompt() body when promptAsync is not available (session.status)", async () => {
@@ -223,6 +237,7 @@ describe("createEventHandler - model-fallback auto-continuation pins agent/model
providerID: "anthropic",
modelID: "claude-opus-4-7",
})
expectSyntheticContinuation(body)
})
test("pins variant from agent config when present", async () => {
@@ -268,5 +283,6 @@ describe("createEventHandler - model-fallback auto-continuation pins agent/model
expect(promptAsyncBodies.length).toBe(1)
const body = promptAsyncBodies[0]!.body
expect(body.variant).toBe("thinking")
expectSyntheticContinuation(body)
})
})