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

推荐订阅源

博客园 - 司徒正美
T
The Blog of Author Tim Ferriss
F
Fortinet All Blogs
Martin Fowler
Martin Fowler
罗磊的独立博客
The GitHub Blog
The GitHub Blog
L
LangChain Blog
A
About on SuperTechFans
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
D
DataBreaches.Net
宝玉的分享
宝玉的分享
U
Unit 42
阮一峰的网络日志
阮一峰的网络日志
Last Week in AI
Last Week in AI
N
Netflix TechBlog - Medium
The Cloudflare Blog
Microsoft Azure Blog
Microsoft Azure Blog
H
Help Net Security
美团技术团队
大猫的无限游戏
大猫的无限游戏
雷峰网
雷峰网
爱范儿
爱范儿
酷 壳 – CoolShell
酷 壳 – CoolShell
MongoDB | Blog
MongoDB | Blog

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 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: reduce auth choice fixture churn · openclaw/openclaw@857b9cd 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: tighten simple completion selection assertions · op...
steipete · 2026-05-10 · via Recent Commits to openclaw:main

@@ -2,6 +2,13 @@ import { describe, expect, it } from "vitest";

22

import type { OpenClawConfig } from "../config/config.js";

33

import { resolveSimpleCompletionSelectionForAgent } from "./simple-completion-runtime.js";

445+

function requireSelection(selection: ReturnType<typeof resolveSimpleCompletionSelectionForAgent>) {

6+

if (!selection) {

7+

throw new Error("expected simple completion selection");

8+

}

9+

return selection;

10+

}

11+512

describe("resolveSimpleCompletionSelectionForAgent", () => {

613

it("preserves multi-segment model ids (openrouter provider models)", () => {

714

const cfg = {

@@ -10,13 +17,11 @@ describe("resolveSimpleCompletionSelectionForAgent", () => {

1017

},

1118

} as OpenClawConfig;

121913-

const selection = resolveSimpleCompletionSelectionForAgent({ cfg, agentId: "main" });

14-

expect(selection).toEqual(

15-

expect.objectContaining({

16-

provider: "openrouter",

17-

modelId: "anthropic/claude-sonnet-4-6",

18-

}),

20+

const selection = requireSelection(

21+

resolveSimpleCompletionSelectionForAgent({ cfg, agentId: "main" }),

1922

);

23+

expect(selection.provider).toBe("openrouter");

24+

expect(selection.modelId).toBe("anthropic/claude-sonnet-4-6");

2025

});

21262227

it("uses the routed agent model override when present", () => {

@@ -27,13 +32,11 @@ describe("resolveSimpleCompletionSelectionForAgent", () => {

2732

},

2833

} as OpenClawConfig;

293430-

const selection = resolveSimpleCompletionSelectionForAgent({ cfg, agentId: "ops" });

31-

expect(selection).toEqual(

32-

expect.objectContaining({

33-

provider: "openrouter",

34-

modelId: "openrouter/aurora-alpha",

35-

}),

35+

const selection = requireSelection(

36+

resolveSimpleCompletionSelectionForAgent({ cfg, agentId: "ops" }),

3637

);

38+

expect(selection.provider).toBe("openrouter");

39+

expect(selection.modelId).toBe("openrouter/aurora-alpha");

3740

});

38413942

it("keeps trailing auth profile for credential lookup", () => {

@@ -43,14 +46,12 @@ describe("resolveSimpleCompletionSelectionForAgent", () => {

4346

},

4447

} as OpenClawConfig;

454846-

const selection = resolveSimpleCompletionSelectionForAgent({ cfg, agentId: "main" });

47-

expect(selection).toEqual(

48-

expect.objectContaining({

49-

provider: "anthropic",

50-

modelId: "claude-opus-4-6",

51-

profileId: "work",

52-

}),

49+

const selection = requireSelection(

50+

resolveSimpleCompletionSelectionForAgent({ cfg, agentId: "main" }),

5351

);

52+

expect(selection.provider).toBe("anthropic");

53+

expect(selection.modelId).toBe("claude-opus-4-6");

54+

expect(selection.profileId).toBe("work");

5455

});

55565657

it("resolves alias refs before parsing provider/model", () => {

@@ -65,26 +66,22 @@ describe("resolveSimpleCompletionSelectionForAgent", () => {

6566

},

6667

} as OpenClawConfig;

676868-

const selection = resolveSimpleCompletionSelectionForAgent({ cfg, agentId: "main" });

69-

expect(selection).toEqual(

70-

expect.objectContaining({

71-

provider: "openrouter",

72-

modelId: "anthropic/claude-sonnet-4-6",

73-

profileId: "work",

74-

}),

69+

const selection = requireSelection(

70+

resolveSimpleCompletionSelectionForAgent({ cfg, agentId: "main" }),

7571

);

72+

expect(selection.provider).toBe("openrouter");

73+

expect(selection.modelId).toBe("anthropic/claude-sonnet-4-6");

74+

expect(selection.profileId).toBe("work");

7675

});

77767877

it("falls back to runtime default model when no explicit model is configured", () => {

7978

const cfg = {} as OpenClawConfig;

807981-

const selection = resolveSimpleCompletionSelectionForAgent({ cfg, agentId: "main" });

82-

expect(selection).toEqual(

83-

expect.objectContaining({

84-

provider: "openai",

85-

modelId: "gpt-5.5",

86-

}),

80+

const selection = requireSelection(

81+

resolveSimpleCompletionSelectionForAgent({ cfg, agentId: "main" }),

8782

);

83+

expect(selection.provider).toBe("openai");

84+

expect(selection.modelId).toBe("gpt-5.5");

8885

});

89869087

it("uses configured provider fallback when default provider is unavailable", () => {

@@ -114,12 +111,10 @@ describe("resolveSimpleCompletionSelectionForAgent", () => {

114111

},

115112

} as OpenClawConfig;

116113117-

const selection = resolveSimpleCompletionSelectionForAgent({ cfg, agentId: "main" });

118-

expect(selection).toEqual(

119-

expect.objectContaining({

120-

provider: "openai",

121-

modelId: "gpt-5.5",

122-

}),

114+

const selection = requireSelection(

115+

resolveSimpleCompletionSelectionForAgent({ cfg, agentId: "main" }),

123116

);

117+

expect(selection.provider).toBe("openai");

118+

expect(selection.modelId).toBe("gpt-5.5");

124119

});

125120

});