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

推荐订阅源

月光博客
月光博客
罗磊的独立博客
The GitHub Blog
The GitHub Blog
V
V2EX
Last Week in AI
Last Week in AI
博客园 - 聂微东
MyScale Blog
MyScale Blog
美团技术团队
L
LangChain Blog
博客园 - Franky
腾讯CDC
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
博客园_首页
S
SegmentFault 最新的问题
爱范儿
爱范儿
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Stack Overflow Blog
Stack Overflow Blog
量子位
小众软件
小众软件
宝玉的分享
宝玉的分享
J
Java Code Geeks
Google DeepMind News
Google DeepMind News
D
Docker
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报

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 /acp spawn cwd inheritance for target agent workspace...
summerview19 · 2026-05-31 · via Recent Commits to openclaw:main
1+

import fs from "node:fs/promises";

2+

import os from "node:os";

3+

import path from "node:path";

14

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

25

import { AcpRuntimeError } from "../../acp/runtime/errors.js";

36

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

@@ -95,6 +98,27 @@ vi.mock("../../agents/acp-spawn.js", () => ({

9598

params.cfg?.agents?.defaults?.sandbox?.mode === "all"

9699

? 'Sandboxed sessions cannot spawn ACP sessions because runtime="acp" runs on the host. Use runtime="subagent" from sandboxed sessions.'

97100

: undefined,

101+

resolveRuntimeCwdForAcpSpawn: async (params: {

102+

explicitCwd?: string;

103+

resolvedCwd?: string;

104+

}) => {

105+

if (params.explicitCwd) {

106+

return params.resolvedCwd;

107+

}

108+

if (!params.resolvedCwd) {

109+

return undefined;

110+

}

111+

try {

112+

await fs.access(params.resolvedCwd);

113+

return params.resolvedCwd;

114+

} catch (error) {

115+

const code = error instanceof Error ? (error as NodeJS.ErrnoException).code : undefined;

116+

if (code === "ENOENT" || code === "ENOTDIR") {

117+

return undefined;

118+

}

119+

throw error;

120+

}

121+

},

98122

}));

99123100124

vi.mock("../../config/sessions.js", async () => {

@@ -1162,6 +1186,73 @@ describe("/acp command", () => {

11621186

expect(seededWithoutEntry?.runtimeSessionName).toContain(":runtime");

11631187

});

116411881189+

it("inherits the target agent workspace when /acp spawn omits --cwd", async () => {

1190+

hoisted.ensureSessionMock.mockResolvedValueOnce({

1191+

sessionKey: "agent:codex:acp:s2",

1192+

backend: "acpx",

1193+

runtimeSessionName: "agent:codex:acp:s2:runtime",

1194+

agentSessionId: "codex-inner-2",

1195+

backendSessionId: "acpx-2",

1196+

});

1197+1198+

const workspace = await fs.mkdtemp(path.join(os.tmpdir(), "openclaw-codex-"));

1199+

try {

1200+

const cfg = {

1201+

...baseCfg,

1202+

agents: {

1203+

list: [

1204+

{

1205+

id: "codex",

1206+

workspace,

1207+

},

1208+

],

1209+

},

1210+

} satisfies OpenClawConfig;

1211+1212+

const result = await runDiscordAcpCommand("/acp spawn codex", cfg);

1213+1214+

expect(result?.reply?.text).toContain("Spawned ACP session agent:codex:acp:");

1215+

expectMockCallFields(hoisted.ensureSessionMock, {

1216+

agent: "codex",

1217+

mode: "persistent",

1218+

cwd: workspace,

1219+

});

1220+

} finally {

1221+

await fs.rm(workspace, { recursive: true, force: true });

1222+

}

1223+

});

1224+1225+

it("falls back to the backend default cwd when the inherited target workspace is missing", async () => {

1226+

hoisted.ensureSessionMock.mockResolvedValueOnce({

1227+

sessionKey: "agent:codex:acp:s3",

1228+

backend: "acpx",

1229+

runtimeSessionName: "agent:codex:acp:s3:runtime",

1230+

agentSessionId: "codex-inner-3",

1231+

backendSessionId: "acpx-3",

1232+

});

1233+1234+

const cfg = {

1235+

...baseCfg,

1236+

agents: {

1237+

list: [

1238+

{

1239+

id: "codex",

1240+

workspace: "/home/bob/codex-workspace-missing",

1241+

},

1242+

],

1243+

},

1244+

} satisfies OpenClawConfig;

1245+1246+

const result = await runDiscordAcpCommand("/acp spawn codex", cfg);

1247+1248+

expect(result?.reply?.text).toContain("Spawned ACP session agent:codex:acp:");

1249+

expectMockCallFields(hoisted.ensureSessionMock, {

1250+

agent: "codex",

1251+

mode: "persistent",

1252+

cwd: undefined,

1253+

});

1254+

});

1255+11651256

it("persists ACP spawn labels without a nested gateway self-call", async () => {

11661257

const params = createDiscordParams("/acp spawn codex --bind here --label inbox");

11671258