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

推荐订阅源

V
V2EX
J
Java Code Geeks
月光博客
月光博客
博客园_首页
The GitHub Blog
The GitHub Blog
Vercel News
Vercel News
B
Blog RSS Feed
博客园 - 聂微东
宝玉的分享
宝玉的分享
T
Tailwind CSS Blog
Jina AI
Jina AI
S
SegmentFault 最新的问题
B
Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
有赞技术团队
有赞技术团队
Hugging Face - Blog
Hugging Face - Blog
Google DeepMind News
Google DeepMind News
阮一峰的网络日志
阮一峰的网络日志
The Cloudflare Blog
量子位
Martin Fowler
Martin Fowler
博客园 - Franky
大猫的无限游戏
大猫的无限游戏
博客园 - 叶小钗

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(gateway): preserve spawned sessions in configured lis...
steipete · 2026-05-18 · via Recent Commits to openclaw:main

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

1-

import fsSync from "node:fs";

21

import fs from "node:fs/promises";

32

import path from "node:path";

43

import { expect, test, vi } from "vitest";

@@ -456,65 +455,100 @@ test("lists and patches session store via sessions.* RPC", async () => {

456455

);

457456

});

458457459-

test("sessions.list configuredAgentsOnly hides disk-discovered unregistered agent stores", async () => {

458+

test("sessions.list configuredAgentsOnly keeps configured-agent children and hides unrelated stores", async () => {

460459

const stateDir = process.env.OPENCLAW_STATE_DIR;

461460

if (!stateDir) {

462461

throw new Error("OPENCLAW_STATE_DIR is required for gateway session tests");

463462

}

464463

testState.agentsConfig = { list: [{ id: "main", default: true }] };

464+

const configPath = process.env.OPENCLAW_CONFIG_PATH;

465+

if (!configPath) {

466+

throw new Error("OPENCLAW_CONFIG_PATH is required for gateway session tests");

467+

}

468+

await fs.writeFile(

469+

configPath,

470+

JSON.stringify({ acp: { defaultAgent: "claude", allowedAgents: ["gemini"] } }, null, 2),

471+

"utf-8",

472+

);

465473

testState.sessionConfig = {

466474

store: path.join(stateDir, "agents", "{agentId}", "sessions", "sessions.json"),

467475

};

468476469477

const mainStorePath = path.join(stateDir, "agents", "main", "sessions", "sessions.json");

478+

const acpStorePath = path.join(stateDir, "agents", "claude", "sessions", "sessions.json");

479+

const childStorePath = path.join(stateDir, "agents", "codex", "sessions", "sessions.json");

470480

const diskOnlyStorePath = path.join(stateDir, "agents", "local", "sessions", "sessions.json");

471481

await fs.mkdir(path.dirname(mainStorePath), { recursive: true });

482+

await fs.mkdir(path.dirname(acpStorePath), { recursive: true });

483+

await fs.mkdir(path.dirname(childStorePath), { recursive: true });

472484

await fs.mkdir(path.dirname(diskOnlyStorePath), { recursive: true });

473485

await fs.writeFile(

474486

mainStorePath,

475487

JSON.stringify({ main: { sessionId: "sess-main", updatedAt: 20 } }, null, 2),

476488

"utf-8",

477489

);

490+

await fs.writeFile(

491+

acpStorePath,

492+

JSON.stringify(

493+

{

494+

"agent:claude:acp:25f77580-de30-4d80-9bc3-7cbc6374bce7": {

495+

sessionId: "sess-claude-acp",

496+

updatedAt: 30,

497+

acp: {

498+

backend: "acpx",

499+

agent: "claude",

500+

runtimeSessionName: "agent:claude:acp:25f77580-de30-4d80-9bc3-7cbc6374bce7",

501+

mode: "oneshot",

502+

state: "idle",

503+

lastActivityAt: 30,

504+

},

505+

},

506+

},

507+

null,

508+

2,

509+

),

510+

"utf-8",

511+

);

512+

await fs.writeFile(

513+

childStorePath,

514+

JSON.stringify(

515+

{

516+

"agent:codex:subagent:app-server-child": {

517+

sessionId: "sess-codex-child",

518+

updatedAt: 25,

519+

spawnedBy: "agent:main:main",

520+

},

521+

},

522+

null,

523+

2,

524+

),

525+

"utf-8",

526+

);

478527

await fs.writeFile(

479528

diskOnlyStorePath,

480529

JSON.stringify({ main: { sessionId: "sess-local", updatedAt: 10 } }, null, 2),

481530

"utf-8",

482531

);

483532484-

const readFileSyncSpy = vi.spyOn(fsSync, "readFileSync");

485-

const realDiskOnlyStorePath = await fs.realpath(diskOnlyStorePath);

486-487-

try {

488-

const configuredOnly = await directSessionHandlerReq<{ sessions: Array<{ key: string }> }>(

489-

"sessions.list",

490-

{ includeGlobal: false, includeUnknown: false, configuredAgentsOnly: true },

491-

);

492-

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

493-

expect(configuredOnly.payload?.sessions.map((session) => session.key)).toEqual([

494-

"agent:main:main",

495-

]);

496-

expect(

497-

readFileSyncSpy.mock.calls.some(([file]) => {

498-

if (typeof file !== "string") {

499-

return false;

500-

}

501-

try {

502-

return fsSync.realpathSync.native(file) === realDiskOnlyStorePath;

503-

} catch {

504-

return false;

505-

}

506-

}),

507-

).toBe(false);

508-

} finally {

509-

readFileSyncSpy.mockRestore();

510-

}

533+

const configuredOnly = await directSessionHandlerReq<{ sessions: Array<{ key: string }> }>(

534+

"sessions.list",

535+

{ includeGlobal: false, includeUnknown: false, configuredAgentsOnly: true },

536+

);

537+

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

538+

expect(configuredOnly.payload?.sessions.map((session) => session.key)).toEqual([

539+

"agent:claude:acp:25f77580-de30-4d80-9bc3-7cbc6374bce7",

540+

"agent:codex:subagent:app-server-child",

541+

"agent:main:main",

542+

]);

511543512544

const broad = await directSessionHandlerReq<{ sessions: Array<{ key: string }> }>(

513545

"sessions.list",

514546

{ includeGlobal: false, includeUnknown: false },

515547

);

516548

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

517549

expect(broad.payload?.sessions.map((session) => session.key)).toEqual([

550+

"agent:claude:acp:25f77580-de30-4d80-9bc3-7cbc6374bce7",

551+

"agent:codex:subagent:app-server-child",

518552

"agent:main:main",

519553

"agent:local:main",

520554

]);