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

推荐订阅源

博客园 - 司徒正美
大猫的无限游戏
大猫的无限游戏
腾讯CDC
J
Java Code Geeks
博客园 - 【当耐特】
Microsoft Azure Blog
Microsoft Azure Blog
V
Visual Studio Blog
人人都是产品经理
人人都是产品经理
博客园 - Franky
博客园 - 聂微东
阮一峰的网络日志
阮一峰的网络日志
美团技术团队
云风的 BLOG
云风的 BLOG
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
U
Unit 42
雷峰网
雷峰网
B
Blog RSS Feed
博客园_首页
量子位
F
Fortinet All Blogs
罗磊的独立博客
H
Hackread – Cybersecurity News, Data Breaches, AI and More
酷 壳 – CoolShell
酷 壳 – CoolShell
C
Check Point 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] Prefer external session delivery context (#87476) ·...
samzong · 2026-05-29 · via Recent Commits to openclaw:main
11

import fs from "node:fs/promises";

22

import os from "node:os";

33

import path from "node:path";

4-

import { afterAll, beforeAll, beforeEach, describe, expect, it, type Mock } from "vitest";

4+

import { afterAll, beforeAll, beforeEach, describe, expect, it, vi, type Mock } from "vitest";

5+

import { testing as agentStepTesting } from "../agents/tools/agent-step.js";

6+

import { runSessionsSendA2AFlow } from "../agents/tools/sessions-send-tool.a2a.js";

57

import { resolveSessionTranscriptPath } from "../config/sessions.js";

68

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

79

import { emitAgentEvent } from "../infra/agent-events.js";

10+

import { createOutboundTestPlugin, createTestRegistry } from "../test-utils/channel-plugins.js";

811

import { captureEnv } from "../test-utils/env.js";

912

import {

1013

agentCommand,

1114

getFreePort,

1215

installGatewayTestHooks,

1316

startGatewayServer,

17+

setTestPluginRegistry,

1418

testState,

1519

writeSessionStore,

1620

} from "./test-helpers.js";

@@ -171,6 +175,114 @@ describe("sessions_send gateway loopback", () => {

171175

expect(firstCall?.inputProvenance?.kind).toBe("inter_session");

172176

expect(firstCall?.inputProvenance?.sourceTool).toBe("sessions_send");

173177

});

178+179+

it(

180+

"announces through gateway send using external deliveryContext over stale webchat session fields",

181+

{ timeout: SESSION_SEND_E2E_TIMEOUT_MS },

182+

async () => {

183+

const dir = await fs.mkdtemp(path.join(os.tmpdir(), "openclaw-sessions-send-route-"));

184+

const sendCalls: Array<{

185+

to?: string;

186+

text?: string;

187+

accountId?: string | null;

188+

threadId?: string | number | null;

189+

}> = [];

190+

setTestPluginRegistry(

191+

createTestRegistry([

192+

{

193+

pluginId: "whatsapp",

194+

source: "test",

195+

plugin: createOutboundTestPlugin({

196+

id: "whatsapp",

197+

label: "WhatsApp",

198+

outbound: {

199+

deliveryMode: "direct",

200+

resolveTarget: ({ to }) => {

201+

const target = to?.trim();

202+

return target

203+

? { ok: true, to: target }

204+

: { ok: false, error: new Error("missing target") };

205+

},

206+

sendText: async (ctx) => {

207+

sendCalls.push({

208+

to: ctx.to,

209+

text: ctx.text,

210+

accountId: ctx.accountId,

211+

threadId: ctx.threadId,

212+

});

213+

return { channel: "whatsapp", messageId: "wa-proof-msg" };

214+

},

215+

},

216+

messaging: {

217+

normalizeTarget: (raw) => raw,

218+

},

219+

}),

220+

},

221+

]),

222+

);

223+224+

testState.sessionStorePath = path.join(dir, "sessions.json");

225+

try {

226+

await writeSessionStore({

227+

entries: {

228+

"agent:main:whatsapp:direct:peer-1": {

229+

sessionId: "sess-whatsapp-peer",

230+

updatedAt: Date.now(),

231+

channel: "webchat",

232+

lastChannel: "webchat",

233+

lastTo: "session:dashboard",

234+

route: {

235+

channel: "webchat",

236+

target: { to: "session:dashboard" },

237+

},

238+

deliveryContext: {

239+

channel: "whatsapp",

240+

to: "peer-1",

241+

},

242+

origin: {

243+

provider: "whatsapp",

244+

accountId: "work",

245+

threadId: "thread-77",

246+

},

247+

},

248+

},

249+

});

250+251+

agentStepTesting.setDepsForTest({

252+

agentCommandFromIngress: async () => ({

253+

payloads: [{ text: "announce through channel", mediaUrl: null }],

254+

meta: { durationMs: 1 },

255+

}),

256+

});

257+258+

await runSessionsSendA2AFlow({

259+

targetSessionKey: "agent:main:whatsapp:direct:peer-1",

260+

displayKey: "agent:main:whatsapp:direct:peer-1",

261+

message: "ping",

262+

announceTimeoutMs: 5_000,

263+

maxPingPongTurns: 0,

264+

roundOneReply: "target response",

265+

});

266+267+

await vi.waitFor(

268+

() =>

269+

expect(sendCalls).toEqual([

270+

{

271+

to: "peer-1",

272+

text: "announce through channel",

273+

accountId: "work",

274+

threadId: "thread-77",

275+

},

276+

]),

277+

{ timeout: 5_000 },

278+

);

279+

} finally {

280+

agentStepTesting.setDepsForTest();

281+

testState.sessionStorePath = undefined;

282+

await fs.rm(dir, { recursive: true, force: true, maxRetries: 5, retryDelay: 50 });

283+

}

284+

},

285+

);

174286

});

175287176288

describe("sessions_send label lookup", () => {