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

推荐订阅源

Jina AI
Jina AI
云风的 BLOG
云风的 BLOG
人人都是产品经理
人人都是产品经理
T
The Blog of Author Tim Ferriss
阮一峰的网络日志
阮一峰的网络日志
罗磊的独立博客
J
Java Code Geeks
博客园 - 聂微东
B
Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
WordPress大学
WordPress大学
腾讯CDC
L
LangChain Blog
Apple Machine Learning Research
Apple Machine Learning Research
Microsoft Azure Blog
Microsoft Azure Blog
D
DataBreaches.Net
The GitHub Blog
The GitHub Blog
美团技术团队
博客园 - Franky
Google DeepMind News
Google DeepMind News
V
V2EX
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
月光博客
月光博客
The Cloudflare 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
fix(discord): defer model picker interactions · openclaw/...
steipete · 2026-05-10 · via Recent Commits to openclaw:main

@@ -44,7 +44,9 @@ type MockInteraction = {

4444

reply: ReturnType<typeof vi.fn>;

4545

followUp: ReturnType<typeof vi.fn>;

4646

update: ReturnType<typeof vi.fn>;

47+

editReply: ReturnType<typeof vi.fn>;

4748

acknowledge: ReturnType<typeof vi.fn>;

49+

acknowledged: boolean;

4850

client: object;

4951

};

5052

@@ -96,7 +98,7 @@ function createModelPickerContext(): ModelPickerContext {

96989799

function createInteraction(params?: { userId?: string; values?: string[] }): MockInteraction {

98100

const userId = params?.userId ?? "owner";

99-

return {

101+

const interaction = {

100102

user: {

101103

id: userId,

102104

username: "tester",

@@ -115,9 +117,16 @@ function createInteraction(params?: { userId?: string; values?: string[] }): Moc

115117

reply: vi.fn().mockResolvedValue({ ok: true }),

116118

followUp: vi.fn().mockResolvedValue({ ok: true }),

117119

update: vi.fn().mockResolvedValue({ ok: true }),

118-

acknowledge: vi.fn().mockResolvedValue({ ok: true }),

120+

editReply: vi.fn().mockResolvedValue({ ok: true }),

121+

acknowledge: vi.fn(),

122+

acknowledged: false,

119123

client: {},

120124

};

125+

interaction.acknowledge.mockImplementation(async () => {

126+

interaction.acknowledged = true;

127+

return { ok: true };

128+

});

129+

return interaction;

121130

}

122131123132

function createDefaultModelPickerData(): ModelsProviderData {

@@ -323,6 +332,28 @@ describe("Discord model picker interactions", () => {

323332

expect(loadSpy).not.toHaveBeenCalled();

324333

});

325334335+

it("defers owner picker interactions before loading model data", async () => {

336+

const context = createModelPickerContext();

337+

const pickerData = createDefaultModelPickerData();

338+

const loadSpy = vi

339+

.spyOn(modelPickerModule, "loadDiscordModelPickerData")

340+

.mockImplementation(async () => {

341+

expect(interaction.acknowledge).toHaveBeenCalledTimes(1);

342+

return pickerData;

343+

});

344+

const select = createModelPickerFallbackSelect(context);

345+

const interaction = createInteraction({ userId: "owner", values: ["gpt-4o"] });

346+347+

await select.run(

348+

interaction as unknown as PickerSelectInteraction,

349+

createModelsViewSelectData(),

350+

);

351+352+

expect(loadSpy).toHaveBeenCalledTimes(1);

353+

expect(interaction.editReply).toHaveBeenCalledTimes(1);

354+

expect(interaction.update).not.toHaveBeenCalled();

355+

});

356+326357

it("requires submit click before routing selected model through /model pipeline", async () => {

327358

const context = createModelPickerContext();

328359

const pickerData = createDefaultModelPickerData();

@@ -338,7 +369,7 @@ describe("Discord model picker interactions", () => {

338369

dispatchCommandInteraction: dispatchSpy,

339370

});

340371341-

expect(selectInteraction.update).toHaveBeenCalledTimes(1);

372+

expect(selectInteraction.editReply).toHaveBeenCalledTimes(1);

342373

expect(dispatchSpy).not.toHaveBeenCalled();

343374344375

const submitInteraction = await runSubmitButton({

@@ -347,7 +378,7 @@ describe("Discord model picker interactions", () => {

347378

dispatchCommandInteraction: dispatchSpy,

348379

});

349380350-

expect(submitInteraction.update).toHaveBeenCalledTimes(1);

381+

expect(submitInteraction.editReply).toHaveBeenCalledTimes(1);

351382

expect(dispatchSpy).toHaveBeenCalledTimes(1);

352383

expectDispatchedModelSelection({

353384

dispatchSpy,

@@ -547,8 +578,8 @@ describe("Discord model picker interactions", () => {

547578548579

await button.run(interaction as unknown as PickerButtonInteraction, data);

549580550-

expect(interaction.update).toHaveBeenCalledTimes(1);

551-

const updatePayload = interaction.update.mock.calls[0]?.[0];

581+

expect(interaction.editReply).toHaveBeenCalledTimes(1);

582+

const updatePayload = interaction.editReply.mock.calls[0]?.[0];

552583

if (!updatePayload) {

553584

throw new Error("recents button did not emit an update payload");

554585

}

@@ -585,7 +616,7 @@ describe("Discord model picker interactions", () => {

585616

dispatchCommandInteraction: dispatchSpy,

586617

});

587618588-

expect(submitInteraction.update).toHaveBeenCalledTimes(1);

619+

expect(submitInteraction.editReply).toHaveBeenCalledTimes(1);

589620

expect(dispatchSpy).toHaveBeenCalledTimes(1);

590621

expectDispatchedModelSelection({ dispatchSpy, model: "openai/gpt-4o" });

591622

});