feat(FN-3621): harden thinking provider compatibility

- Normalize Anthropic/OpenAI thinking level handling before creating Fn agents
- Add regression tests for thinking-level conflict and provider compatibility behavior
- Document thinking provider compatibility guidance in settings reference
- Ref: Runfusion/Fusion#52

Fusion-Task-Id: FN-3621
This commit is contained in:
Fusion
2026-05-06 21:43:53 -07:00
committed by gsxdsm
parent 6488110239
commit 3440d6aeda
4 changed files with 164 additions and 56 deletions

View File

@@ -993,6 +993,36 @@ describe("createFnAgent", () => {
}));
});
it("continues session creation when setting thinking level hits reasoning conflict", async () => {
const { piLog } = await import("../logger.js");
const warnSpy = vi.spyOn(piLog, "warn").mockImplementation(() => {});
const setThinkingLevel = vi.fn(() => {
throw new Error("400 cannot specify both 'thinking' and 'reasoning_effort'");
});
createAgentSessionMock.mockResolvedValueOnce({
session: {
prompt: vi.fn(),
subscribe: vi.fn(),
dispose: vi.fn(),
setThinkingLevel,
},
});
const { createFnAgent } = await import("../pi.js");
await expect(createFnAgent({
cwd: "/tmp",
systemPrompt: "test",
tools: "readonly",
defaultThinkingLevel: "high",
})).resolves.toBeTruthy();
expect(setThinkingLevel).toHaveBeenCalledWith("high");
expect(warnSpy).toHaveBeenCalledWith(expect.stringContaining("Disabling explicit thinking level"));
warnSpy.mockRestore();
});
describe("skill selection", () => {
beforeEach(() => {
// Reset modules to ensure fresh imports for each test