test(e2e): tag the mock Responses preamble with its wire phase

The mock streamed pre-tool assistant text on the Responses path without `phase: "commentary"`, the field the API sets and the transport reads, so the draft-proof scenario ran green while never exercising the preamble lane on that transport. Proven live on Telegram: the preamble now renders as the status headline, and as a commentary line when progress.commentary is on.
This commit is contained in:
Ayaan Zaidi
2026-07-30 16:34:38 +09:00
committed by GitHub
parent 2c436594de
commit 4bd56b8ad8

View File

@@ -149,6 +149,9 @@ function buildMockFunctionCall(name, args) {
// commentary, which channels render as the draft's status headline. Streaming
// text and then a call in one response is the only way to exercise
// headline-plus-tool-line composition without a live model.
// The Responses API carries that tag as `phase` on the message item, and the
// transport reads it straight off the item, so an untagged item produces no
// preamble at all and the scenario silently proves nothing.
function preambleThenToolCallEvents(preamble, name, args) {
const messageItemId = "msg_e2e_preamble";
const call = buildMockFunctionCall(name, args);
@@ -184,6 +187,7 @@ function preambleThenToolCallEvents(preamble, name, args) {
id: messageItemId,
role: "assistant",
status: "completed",
phase: "commentary",
content: [{ type: "output_text", text: preamble, annotations: [] }],
},
},
@@ -210,6 +214,7 @@ function preambleThenToolCallEvents(preamble, name, args) {
id: messageItemId,
role: "assistant",
status: "completed",
phase: "commentary",
content: [{ type: "output_text", text: preamble, annotations: [] }],
},
call.item,