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

推荐订阅源

月光博客
月光博客
Stack Overflow Blog
Stack Overflow Blog
L
LangChain Blog
Jina AI
Jina AI
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
雷峰网
雷峰网
T
Tailwind CSS Blog
MongoDB | Blog
MongoDB | Blog
博客园 - 【当耐特】
博客园 - 聂微东
V
Visual Studio Blog
博客园_首页
Engineering at Meta
Engineering at Meta
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
The Cloudflare Blog
人人都是产品经理
人人都是产品经理
Apple Machine Learning Research
Apple Machine Learning Research
阮一峰的网络日志
阮一峰的网络日志
Microsoft Security Blog
Microsoft Security Blog
GbyAI
GbyAI
F
Fortinet All Blogs
C
Check Point Blog
罗磊的独立博客
H
Hackread – Cybersecurity News, Data Breaches, AI and More

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: dedupe exec host followup mock reads · openclaw/ope...
steipete · 2026-05-13 · via Recent Commits to openclaw:main

@@ -1,4 +1,4 @@

1-

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

1+

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

22

import type { ExecApprovalFollowupTarget } from "./bash-tools.exec-host-shared.js";

33

import type { ExecApprovalFollowupFactory } from "./bash-tools.exec-types.js";

44

@@ -138,6 +138,43 @@ vi.mock("../infra/command-analysis/inline-eval.js", () => ({

138138

let processGatewayAllowlist: typeof import("./bash-tools.exec-host-gateway.js").processGatewayAllowlist;

139139

type GatewayAllowlistParams = Parameters<typeof processGatewayAllowlist>[0];

140140141+

function requireBuildFollowupTargetInput(callIndex: number): ExecApprovalFollowupTarget {

142+

const call = buildExecApprovalFollowupTargetMock.mock.calls[callIndex];

143+

if (!call) {

144+

throw new Error(`expected build followup target call ${callIndex}`);

145+

}

146+

return call[0];

147+

}

148+149+

function requireSentFollowupTarget(

150+

callIndex: number,

151+

): Parameters<SendExecApprovalFollowupResult>[0] {

152+

const call = sendExecApprovalFollowupResultMock.mock.calls[callIndex];

153+

if (!call) {

154+

throw new Error(`expected sent followup call ${callIndex}`);

155+

}

156+

return call[0];

157+

}

158+159+

function requireSentFollowupText(callIndex: number): string {

160+

const call = sendExecApprovalFollowupResultMock.mock.calls[callIndex];

161+

if (!call) {

162+

throw new Error(`expected sent followup call ${callIndex}`);

163+

}

164+

return call[1] ?? "";

165+

}

166+167+

function requireApprovalFollowupInput(

168+

mock: Mock<ExecApprovalFollowupFactory>,

169+

callIndex: number,

170+

): Parameters<ExecApprovalFollowupFactory>[0] {

171+

const call = mock.mock.calls[callIndex];

172+

if (!call) {

173+

throw new Error(`expected approval followup call ${callIndex}`);

174+

}

175+

return call[0];

176+

}

177+141178

describe("processGatewayAllowlist", () => {

142179

beforeAll(async () => {

143180

({ processGatewayAllowlist } = await import("./bash-tools.exec-host-gateway.js"));

@@ -311,10 +348,7 @@ describe("processGatewayAllowlist", () => {

311348

sessionKey: "agent:main:telegram:direct:123",

312349

});

313350314-

const followupTargetInput = buildExecApprovalFollowupTargetMock.mock.calls.at(0)?.[0] as

315-

| { sessionKey?: string }

316-

| undefined;

317-

expect(followupTargetInput?.sessionKey).toBe("agent:main:telegram:direct:123");

351+

expect(requireBuildFollowupTargetInput(0).sessionKey).toBe("agent:main:telegram:direct:123");

318352

});

319353320354

it("formats diagnostics approvals as direct pasteable followups", async () => {

@@ -375,31 +409,18 @@ describe("processGatewayAllowlist", () => {

375409

await vi.waitFor(() => {

376410

expect(sendExecApprovalFollowupResultMock).toHaveBeenCalledTimes(1);

377411

});

378-

const followupTargetInput = buildExecApprovalFollowupTargetMock.mock.calls.at(0)?.[0] as

379-

| { direct?: boolean }

380-

| undefined;

381-

expect(followupTargetInput?.direct).toBe(true);

382-383-

const followupTarget = sendExecApprovalFollowupResultMock.mock.calls.at(0)?.[0] as

384-

| { direct?: boolean }

385-

| null

386-

| undefined;

412+

expect(requireBuildFollowupTargetInput(0).direct).toBe(true);

413+414+

const followupTarget = requireSentFollowupTarget(0);

387415

expect(followupTarget?.direct).toBe(true);

388-

const followupText = sendExecApprovalFollowupResultMock.mock.calls.at(0)?.[1] ?? "";

416+

const followupText = requireSentFollowupText(0);

389417

expect(followupText).toContain("Diagnostics export created.");

390418

expect(followupText).toContain("Path: /tmp/openclaw-diagnostics.zip");

391419

expect(followupText).toContain("Contents (2 files):");

392420

expect(followupText).toContain("OpenAI Codex harness:");

393421

expect(followupText).toContain("Codex diagnostics sent to OpenAI servers:");

394422

expect(followupText).toContain("Codex thread id: `thread-1`");

395-

const approvalInput = approvalFollowup.mock.calls.at(0)?.[0] as

396-

| {

397-

approvalId?: string;

398-

sessionId?: string;

399-

trigger?: string;

400-

outcome?: { status?: string; exitCode?: number | null };

401-

}

402-

| undefined;

423+

const approvalInput = requireApprovalFollowupInput(approvalFollowup, 0);

403424

expect(approvalInput?.approvalId).toBe("req-1");

404425

expect(approvalInput?.sessionId).toBe("sess-1");

405426

expect(approvalInput?.trigger).toBe("diagnostics");