fix(plugin): cover Anthropic-family prefill guard

Include Vertex Anthropic in the assistant-tail prefill guard after Cubic flagged the strict provider check. Keep the non-Anthropic opencode negative control covered by tests.

Plan: plans/fix-anthropic-assistant-prefill-tail.md
This commit is contained in:
YeonGyu-Kim
2026-05-19 12:33:22 +09:00
parent 45d670a7dc
commit 5f0e037dae
2 changed files with 46 additions and 2 deletions
+41
View File
@@ -328,6 +328,47 @@ describe("createMessagesTransformHandler", () => {
})
})
it("#given an Anthropic-family provider history ends with a rejecting assistant tail #when messages transform runs #then it appends a synthetic user recovery turn", async () => {
//#given
const messages: TestMessage[] = [
{
info: {
id: "msg_user_vertex_anthropic",
role: "user",
sessionID: "ses_vertex_anthropic",
agent: "sisyphus",
model: { providerID: "google-vertex-anthropic", modelID: "claude-opus-4-7" },
},
parts: [{ type: "text", text: "continue" }],
},
{
info: {
id: "msg_assistant_vertex_anthropic",
role: "assistant",
sessionID: "ses_vertex_anthropic",
},
parts: [{ type: "text", text: "done" }],
},
]
//#when
await runHandler(makeHooks({}), messages)
//#then
expect(messages).toHaveLength(3)
expect(messages.at(-1)?.info).toMatchObject({
role: "user",
sessionID: "ses_vertex_anthropic",
agent: "sisyphus",
model: { providerID: "google-vertex-anthropic", modelID: "claude-opus-4-7" },
})
expect(messages.at(-1)?.parts[0]).toMatchObject({
type: "text",
text: "[internal] Continue from the previous assistant state.",
synthetic: true,
})
})
it("#given rejecting model metadata uses direct provider and model fields #when messages transform runs #then it appends a synthetic user recovery turn", async () => {
//#given
const messages: TestMessage[] = [