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

推荐订阅源

奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Apple Machine Learning Research
Apple Machine Learning Research
aimingoo的专栏
aimingoo的专栏
H
Help Net Security
腾讯CDC
T
Tailwind CSS Blog
Hugging Face - Blog
Hugging Face - Blog
人人都是产品经理
人人都是产品经理
酷 壳 – CoolShell
酷 壳 – CoolShell
MongoDB | Blog
MongoDB | Blog
宝玉的分享
宝玉的分享
有赞技术团队
有赞技术团队
美团技术团队
雷峰网
雷峰网
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
博客园 - 司徒正美
博客园_首页
Recent Announcements
Recent Announcements
云风的 BLOG
云风的 BLOG
B
Blog RSS Feed
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
D
Docker
博客园 - Franky
Jina AI
Jina AI

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
fix(openrouter): canonicalize auto selector refs · opencl...
steipete · 2026-05-07 · via Recent Commits to openclaw:main

@@ -8,6 +8,7 @@ import {

88

type LoadHistoryMock = ReturnType<typeof vi.fn> & (() => Promise<void>);

99

type RunAuthFlow = NonNullable<Parameters<typeof createCommandHandlers>[0]["runAuthFlow"]>;

1010

type SelectableOverlay = {

11+

items?: Array<{ value: string; label?: string; description?: string }>;

1112

onSelect?: (item: { value: string; label?: string; description?: string }) => void;

1213

};

1314

type SetActivityStatusMock = ReturnType<typeof vi.fn> & ((text: string) => void);

@@ -21,6 +22,7 @@ function createHarness(params?: {

2122

sendChat?: ReturnType<typeof vi.fn>;

2223

getGatewayStatus?: ReturnType<typeof vi.fn>;

2324

listSessions?: ReturnType<typeof vi.fn>;

25+

listModels?: ReturnType<typeof vi.fn>;

2426

patchSession?: ReturnType<typeof vi.fn>;

2527

resetSession?: ReturnType<typeof vi.fn>;

2628

runAuthFlow?: RunAuthFlow;

@@ -38,6 +40,7 @@ function createHarness(params?: {

3840

const sendChat = params?.sendChat ?? vi.fn().mockResolvedValue({ runId: "r1" });

3941

const getGatewayStatus = params?.getGatewayStatus ?? vi.fn().mockResolvedValue({});

4042

const listSessions = params?.listSessions ?? vi.fn().mockResolvedValue({ sessions: [] });

43+

const listModels = params?.listModels ?? vi.fn().mockResolvedValue([]);

4144

const patchSession = params?.patchSession ?? vi.fn().mockResolvedValue({});

4245

const resetSession = params?.resetSession ?? vi.fn().mockResolvedValue({ ok: true });

4346

const setSession = params?.setSession ?? (vi.fn().mockResolvedValue(undefined) as SetSessionMock);

@@ -71,7 +74,14 @@ function createHarness(params?: {

7174

};

72757376

const { handleCommand, openSessionSelector } = createCommandHandlers({

74-

client: { sendChat, getGatewayStatus, listSessions, patchSession, resetSession } as never,

77+

client: {

78+

sendChat,

79+

getGatewayStatus,

80+

listSessions,

81+

listModels,

82+

patchSession,

83+

resetSession,

84+

} as never,

7585

chatLog: { addUser, addSystem } as never,

7686

tui: { requestRender } as never,

7787

opts: params?.opts ?? {},

@@ -99,6 +109,7 @@ function createHarness(params?: {

99109

handleCommand,

100110

getGatewayStatus,

101111

listSessions,

112+

listModels,

102113

sendChat,

103114

openSessionSelector,

104115

openOverlay,

@@ -526,4 +537,42 @@ describe("tui command handlers", () => {

526537

expect(applySessionInfoFromPatch).toHaveBeenCalledWith({ groupActivation: "always" });

527538

expect(refreshSessionInfo).toHaveBeenCalledTimes(1);

528539

});

540+541+

it("uses canonical model refs in the model selector", async () => {

542+

const listModels = vi.fn().mockResolvedValue([

543+

{

544+

provider: "openrouter",

545+

id: "openrouter/auto",

546+

name: "OpenRouter Auto",

547+

},

548+

]);

549+

const patchSession = vi.fn().mockResolvedValue({ model: "openrouter/auto" });

550+

const refreshSessionInfo = vi.fn().mockResolvedValue(undefined);

551+

const applySessionInfoFromPatch = vi.fn();

552+

const { handleCommand, openOverlay, closeOverlay } = createHarness({

553+

listModels,

554+

patchSession,

555+

refreshSessionInfo,

556+

applySessionInfoFromPatch,

557+

});

558+559+

await handleCommand("/model");

560+561+

const selector = openOverlay.mock.calls[0]?.[0] as SelectableOverlay | undefined;

562+

expect(selector?.items?.[0]).toMatchObject({

563+

value: "openrouter/auto",

564+

label: "openrouter/auto",

565+

});

566+567+

selector?.onSelect?.({ value: "openrouter/auto", label: "openrouter/auto" });

568+

await flushAsyncSelect();

569+570+

expect(patchSession).toHaveBeenCalledWith({

571+

key: "agent:main:main",

572+

model: "openrouter/auto",

573+

});

574+

expect(applySessionInfoFromPatch).toHaveBeenCalledWith({ model: "openrouter/auto" });

575+

expect(refreshSessionInfo).toHaveBeenCalledTimes(1);

576+

expect(closeOverlay).toHaveBeenCalledTimes(1);

577+

});

529578

});