fix(qa): align mock model-switch continuity

This commit is contained in:
Vincent Koc
2026-04-07 11:03:22 +01:00
committed by Peter Steinberger
parent 9a106f7e3c
commit f9f38a48e6
2 changed files with 52 additions and 3 deletions

View File

@@ -425,6 +425,55 @@ describe("qa mock openai server", () => {
expect(await response.text()).toContain('"name":"read"');
});
it("returns continuity language after the model-switch reread completes", async () => {
const server = await startQaMockOpenAiServer({
host: "127.0.0.1",
port: 0,
});
cleanups.push(async () => {
await server.stop();
});
const response = await fetch(`${server.baseUrl}/v1/responses`, {
method: "POST",
headers: {
"content-type": "application/json",
},
body: JSON.stringify({
stream: false,
model: "gpt-5.4-alt",
input: [
{
role: "user",
content: [
{
type: "input_text",
text: "Switch models now. Tool continuity check: reread QA_KICKOFF_TASK.md and mention the handoff in one short sentence.",
},
],
},
{
type: "function_call_output",
output: "QA mission: Understand this OpenClaw repo from source + docs before acting.",
},
],
}),
});
expect(response.status).toBe(200);
expect(await response.json()).toMatchObject({
output: [
{
content: [
{
text: expect.stringContaining("model switch handoff confirmed"),
},
],
},
],
});
});
it("returns NO_REPLY for unmentioned group chatter", async () => {
const server = await startQaMockOpenAiServer({
host: "127.0.0.1",

View File

@@ -328,12 +328,12 @@ function buildAssistantText(input: ResponsesInputItem[], body: Record<string, un
if (/memory tools check/i.test(prompt) && orbitCode) {
return `Protocol note: I checked memory and the project codename is ${orbitCode}.`;
}
if (/tool continuity check/i.test(prompt) && toolOutput) {
return `Protocol note: model switch handoff confirmed on ${model || "the requested model"}. QA mission from QA_KICKOFF_TASK.md still applies: understand this OpenClaw repo from source + docs before acting.`;
}
if (/switch(?:ing)? models?/i.test(prompt)) {
return `Protocol note: model switch acknowledged. Continuing on ${model || "the requested model"}.`;
}
if (/tool continuity check/i.test(prompt) && toolOutput) {
return `Protocol note: model switch acknowledged. Tool continuity held on ${model || "the requested model"}.`;
}
if (/image generation check/i.test(prompt) && mediaPath) {
return `Protocol note: generated the QA lighthouse image successfully.\nMEDIA:${mediaPath}`;
}