extract resolveModel() to run before agent selection

model resolution was duplicated inside each agent (opentoad, claude) and
PULLFROG_MODEL override was not considered when choosing the agent. now
resolveModel() runs first in main.ts, its result feeds into resolveAgent()
for agent selection, and the resolved model is passed to the agent via
ctx.resolvedModel. agents only handle their own fallback (opentoad: auto-select
via opencode models, claude: strip provider prefix).

also removes the hardcoded anthropic/claude-sonnet test runner default since
ANTHROPIC_API_KEY is no longer in CI.

Made-with: Cursor
This commit is contained in:
Colin McDonnell
2026-04-01 06:51:18 +00:00
committed by pullfrog[bot]
parent 1f1e3995f9
commit b1f9878877
8 changed files with 83 additions and 127 deletions
+5 -3
View File
@@ -15,7 +15,7 @@ import {
DEFAULT_ACTIVITY_CHECK_INTERVAL_MS,
DEFAULT_ACTIVITY_TIMEOUT_MS,
} from "./utils/activity.ts";
import { resolveAgent } from "./utils/agent.ts";
import { resolveAgent, resolveModel } from "./utils/agent.ts";
import { apiFetch } from "./utils/apiFetch.ts";
import { validateAgentApiKey } from "./utils/apiKeys.ts";
import { resolveBody } from "./utils/body.ts";
@@ -249,11 +249,12 @@ export async function main(): Promise<MainResult> {
await using gitAuthServer = await startGitAuthServer(tmpdir);
setGitAuthServer(gitAuthServer);
const agent = resolveAgent({ model: payload.proxyModel ? undefined : payload.model });
const resolvedModel = payload.proxyModel ? undefined : resolveModel({ slug: payload.model });
const agent = resolveAgent({ model: resolvedModel });
validateAgentApiKey({
agent,
model: payload.proxyModel ?? payload.model,
model: payload.proxyModel ?? resolvedModel ?? payload.model,
owner: runContext.repo.owner,
name: runContext.repo.name,
});
@@ -341,6 +342,7 @@ export async function main(): Promise<MainResult> {
const agentPromise = agent.run({
payload,
resolvedModel,
mcpServerUrl: mcpHttpServer.url,
tmpdir,
instructions,