Skip to content

Commit f540bc5

Browse files
committed
add payload final-answer regression test
1 parent 91266fa commit f540bc5

1 file changed

Lines changed: 32 additions & 0 deletions

File tree

‎src/agents/pi-embedded-runner/run/payloads.test.ts‎

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,38 @@ describe("buildEmbeddedRunPayloads tool-error warnings", () => {
6767
expectSinglePayloadText(payloads, "Done.");
6868
});
6969

70+
it("uses final-answer assistant text when one accumulated text includes commentary", () => {
71+
const payloads = buildPayloads({
72+
assistantTexts: ["Need inspect.\n\nDone."],
73+
lastAssistant: {
74+
role: "assistant",
75+
stopReason: "stop",
76+
content: [
77+
{
78+
type: "text",
79+
text: "Need inspect.",
80+
textSignature: JSON.stringify({
81+
v: 1,
82+
id: "item_commentary",
83+
phase: "commentary",
84+
}),
85+
},
86+
{
87+
type: "text",
88+
text: "Done.",
89+
textSignature: JSON.stringify({
90+
v: 1,
91+
id: "item_final",
92+
phase: "final_answer",
93+
}),
94+
},
95+
],
96+
} as AssistantMessage,
97+
});
98+
99+
expectSinglePayloadText(payloads, "Done.");
100+
});
101+
70102
it("falls back to final-answer assistant text when streamed text only contains blanks", () => {
71103
const payloads = buildPayloads({
72104
assistantTexts: [" "],

0 commit comments

Comments
 (0)