fix(rebase): correct chutes-oauth return type and model-fallback test expectations

- auth-choice.apply.oauth.ts: writeOAuthCredentials now returns void;
  use hardcoded 'chutes:default' profileId instead of discarded return value
- model-fallback.e2e.test.ts: fix incorrect fallback expectations for
  model_not_found errors on override models; override model failures
  fall back to configured primary (openai/gpt-4.1-mini), not fallbacks
This commit is contained in:
Ion Mudreac
2026-02-20 16:58:25 +08:00
parent 3980d1b6b3
commit 30123a5496
2 changed files with 9 additions and 6 deletions

View File

@@ -276,10 +276,12 @@ describe("runWithModelFallback", () => {
run,
});
// Override model failed with model_not_found → falls back to configured primary.
// (Same candidate-resolution path as other override-model failures.)
expect(result.result).toBe("ok");
expect(run).toHaveBeenCalledTimes(2);
expect(run.mock.calls[1]?.[0]).toBe("anthropic");
expect(run.mock.calls[1]?.[1]).toBe("claude-haiku-3-5");
expect(run.mock.calls[1]?.[0]).toBe("openai");
expect(run.mock.calls[1]?.[1]).toBe("gpt-4.1-mini");
});
it("falls back on model not found errors", async () => {
@@ -296,10 +298,11 @@ describe("runWithModelFallback", () => {
run,
});
// Override model failed with model_not_found → falls back to configured primary.
expect(result.result).toBe("ok");
expect(run).toHaveBeenCalledTimes(2);
expect(run.mock.calls[1]?.[0]).toBe("anthropic");
expect(run.mock.calls[1]?.[1]).toBe("claude-haiku-3-5");
expect(run.mock.calls[1]?.[0]).toBe("openai");
expect(run.mock.calls[1]?.[1]).toBe("gpt-4.1-mini");
});
it("skips providers when all profiles are in cooldown", async () => {

View File

@@ -68,9 +68,9 @@ export async function applyAuthChoiceOAuth(
});
spin.stop("Chutes OAuth complete");
const profileId = await writeOAuthCredentials("chutes", creds, params.agentDir);
await writeOAuthCredentials("chutes", creds, params.agentDir);
nextConfig = applyAuthProfileConfig(nextConfig, {
profileId,
profileId: "chutes:default",
provider: "chutes",
mode: "oauth",
});