feat(FN-742): add describeModel helper and log model in agent creation sites

- Add describeModel() helper in pi.ts to format provider/model info for logging
- Log resolved model details in executor, reviewer, and triage agent creation
- Update executor and reviewer to call describeModel before session start
- Add unit tests for describeModel covering all input combinations
- Fix test mocks to account for new describeModel dependency
This commit is contained in:
gsxdsm
2026-04-02 19:52:35 -07:00
parent f72924c7ab
commit c82b997402
8 changed files with 69 additions and 3 deletions

View File

@@ -0,0 +1,37 @@
import { describe, it, expect } from "vitest";
import { describeModel } from "./pi.js";
import type { AgentSession } from "@mariozechner/pi-coding-agent";
describe("describeModel", () => {
it('returns "provider/modelId" when session has a model', () => {
const fakeSession = {
model: {
provider: "anthropic",
id: "claude-sonnet-4-5",
name: "Claude Sonnet",
},
} as unknown as AgentSession;
expect(describeModel(fakeSession)).toBe("anthropic/claude-sonnet-4-5");
});
it('returns "unknown model" when session model is undefined', () => {
const fakeSession = {
model: undefined,
} as unknown as AgentSession;
expect(describeModel(fakeSession)).toBe("unknown model");
});
it("handles different providers", () => {
const fakeSession = {
model: {
provider: "openai",
id: "gpt-4o",
name: "GPT-4o",
},
} as unknown as AgentSession;
expect(describeModel(fakeSession)).toBe("openai/gpt-4o");
});
});