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

推荐订阅源

博客园_首页
量子位
D
DataBreaches.Net
博客园 - 司徒正美
J
Java Code Geeks
博客园 - 【当耐特】
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
aimingoo的专栏
aimingoo的专栏
B
Blog
The Cloudflare Blog
D
Docker
I
InfoQ
爱范儿
爱范儿
MongoDB | Blog
MongoDB | Blog
腾讯CDC
月光博客
月光博客
Hugging Face - Blog
Hugging Face - Blog
Microsoft Azure Blog
Microsoft Azure Blog
Vercel News
Vercel News
阮一峰的网络日志
阮一峰的网络日志
小众软件
小众软件
S
SegmentFault 最新的问题
GbyAI
GbyAI
有赞技术团队
有赞技术团队

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
refactor(acp): remove unused reset helper · openclaw/open...
vincentkoc · 2026-06-17 · via Recent Commits to openclaw:main
1-

/** Tests configured ACP binding lifecycle and in-place reset behavior. */

1+

/** Tests configured ACP binding lifecycle behavior. */

22

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

33

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

44

import {

@@ -13,14 +13,6 @@ const managerMocks = vi.hoisted(() => ({

1313

updateSessionRuntimeOptions: vi.fn(),

1414

}));

151516-

const sessionMetaMocks = vi.hoisted(() => ({

17-

readAcpSessionEntry: vi.fn(),

18-

}));

19-20-

const resolveMocks = vi.hoisted(() => ({

21-

resolveConfiguredAcpBindingSpecBySessionKey: vi.fn(),

22-

}));

23-2416

vi.mock("./control-plane/manager.js", () => ({

2517

getAcpSessionManager: () => ({

2618

resolveSession: managerMocks.resolveSession,

@@ -30,14 +22,6 @@ vi.mock("./control-plane/manager.js", () => ({

3022

}),

3123

}));

322433-

vi.mock("./runtime/session-meta.js", () => ({

34-

readAcpSessionEntry: sessionMetaMocks.readAcpSessionEntry,

35-

}));

36-37-

vi.mock("./persistent-bindings.resolve.js", () => ({

38-

resolveConfiguredAcpBindingSpecBySessionKey:

39-

resolveMocks.resolveConfiguredAcpBindingSpecBySessionKey,

40-

}));

4125

const baseCfg = {

4226

session: { mainKey: "main", scope: "per-sender" },

4327

agents: {

@@ -46,7 +30,6 @@ const baseCfg = {

4630

} satisfies OpenClawConfig;

47314832

let ensureConfiguredAcpBindingSession: typeof import("./persistent-bindings.lifecycle.js").ensureConfiguredAcpBindingSession;

49-

let resetAcpSessionInPlace: typeof import("./persistent-bindings.lifecycle.js").resetAcpSessionInPlace;

50335134

beforeEach(async () => {

5235

vi.resetModules();

@@ -57,10 +40,7 @@ beforeEach(async () => {

5740

});

5841

managerMocks.initializeSession.mockReset().mockResolvedValue(undefined);

5942

managerMocks.updateSessionRuntimeOptions.mockReset().mockResolvedValue(undefined);

60-

sessionMetaMocks.readAcpSessionEntry.mockReset().mockReturnValue(undefined);

61-

resolveMocks.resolveConfiguredAcpBindingSpecBySessionKey.mockReset().mockReturnValue(null);

62-

({ ensureConfiguredAcpBindingSession, resetAcpSessionInPlace } =

63-

await import("./persistent-bindings.lifecycle.js"));

43+

({ ensureConfiguredAcpBindingSession } = await import("./persistent-bindings.lifecycle.js"));

6444

});

65456646

function createPersistentSpec(

@@ -192,114 +172,3 @@ describe("ensureConfiguredAcpBindingSession", () => {

192172

expect(initializeArgs.agent).toBe("codex");

193173

});

194174

});

195-196-

describe("resetAcpSessionInPlace", () => {

197-

it("clears configured bindings and lets the next turn recreate them", async () => {

198-

const spec = {

199-

channel: "demo-binding",

200-

accountId: "default",

201-

conversationId: "9373ab192b2317f4",

202-

agentId: "claude",

203-

mode: "persistent",

204-

backend: "acpx",

205-

cwd: "/home/bob/clawd",

206-

} as const;

207-

const sessionKey = buildConfiguredAcpSessionKey(spec);

208-

resolveMocks.resolveConfiguredAcpBindingSpecBySessionKey.mockReturnValue(spec);

209-

sessionMetaMocks.readAcpSessionEntry.mockReturnValue({

210-

acp: {

211-

agent: "claude",

212-

mode: "persistent",

213-

backend: "acpx",

214-

runtimeOptions: { cwd: "/home/bob/clawd" },

215-

},

216-

});

217-218-

const result = await resetAcpSessionInPlace({

219-

cfg: baseCfg,

220-

sessionKey,

221-

reason: "reset",

222-

});

223-224-

expect(result).toEqual({ ok: true });

225-

expect(resolveMocks.resolveConfiguredAcpBindingSpecBySessionKey).toHaveBeenCalledTimes(1);

226-

const closeArgs = expectCloseArgs();

227-

expect(closeArgs.sessionKey).toBe(sessionKey);

228-

expect(closeArgs.discardPersistentState).toBe(true);

229-

expect(closeArgs.clearMeta).toBe(true);

230-

expect(managerMocks.initializeSession).not.toHaveBeenCalled();

231-

expect(managerMocks.updateSessionRuntimeOptions).not.toHaveBeenCalled();

232-

});

233-234-

it("falls back to close-only resets when no configured binding exists", async () => {

235-

const sessionKey = "agent:claude:acp:binding:demo-binding:default:9373ab192b2317f4";

236-

sessionMetaMocks.readAcpSessionEntry.mockReturnValue({

237-

acp: {

238-

agent: "claude",

239-

mode: "persistent",

240-

backend: "acpx",

241-

},

242-

});

243-244-

const result = await resetAcpSessionInPlace({

245-

cfg: baseCfg,

246-

sessionKey,

247-

reason: "reset",

248-

});

249-250-

expect(result).toEqual({ ok: true });

251-

expect(resolveMocks.resolveConfiguredAcpBindingSpecBySessionKey).toHaveBeenCalledTimes(1);

252-

const closeArgs = expectCloseArgs();

253-

expect(closeArgs.sessionKey).toBe(sessionKey);

254-

expect(closeArgs.clearMeta).toBe(false);

255-

expect(managerMocks.initializeSession).not.toHaveBeenCalled();

256-

});

257-258-

it("can force metadata clearing for bound ACP targets outside the configured registry", async () => {

259-

const sessionKey = "agent:claude:acp:binding:demo-binding:default:9373ab192b2317f4";

260-

sessionMetaMocks.readAcpSessionEntry.mockReturnValue({

261-

acp: {

262-

agent: "claude",

263-

mode: "persistent",

264-

backend: "acpx",

265-

},

266-

});

267-268-

const result = await resetAcpSessionInPlace({

269-

cfg: baseCfg,

270-

sessionKey,

271-

reason: "new",

272-

clearMeta: true,

273-

});

274-275-

expect(result).toEqual({ ok: true });

276-

expect(resolveMocks.resolveConfiguredAcpBindingSpecBySessionKey).toHaveBeenCalledTimes(1);

277-

const closeArgs = expectCloseArgs();

278-

expect(closeArgs.sessionKey).toBe(sessionKey);

279-

expect(closeArgs.clearMeta).toBe(true);

280-

});

281-282-

it("treats configured bindings with no ACP metadata as already reset", async () => {

283-

const spec = {

284-

channel: "demo-binding",

285-

accountId: "default",

286-

conversationId: "9373ab192b2317f4",

287-

agentId: "claude",

288-

mode: "persistent",

289-

backend: "acpx",

290-

cwd: "/home/bob/clawd",

291-

} as const;

292-

const sessionKey = buildConfiguredAcpSessionKey(spec);

293-

resolveMocks.resolveConfiguredAcpBindingSpecBySessionKey.mockReturnValue(spec);

294-295-

const result = await resetAcpSessionInPlace({

296-

cfg: baseCfg,

297-

sessionKey,

298-

reason: "new",

299-

});

300-301-

expect(result).toEqual({ ok: true });

302-

expect(managerMocks.closeSession).not.toHaveBeenCalled();

303-

expect(managerMocks.initializeSession).not.toHaveBeenCalled();

304-

});

305-

});