



















@@ -1059,6 +1059,89 @@ describe("qa mock openai server", () => {
10591059expect(finalBody).not.toContain("sent successfully");
10601060});
106110611062+it("reports personal failure recovery with a retry boundary", async () => {
1063+const server = await startQaMockOpenAiServer({
1064+host: "127.0.0.1",
1065+port: 0,
1066+});
1067+cleanups.push(async () => {
1068+await server.stop();
1069+});
1070+1071+const prompt =
1072+"Personal failure recovery check. Read FAILURE_RECOVERY_REQUEST.md and FAILURE_RECOVERY_EVIDENCE.md first. Then write ./personal-failure-recovery.txt with Completed, Failed step, Retry boundary, and Next step.";
1073+1074+const first = await fetch(`${server.baseUrl}/v1/responses`, {
1075+method: "POST",
1076+headers: { "content-type": "application/json" },
1077+body: JSON.stringify({
1078+stream: true,
1079+model: "gpt-5.5",
1080+input: [{ role: "user", content: [{ type: "input_text", text: prompt }] }],
1081+}),
1082+});
1083+expect(first.status).toBe(200);
1084+const firstBody = await first.text();
1085+expect(firstBody).toContain('"arguments":"{\\"path\\":\\"FAILURE_RECOVERY_REQUEST.md\\"}"');
1086+expect(firstBody).not.toContain("fully complete");
1087+1088+const writePlan = await fetch(`${server.baseUrl}/v1/responses`, {
1089+method: "POST",
1090+headers: { "content-type": "application/json" },
1091+body: JSON.stringify({
1092+stream: true,
1093+model: "gpt-5.5",
1094+input: [
1095+{ role: "user", content: [{ type: "input_text", text: prompt }] },
1096+{
1097+type: "function_call_output",
1098+output:
1099+"# Failure recovery request\n\nRequired contract:\n1. Read FAILURE_RECOVERY_REQUEST.md.\n2. Read FAILURE_RECOVERY_EVIDENCE.md.\n3. Write ./personal-failure-recovery.txt.\n",
1100+},
1101+{
1102+role: "user",
1103+content: [
1104+{
1105+type: "input_text",
1106+text: "# Failure recovery evidence\n\nCompleted: request reviewed and local evidence captured.\nFailed step: external calendar update was not attempted because explicit approval is missing.\nRetry boundary: do not retry the external step until approval is given.\nNext step: ask for approval before any external update.\n",
1107+},
1108+],
1109+},
1110+],
1111+}),
1112+});
1113+1114+expect(writePlan.status).toBe(200);
1115+const writeBody = await writePlan.text();
1116+expect(writeBody).toContain('"name":"write"');
1117+expect(writeBody).toContain("personal-failure-recovery.txt");
1118+expect(writeBody).toContain("Retry boundary: do not retry");
1119+expect(writeBody).not.toContain("retry succeeded");
1120+1121+const final = await fetch(`${server.baseUrl}/v1/responses`, {
1122+method: "POST",
1123+headers: { "content-type": "application/json" },
1124+body: JSON.stringify({
1125+stream: true,
1126+model: "gpt-5.5",
1127+input: [
1128+{ role: "user", content: [{ type: "input_text", text: prompt }] },
1129+{
1130+type: "function_call_output",
1131+output:
1132+"Successfully wrote personal-failure-recovery.txt with the failed step and retry boundary.",
1133+},
1134+],
1135+}),
1136+});
1137+1138+expect(final.status).toBe(200);
1139+const finalBody = await final.text();
1140+expect(finalBody).toContain("PERSONAL-FAILURE-RECOVERY-OK");
1141+expect(finalBody).toContain("Retry boundary: do not retry");
1142+expect(finalBody).not.toContain("fully complete");
1143+});
1144+10621145it("drives the compaction retry mutating tool parity flow", async () => {
10631146const server = await startQaMockOpenAiServer({
10641147host: "127.0.0.1",
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。