惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

博客园_首页
H
Help Net Security
腾讯CDC
宝玉的分享
宝玉的分享
H
Hackread – Cybersecurity News, Data Breaches, AI and More
L
LangChain Blog
爱范儿
爱范儿
T
The Blog of Author Tim Ferriss
J
Java Code Geeks
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
MyScale Blog
MyScale Blog
Engineering at Meta
Engineering at Meta
N
Netflix TechBlog - Medium
D
Docker
V
V2EX
Last Week in AI
Last Week in AI
G
Google Developers Blog
IT之家
IT之家
C
Check Point Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
人人都是产品经理
人人都是产品经理
博客园 - 叶小钗
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
博客园 - 聂微东

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 test: merge chat context notice checks · openclaw/openclaw@5c2f4af feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
test: reduce auth choice fixture churn · openclaw/opencla...
steipete · 2026-04-17 · via Recent Commits to openclaw:main

@@ -910,9 +910,8 @@ describe("applyAuthChoice", () => {

910910

token: "hf-test-token",

911911

},

912912

];

913+

await setupTempState();

913914

for (const scenario of scenarios) {

914-

await setupTempState();

915-916915

const text = vi.fn().mockResolvedValue(scenario.token);

917916

const { prompter, runtime } = createApiKeyPromptHarness({ text });

918917

@@ -980,8 +979,8 @@ describe("applyAuthChoice", () => {

980979

expectedDetectCall: { apiKey: "zai-detected-key" },

981980

},

982981

];

982+

await setupTempState();

983983

for (const scenario of scenarios) {

984-

await setupTempState();

985984

detectZaiEndpoint.mockReset();

986985

detectZaiEndpoint.mockResolvedValue(null);

987986

if (scenario.detectResult) {

@@ -1073,8 +1072,8 @@ describe("applyAuthChoice", () => {

10731072

expectedModelPrefix: "litellm/",

10741073

},

10751074

];

1075+

await setupTempState();

10761076

for (const scenario of scenarios) {

1077-

await setupTempState();

10781077

delete process.env.HF_TOKEN;

10791078

delete process.env.HUGGINGFACE_HUB_TOKEN;

10801079

@@ -1116,84 +1115,97 @@ describe("applyAuthChoice", () => {

11161115

}

11171116

});

111811171119-

it.each([

1120-

{

1121-

authChoice: "moonshot-api-key",

1122-

tokenProvider: "moonshot",

1123-

profileId: "moonshot:default",

1124-

provider: "moonshot",

1125-

modelPrefix: "moonshot/",

1126-

},

1127-

{

1128-

authChoice: "mistral-api-key",

1129-

tokenProvider: "mistral",

1130-

profileId: "mistral:default",

1131-

provider: "mistral",

1132-

modelPrefix: "mistral/",

1133-

},

1134-

{

1135-

authChoice: "kimi-code-api-key",

1136-

tokenProvider: "kimi-code",

1137-

profileId: "kimi:default",

1138-

provider: "kimi",

1139-

modelPrefix: "kimi/",

1140-

},

1141-

{

1142-

authChoice: "xiaomi-api-key",

1143-

tokenProvider: "xiaomi",

1144-

profileId: "xiaomi:default",

1145-

provider: "xiaomi",

1146-

modelPrefix: "xiaomi/",

1147-

},

1148-

{

1149-

authChoice: "venice-api-key",

1150-

tokenProvider: "venice",

1151-

profileId: "venice:default",

1152-

provider: "venice",

1153-

modelPrefix: "venice/",

1154-

},

1155-

{

1156-

authChoice: "opencode-zen",

1157-

tokenProvider: "opencode",

1158-

profileId: "opencode:default",

1159-

provider: "opencode",

1160-

modelPrefix: "opencode/",

1161-

extraProfiles: ["opencode-go:default"],

1162-

},

1163-

{

1164-

authChoice: "opencode-go",

1165-

tokenProvider: "opencode-go",

1166-

profileId: "opencode-go:default",

1167-

provider: "opencode-go",

1168-

modelPrefix: "opencode-go/",

1169-

extraProfiles: ["opencode:default"],

1170-

},

1171-

{

1172-

authChoice: "together-api-key",

1173-

tokenProvider: "together",

1174-

profileId: "together:default",

1175-

provider: "together",

1176-

modelPrefix: "together/",

1177-

},

1178-

{

1179-

authChoice: "qianfan-api-key",

1180-

tokenProvider: "qianfan",

1181-

profileId: "qianfan:default",

1182-

provider: "qianfan",

1183-

modelPrefix: "qianfan/",

1184-

},

1185-

{

1186-

authChoice: "synthetic-api-key",

1187-

tokenProvider: "synthetic",

1188-

profileId: "synthetic:default",

1189-

provider: "synthetic",

1190-

modelPrefix: "synthetic/",

1191-

},

1192-

] as const)(

1193-

"uses opts token for $authChoice without prompting",

1194-

async ({ authChoice, tokenProvider, profileId, provider, modelPrefix, extraProfiles }) => {

1195-

await setupTempState();

1196-1118+

it("uses opts token for direct provider choices without prompting", async () => {

1119+

await setupTempState();

1120+

const scenarios: Array<{

1121+

authChoice: AuthChoice;

1122+

tokenProvider: string;

1123+

profileId: string;

1124+

provider: string;

1125+

modelPrefix: string;

1126+

extraProfiles?: string[];

1127+

}> = [

1128+

{

1129+

authChoice: "moonshot-api-key",

1130+

tokenProvider: "moonshot",

1131+

profileId: "moonshot:default",

1132+

provider: "moonshot",

1133+

modelPrefix: "moonshot/",

1134+

},

1135+

{

1136+

authChoice: "mistral-api-key",

1137+

tokenProvider: "mistral",

1138+

profileId: "mistral:default",

1139+

provider: "mistral",

1140+

modelPrefix: "mistral/",

1141+

},

1142+

{

1143+

authChoice: "kimi-code-api-key",

1144+

tokenProvider: "kimi-code",

1145+

profileId: "kimi:default",

1146+

provider: "kimi",

1147+

modelPrefix: "kimi/",

1148+

},

1149+

{

1150+

authChoice: "xiaomi-api-key",

1151+

tokenProvider: "xiaomi",

1152+

profileId: "xiaomi:default",

1153+

provider: "xiaomi",

1154+

modelPrefix: "xiaomi/",

1155+

},

1156+

{

1157+

authChoice: "venice-api-key",

1158+

tokenProvider: "venice",

1159+

profileId: "venice:default",

1160+

provider: "venice",

1161+

modelPrefix: "venice/",

1162+

},

1163+

{

1164+

authChoice: "opencode-zen",

1165+

tokenProvider: "opencode",

1166+

profileId: "opencode:default",

1167+

provider: "opencode",

1168+

modelPrefix: "opencode/",

1169+

extraProfiles: ["opencode-go:default"],

1170+

},

1171+

{

1172+

authChoice: "opencode-go",

1173+

tokenProvider: "opencode-go",

1174+

profileId: "opencode-go:default",

1175+

provider: "opencode-go",

1176+

modelPrefix: "opencode-go/",

1177+

extraProfiles: ["opencode:default"],

1178+

},

1179+

{

1180+

authChoice: "together-api-key",

1181+

tokenProvider: "together",

1182+

profileId: "together:default",

1183+

provider: "together",

1184+

modelPrefix: "together/",

1185+

},

1186+

{

1187+

authChoice: "qianfan-api-key",

1188+

tokenProvider: "qianfan",

1189+

profileId: "qianfan:default",

1190+

provider: "qianfan",

1191+

modelPrefix: "qianfan/",

1192+

},

1193+

{

1194+

authChoice: "synthetic-api-key",

1195+

tokenProvider: "synthetic",

1196+

profileId: "synthetic:default",

1197+

provider: "synthetic",

1198+

modelPrefix: "synthetic/",

1199+

},

1200+

];

1201+

for (const {

1202+

authChoice,

1203+

tokenProvider,

1204+

profileId,

1205+

provider,

1206+

modelPrefix,

1207+

extraProfiles,

1208+

} of scenarios) {

11971209

const text = vi.fn();

11981210

const confirm = vi.fn(async () => false);

11991211

const { prompter, runtime } = createApiKeyPromptHarness({ text, confirm });

@@ -1226,8 +1238,8 @@ describe("applyAuthChoice", () => {

12261238

for (const extraProfile of extraProfiles ?? []) {

12271239

expect((await readAuthProfile(extraProfile))?.key).toBe(token);

12281240

}

1229-

},

1230-

);

1241+

}

1242+

});

1231124312321244

it("uses opts token for Gemini and keeps global default model when setDefaultModel=false", async () => {

12331245

await setupTempState();

@@ -1355,8 +1367,8 @@ describe("applyAuthChoice", () => {

13551367

expectedModel: "vercel-ai-gateway/anthropic/claude-opus-4.6",

13561368

},

13571369

];

1370+

await setupTempState();

13581371

for (const scenario of scenarios) {

1359-

await setupTempState();

13601372

delete process.env.SYNTHETIC_API_KEY;

13611373

delete process.env.OPENROUTER_API_KEY;

13621374

delete process.env.AI_GATEWAY_API_KEY;

@@ -1557,9 +1569,8 @@ describe("applyAuthChoice", () => {

15571569

expectProviderConfigUndefined: "opencode-go",

15581570

},

15591571

];

1572+

await setupTempState();

15601573

for (const scenario of scenarios) {

1561-

await setupTempState();

1562-15631574

const text = vi.fn().mockResolvedValue(scenario.token);

15641575

const { prompter, runtime } = createApiKeyPromptHarness({ text });

15651576

@@ -1673,40 +1684,29 @@ describe("applyAuthChoice", () => {

16731684

});

1674168516751686

it("does not persist literal 'undefined' when API key prompts return undefined", async () => {

1676-

const scenarios = [

1677-

{

1678-

authChoice: "synthetic-api-key" as const,

1679-

envKey: "SYNTHETIC_API_KEY",

1680-

profileId: "synthetic:default",

1681-

provider: "synthetic",

1682-

},

1683-

];

1684-1685-

for (const scenario of scenarios) {

1686-

await setupTempState();

1687-

delete process.env[scenario.envKey];

1687+

await setupTempState();

1688+

delete process.env.SYNTHETIC_API_KEY;

168816891689-

const text = vi.fn(async () => undefined as unknown as string);

1690-

const prompter = createPrompter({ text });

1691-

const runtime = createExitThrowingRuntime();

1690+

const text = vi.fn(async () => undefined as unknown as string);

1691+

const prompter = createPrompter({ text });

1692+

const runtime = createExitThrowingRuntime();

169216931693-

const result = await applyAuthChoice({

1694-

authChoice: scenario.authChoice,

1695-

config: {},

1696-

prompter,

1697-

runtime,

1698-

setDefaultModel: false,

1699-

});

1694+

const result = await applyAuthChoice({

1695+

authChoice: "synthetic-api-key",

1696+

config: {},

1697+

prompter,

1698+

runtime,

1699+

setDefaultModel: false,

1700+

});

170017011701-

expect(result.config.auth?.profiles?.[scenario.profileId]).toMatchObject({

1702-

provider: scenario.provider,

1703-

mode: "api_key",

1704-

});

1702+

expect(result.config.auth?.profiles?.["synthetic:default"]).toMatchObject({

1703+

provider: "synthetic",

1704+

mode: "api_key",

1705+

});

170517061706-

const profile = await readAuthProfile(scenario.profileId);

1707-

expect(profile?.key).toBe("");

1708-

expect(profile?.key).not.toBe("undefined");

1709-

}

1707+

const profile = await readAuthProfile("synthetic:default");

1708+

expect(profile?.key).toBe("");

1709+

expect(profile?.key).not.toBe("undefined");

17101710

});

1711171117121712

it("ignores legacy LiteLLM oauth profiles when selecting litellm-api-key", async () => {

@@ -1832,8 +1832,8 @@ describe("applyAuthChoice", () => {

18321832

},

18331833

},

18341834

];

1835+

await setupTempState();

18351836

for (const scenario of scenarios) {

1836-

await setupTempState();

18371837

delete process.env.CLOUDFLARE_AI_GATEWAY_API_KEY;

18381838

if (scenario.envGatewayKey) {

18391839

process.env.CLOUDFLARE_AI_GATEWAY_API_KEY = scenario.envGatewayKey;

@@ -1981,9 +1981,8 @@ describe("applyAuthChoice", () => {

19811981

apiKey: "minimax-oauth", // pragma: allowlist secret

19821982

},

19831983

];

1984+

await setupTempState();

19841985

for (const scenario of scenarios) {

1985-

await setupTempState();

1986-19871986

resolvePluginProviders.mockReturnValue([

19881987

{

19891988

id: scenario.providerId,