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

推荐订阅源

MyScale Blog
MyScale Blog
博客园 - 司徒正美
A
About on SuperTechFans
Vercel News
Vercel News
H
Hackread – Cybersecurity News, Data Breaches, AI and More
爱范儿
爱范儿
I
InfoQ
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
博客园_首页
Google DeepMind News
Google DeepMind News
T
Tailwind CSS Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
F
Fortinet All Blogs
S
SegmentFault 最新的问题
阮一峰的网络日志
阮一峰的网络日志
D
Docker
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
G
Google Developers Blog
Stack Overflow Blog
Stack Overflow Blog
M
MIT News - Artificial intelligence
Jina AI
Jina AI
H
Help Net Security
量子位
IT之家
IT之家

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
ci: split auto-reply reply routing shard · openclaw/openc...
steipete · 2026-04-29 · via Recent Commits to openclaw:main

@@ -1,7 +1,7 @@

11

import fs from "node:fs/promises";

22

import os from "node:os";

33

import path from "node:path";

4-

import { afterAll, beforeAll, describe, expect, test, vi } from "vitest";

4+

import { afterAll, afterEach, beforeAll, beforeEach, describe, expect, test, vi } from "vitest";

55

import type { ChannelPlugin } from "../channels/plugins/types.js";

66

import { createChannelTestPluginBase } from "../test-utils/channel-plugins.js";

77

import { setRegistry } from "./server.agent.gateway-server-agent.mocks.js";

@@ -61,9 +61,18 @@ async function setTestSessionStore(params: {

6161

});

6262

}

636364-

function latestAgentCall(): AgentCommandCall {

64+

async function waitForAgentCall(runId: string): Promise<AgentCommandCall> {

65+

await vi.waitFor(() =>

66+

expect(

67+

(vi.mocked(agentCommand).mock.calls as unknown as Array<[AgentCommandCall]>).some(

68+

([call]) => call.runId === runId,

69+

),

70+

).toBe(true),

71+

);

6572

const calls = vi.mocked(agentCommand).mock.calls as unknown as Array<[unknown]>;

66-

return calls.at(-1)?.[0] as AgentCommandCall;

73+

return calls.find(

74+

([call]) => (call as AgentCommandCall).runId === runId,

75+

)?.[0] as AgentCommandCall;

6776

}

68776978

async function runMainAgentDeliveryWithSession(params: {

@@ -89,7 +98,7 @@ async function runMainAgentDeliveryWithSession(params: {

8998

...params.request,

9099

});

91100

expect(res.ok).toBe(true);

92-

return latestAgentCall();

101+

return await waitForAgentCall(String(params.request.idempotencyKey));

93102

} finally {

94103

testState.allowFrom = undefined;

95104

}

@@ -160,8 +169,19 @@ const defaultRegistry = createRegistry([

160169

]);

161170162171

describe("gateway server agent", () => {

163-

test("agent marks implicit delivery when lastTo is stale", async () => {

172+

beforeEach(() => {

173+

vi.mocked(agentCommand).mockClear();

174+

testState.agentsConfig = undefined;

175+

testState.allowFrom = undefined;

164176

setRegistry(defaultRegistry);

177+

});

178+179+

afterEach(() => {

180+

testState.agentsConfig = undefined;

181+

testState.allowFrom = undefined;

182+

});

183+184+

test("agent marks implicit delivery when lastTo is stale", async () => {

165185

testState.allowFrom = ["+436769770569"];

166186

await setTestSessionStore({

167187

entries: {

@@ -182,7 +202,7 @@ describe("gateway server agent", () => {

182202

});

183203

expect(res.ok).toBe(true);

184204185-

const call = latestAgentCall();

205+

const call = await waitForAgentCall("idem-agent-last-stale");

186206

expectChannels(call, "whatsapp");

187207

expect(call.to).toBe("+1555");

188208

expect(call.deliveryTargetMode).toBe("implicit");

@@ -191,7 +211,6 @@ describe("gateway server agent", () => {

191211

});

192212193213

test("agent forwards sessionKey to agentCommand", async () => {

194-

setRegistry(defaultRegistry);

195214

await setTestSessionStore({

196215

entries: {

197216

"agent:main:subagent:abc": {

@@ -207,7 +226,7 @@ describe("gateway server agent", () => {

207226

});

208227

expect(res.ok).toBe(true);

209228210-

const call = latestAgentCall();

229+

const call = await waitForAgentCall("idem-agent-subkey");

211230

expect(call.sessionKey).toBe("agent:main:subagent:abc");

212231

expect(call.sessionId).toBe("sess-sub");

213232

expectChannels(call, "webchat");

@@ -216,7 +235,6 @@ describe("gateway server agent", () => {

216235

});

217236218237

test("agent preserves spawnDepth on subagent sessions", async () => {

219-

setRegistry(defaultRegistry);

220238

await setTestSessionStore({

221239

entries: {

222240

"agent:main:subagent:depth": {

@@ -245,7 +263,6 @@ describe("gateway server agent", () => {

245263

});

246264247265

test("agent derives sessionKey from agentId", async () => {

248-

setRegistry(defaultRegistry);

249266

await setTestSessionStore({

250267

agentId: "ops",

251268

entries: {

@@ -263,13 +280,12 @@ describe("gateway server agent", () => {

263280

});

264281

expect(res.ok).toBe(true);

265282266-

const call = latestAgentCall();

283+

const call = await waitForAgentCall("idem-agent-id");

267284

expect(call.sessionKey).toBe("agent:ops:main");

268285

expect(call.sessionId).toBe("sess-ops");

269286

});

270287271288

test("agent rejects unknown reply channel", async () => {

272-

setRegistry(defaultRegistry);

273289

const res = await rpcReq(ws, "agent", {

274290

message: "hi",

275291

replyChannel: "unknown-channel",

@@ -283,7 +299,6 @@ describe("gateway server agent", () => {

283299

});

284300285301

test("agent rejects mismatched agentId and sessionKey", async () => {

286-

setRegistry(defaultRegistry);

287302

testState.agentsConfig = { list: [{ id: "ops" }] };

288303

const res = await rpcReq(ws, "agent", {

289304

message: "hi",

@@ -299,7 +314,6 @@ describe("gateway server agent", () => {

299314

});

300315301316

test("agent rejects malformed agent-prefixed session keys", async () => {

302-

setRegistry(defaultRegistry);

303317

const res = await rpcReq(ws, "agent", {

304318

message: "hi",

305319

sessionKey: "agent:main",

@@ -391,7 +405,6 @@ describe("gateway server agent", () => {

391405

});

392406393407

test("agent forwards image attachments as images[]", async () => {

394-

setRegistry(defaultRegistry);

395408

await setTestSessionStore({

396409

entries: {

397410

main: {

@@ -414,7 +427,7 @@ describe("gateway server agent", () => {

414427

});

415428

expect(res.ok).toBe(true);

416429417-

const call = latestAgentCall();

430+

const call = await waitForAgentCall("idem-agent-attachments");

418431

expect(call.sessionKey).toBe("agent:main:main");

419432

expectChannels(call, "webchat");

420433

expect(typeof call.message).toBe("string");

@@ -429,7 +442,6 @@ describe("gateway server agent", () => {

429442

});

430443431444

test("agent errors when delivery requested and no last channel exists", async () => {

432-

setRegistry(defaultRegistry);

433445

testState.allowFrom = ["+1555"];

434446

try {

435447

await setTestSessionStore({

@@ -493,7 +505,6 @@ describe("gateway server agent", () => {

493505

idempotencyKey: "idem-agent-last-signal",

494506

},

495507

])("agent routes main last-channel $name", async (tc) => {

496-

setRegistry(defaultRegistry);

497508

await setTestSessionStore({

498509

entries: {

499510

main: {

@@ -513,7 +524,7 @@ describe("gateway server agent", () => {

513524

});

514525

expect(res.ok).toBe(true);

515526516-

const call = latestAgentCall();

527+

const call = await waitForAgentCall(tc.idempotencyKey);

517528

expectChannels(call, tc.lastChannel);

518529

expect(call.to).toBe(tc.lastTo);

519530

expect(call.deliver).toBe(true);