fix(FN-4092): address step 2 review feedback

Fusion-Task-Id: FN-4092
Fusion-Task-Lineage: fcee3a44-5c36-4899-bf9d-835d36abdf2e
This commit is contained in:
Fusion
2026-05-13 02:37:35 -07:00
committed by gsxdsm
parent 53f4de2fcb
commit 203217a887

View File

@@ -19,9 +19,10 @@ import { createResolvedAgentSession } from "../agent-session-helpers.js";
const mockedCreateResolvedAgentSession = vi.mocked(createResolvedAgentSession);
function buildSession(reviewText: string) {
const prompt = vi.fn().mockResolvedValue(undefined);
return {
session: {
prompt: vi.fn().mockResolvedValue(undefined),
prompt,
subscribe: vi.fn().mockImplementation((cb: any) => {
cb({
type: "message_update",
@@ -68,4 +69,29 @@ describe("FN-4068 baseline — plan review UNAVAILABLE", () => {
expect.stringContaining("review retry with fallback model after UNAVAILABLE verdict"),
);
});
it("retries on the same model with stricter verdict instruction when fallback model is not configured", async () => {
const first = buildSession("No parseable verdict here.");
const second = buildSession("### Verdict: APPROVE\n### Summary\nRecovered.");
mockedCreateResolvedAgentSession
.mockResolvedValueOnce(first)
.mockResolvedValueOnce(second);
const result = await reviewStep(
"/tmp/worktree",
"FN-4092",
2,
"Reproduce stall",
"plan",
"# prompt",
undefined,
{},
);
expect(result.verdict).toBe("APPROVE");
expect(mockedCreateResolvedAgentSession).toHaveBeenCalledTimes(2);
expect(second.session.prompt).toHaveBeenCalledWith(
expect.stringContaining('Respond with exactly one of: APPROVE | REVISE | RETHINK on a line starting with "Verdict:"'),
);
});
});