Skip to content

Commit b5ae14d

Browse files
authored
test(qa): use canonical exact marker in Telegram recovery (#133098)
1 parent 5553615 commit b5ae14d

2 files changed

Lines changed: 71 additions & 57 deletions

File tree

‎extensions/qa-lab/src/providers/mock-openai/server.test.ts‎

Lines changed: 70 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ const QA_EMPTY_RESPONSE_RECOVERY_PROMPT =
4141
const QA_EMPTY_RESPONSE_EXHAUSTION_PROMPT =
4242
"Empty response exhaustion QA check: read QA_KICKOFF_TASK.md, then answer with exactly EMPTY-EXHAUSTED-OK.";
4343
const QA_EMPTY_RESPONSE_SIDE_EFFECT_RECOVERY_PROMPT =
44-
"Empty response after write recovery QA check: write qa-empty-response-side-effect.txt, then answer with exactly TELEGRAM-EMPTY-WRITE-RECOVERED-OK.";
44+
"Empty response after write recovery QA check: write qa-empty-response-side-effect.txt, then reply with exact marker: `TELEGRAM-EMPTY-WRITE-RECOVERED-OK`.";
4545
const QA_ANTHROPIC_THINKING_ERROR_RECOVERY_PROMPT =
4646
"Anthropic thinking error QA check: read QA_KICKOFF_TASK.md, then answer with exactly ANTHROPIC-THINKING-ERROR-RECOVERED-OK.";
4747
const QA_REASONING_ONLY_RETRY_INSTRUCTION =
@@ -8251,66 +8251,80 @@ Update and merge these partial structured summaries.`,
82518251
expect(secondEmpty.output?.[0]?.content?.[0]?.text).toBe("");
82528252
});
82538253

8254-
it("scripts settled continuation after an empty response from a side-effecting write", async () => {
8255-
const server = await startMockServer();
8254+
it.each([
8255+
{ history: "fresh", precedingInput: [] },
8256+
{
8257+
history: "earlier reply directive",
8258+
precedingInput: [makeUserInput("Earlier check: exact marker: `PREVIOUS-SCENARIO-OK`.")],
8259+
},
8260+
])(
8261+
"scripts settled continuation after a side-effecting write with $history",
8262+
async ({ precedingInput }) => {
8263+
const server = await startMockServer();
82568264

8257-
const toolPlan = await expectOpenAiStreamingResponsesText(server, {
8258-
input: [makeUserInput(QA_EMPTY_RESPONSE_SIDE_EFFECT_RECOVERY_PROMPT)],
8259-
});
8260-
expect(toolPlan).toContain('"name":"write"');
8265+
const toolPlan = await expectOpenAiStreamingResponsesText(server, {
8266+
input: [...precedingInput, makeUserInput(QA_EMPTY_RESPONSE_SIDE_EFFECT_RECOVERY_PROMPT)],
8267+
});
8268+
expect(toolPlan).toContain('"name":"write"');
82618269

8262-
const toolOutput = {
8263-
type: "function_call_output" as const,
8264-
output: "Successfully wrote 27 bytes to qa-empty-response-side-effect.txt",
8265-
};
8266-
const emptyPayload = await expectOpenAiNonStreamingResponsesJson<{
8267-
output?: Array<{ content?: Array<{ text?: string }> }>;
8268-
}>(server, {
8269-
input: [makeUserInput(QA_EMPTY_RESPONSE_SIDE_EFFECT_RECOVERY_PROMPT), toolOutput],
8270-
});
8271-
expect(emptyPayload.output?.[0]?.content?.[0]?.text).toBe("");
8270+
const toolOutput = {
8271+
type: "function_call_output" as const,
8272+
output: "Successfully wrote 27 bytes to qa-empty-response-side-effect.txt",
8273+
};
8274+
const emptyPayload = await expectOpenAiNonStreamingResponsesJson<{
8275+
output?: Array<{ content?: Array<{ text?: string }> }>;
8276+
}>(server, {
8277+
input: [
8278+
...precedingInput,
8279+
makeUserInput(QA_EMPTY_RESPONSE_SIDE_EFFECT_RECOVERY_PROMPT),
8280+
toolOutput,
8281+
],
8282+
});
8283+
expect(emptyPayload.output?.[0]?.content?.[0]?.text).toBe("");
82728284

8273-
const recoveredPayload = await expectOpenAiNonStreamingResponsesJson<{
8274-
output?: Array<{ content?: Array<{ text?: string }> }>;
8275-
}>(server, {
8276-
input: [
8277-
makeUserInput(QA_EMPTY_RESPONSE_SIDE_EFFECT_RECOVERY_PROMPT),
8278-
makeUserInput(QA_SETTLED_TOOL_TERMINAL_CONTINUATION_INSTRUCTION),
8279-
toolOutput,
8280-
],
8281-
});
8282-
expect(outputText(recoveredPayload)).toBe("TELEGRAM-EMPTY-WRITE-RECOVERED-OK");
8285+
const recoveredPayload = await expectOpenAiNonStreamingResponsesJson<{
8286+
output?: Array<{ content?: Array<{ text?: string }> }>;
8287+
}>(server, {
8288+
input: [
8289+
...precedingInput,
8290+
makeUserInput(QA_EMPTY_RESPONSE_SIDE_EFFECT_RECOVERY_PROMPT),
8291+
makeUserInput(QA_SETTLED_TOOL_TERMINAL_CONTINUATION_INSTRUCTION),
8292+
toolOutput,
8293+
],
8294+
});
8295+
expect(outputText(recoveredPayload)).toBe("TELEGRAM-EMPTY-WRITE-RECOVERED-OK");
82838296

8284-
const cronRecoveredPayload = await expectOpenAiNonStreamingResponsesJson<{
8285-
output?: Array<{ content?: Array<{ text?: string }> }>;
8286-
}>(server, {
8287-
input: [
8288-
makeUserInput(
8289-
[
8290-
"Empty response after write recovery QA check: write once, then respond with exact marker: `CRON-EMPTY-WRITE-RECOVERED-OK`.",
8291-
"This is an unattended scheduled run. If nothing needs doing, reply exactly HEARTBEAT_OK.",
8292-
].join("\n\n"),
8293-
),
8294-
makeUserInput(
8295-
`${QA_SETTLED_TOOL_TERMINAL_CONTINUATION_INSTRUCTION}\nRead HEARTBEAT.md if it exists.`,
8296-
),
8297-
toolOutput,
8298-
],
8299-
});
8300-
expect(outputText(cronRecoveredPayload)).toBe("CRON-EMPTY-WRITE-RECOVERED-OK");
8297+
const cronRecoveredPayload = await expectOpenAiNonStreamingResponsesJson<{
8298+
output?: Array<{ content?: Array<{ text?: string }> }>;
8299+
}>(server, {
8300+
input: [
8301+
makeUserInput(
8302+
[
8303+
"Empty response after write recovery QA check: write once, then respond with exact marker: `CRON-EMPTY-WRITE-RECOVERED-OK`.",
8304+
"This is an unattended scheduled run. If nothing needs doing, reply exactly HEARTBEAT_OK.",
8305+
].join("\n\n"),
8306+
),
8307+
makeUserInput(
8308+
`${QA_SETTLED_TOOL_TERMINAL_CONTINUATION_INSTRUCTION}\nRead HEARTBEAT.md if it exists.`,
8309+
),
8310+
toolOutput,
8311+
],
8312+
});
8313+
expect(outputText(cronRecoveredPayload)).toBe("CRON-EMPTY-WRITE-RECOVERED-OK");
83018314

8302-
const laterHeartbeatPayload = await expectOpenAiNonStreamingResponsesJson<{
8303-
output?: Array<{ content?: Array<{ text?: string }> }>;
8304-
}>(server, {
8305-
input: [
8306-
makeUserInput(QA_EMPTY_RESPONSE_SIDE_EFFECT_RECOVERY_PROMPT),
8307-
makeUserInput(QA_SETTLED_TOOL_TERMINAL_CONTINUATION_INSTRUCTION),
8308-
toolOutput,
8309-
makeUserInput("Read HEARTBEAT.md if it exists."),
8310-
],
8311-
});
8312-
expect(outputText(laterHeartbeatPayload)).toBe("HEARTBEAT_OK");
8313-
});
8315+
const laterHeartbeatPayload = await expectOpenAiNonStreamingResponsesJson<{
8316+
output?: Array<{ content?: Array<{ text?: string }> }>;
8317+
}>(server, {
8318+
input: [
8319+
makeUserInput(QA_EMPTY_RESPONSE_SIDE_EFFECT_RECOVERY_PROMPT),
8320+
makeUserInput(QA_SETTLED_TOOL_TERMINAL_CONTINUATION_INSTRUCTION),
8321+
toolOutput,
8322+
makeUserInput("Read HEARTBEAT.md if it exists."),
8323+
],
8324+
});
8325+
expect(outputText(laterHeartbeatPayload)).toBe("HEARTBEAT_OK");
8326+
},
8327+
);
83148328

83158329
it("reports a failed Code Mode read honestly through ordinary continuation", async () => {
83168330
const server = await startMockServer();

‎qa/scenarios/channels/telegram-empty-response-after-write-recovery.yaml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ flow:
4747
conversation: { id: telegram-command-room, kind: channel }
4848
senderId: qa-command-operator
4949
senderName: QA Command Operator
50-
text: "@openclaw Empty response after write recovery QA check: write qa-empty-response-side-effect.txt with the text side effect completed once, then answer exactly TELEGRAM-EMPTY-WRITE-RECOVERED-OK."
50+
text: "@openclaw Empty response after write recovery QA check: write qa-empty-response-side-effect.txt with the text side effect completed once, then reply with exact marker: `TELEGRAM-EMPTY-WRITE-RECOVERED-OK`."
5151
- waitForOutbound:
5252
conversation: { id: telegram-command-room, kind: channel }
5353
sinceIndex: { ref: startIndex }

0 commit comments

Comments
 (0)