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

推荐订阅源

G
Google Developers Blog
Apple Machine Learning Research
Apple Machine Learning Research
小众软件
小众软件
Recent Announcements
Recent Announcements
阮一峰的网络日志
阮一峰的网络日志
IT之家
IT之家
A
About on SuperTechFans
量子位
Engineering at Meta
Engineering at Meta
B
Blog
The Cloudflare Blog
博客园 - 【当耐特】
Hugging Face - Blog
Hugging Face - Blog
Y
Y Combinator Blog
J
Java Code Geeks
D
DataBreaches.Net
aimingoo的专栏
aimingoo的专栏
T
Tailwind CSS Blog
H
Help Net Security
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
V
V2EX
Stack Overflow Blog
Stack Overflow Blog
C
Check Point Blog
酷 壳 – CoolShell
酷 壳 – CoolShell

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(subagents): enforce explicit spawn allowlists · openc...
steipete · 2026-04-27 · via Recent Commits to openclaw:main

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

1414

pruneLegacyStoreKeysMock: vi.fn(),

1515

registerSubagentRunMock: vi.fn(),

1616

emitSessionLifecycleEventMock: vi.fn(),

17+

resolveAgentConfigMock: vi.fn(),

1718

configOverride: {} as Record<string, unknown>,

1819

}));

1920

@@ -46,7 +47,7 @@ describe("spawnSubagentDirect seam flow", () => {

4647

pruneLegacyStoreKeysMock: hoisted.pruneLegacyStoreKeysMock,

4748

registerSubagentRunMock: hoisted.registerSubagentRunMock,

4849

emitSessionLifecycleEventMock: hoisted.emitSessionLifecycleEventMock,

49-

resolveAgentConfig: () => undefined,

50+

resolveAgentConfig: hoisted.resolveAgentConfigMock,

5051

resolveSubagentSpawnModelSelection: () => "openai-codex/gpt-5.4",

5152

resolveSandboxRuntimeStatus: () => ({ sandboxed: false }),

5253

sessionStorePath: "/tmp/subagent-spawn-session-store.json",

@@ -61,6 +62,11 @@ describe("spawnSubagentDirect seam flow", () => {

6162

hoisted.pruneLegacyStoreKeysMock.mockReset();

6263

hoisted.registerSubagentRunMock.mockReset();

6364

hoisted.emitSessionLifecycleEventMock.mockReset();

65+

hoisted.resolveAgentConfigMock.mockReset();

66+

hoisted.resolveAgentConfigMock.mockImplementation(

67+

(cfg: { agents?: { list?: Array<{ id?: string }> } }, agentId: string) =>

68+

cfg.agents?.list?.find((agent) => agent.id === agentId),

69+

);

6470

hoisted.configOverride = createConfigOverride();

6571

installAcceptedSubagentGatewayMock(hoisted.callGatewayMock);

6672

@@ -76,6 +82,84 @@ describe("spawnSubagentDirect seam flow", () => {

7682

);

7783

});

788485+

it("rejects explicit same-agent targets when allowAgents excludes the requester", async () => {

86+

hoisted.configOverride = createConfigOverride({

87+

agents: {

88+

defaults: {

89+

workspace: os.tmpdir(),

90+

},

91+

list: [

92+

{

93+

id: "task-manager",

94+

workspace: "/tmp/workspace-task-manager",

95+

subagents: {

96+

allowAgents: ["planner"],

97+

},

98+

},

99+

{

100+

id: "planner",

101+

workspace: "/tmp/workspace-planner",

102+

},

103+

],

104+

},

105+

});

106+107+

const result = await spawnSubagentDirect(

108+

{

109+

task: "spawn myself explicitly",

110+

agentId: "task-manager",

111+

},

112+

{

113+

agentSessionKey: "agent:task-manager:main",

114+

},

115+

);

116+117+

expect(result).toMatchObject({

118+

status: "forbidden",

119+

error: "agentId is not allowed for sessions_spawn (allowed: planner)",

120+

});

121+

expect(hoisted.callGatewayMock).not.toHaveBeenCalledWith(

122+

expect.objectContaining({ method: "agent" }),

123+

);

124+

});

125+126+

it("allows omitted agentId to default to requester even when allowAgents excludes requester", async () => {

127+

hoisted.configOverride = createConfigOverride({

128+

agents: {

129+

defaults: {

130+

workspace: os.tmpdir(),

131+

},

132+

list: [

133+

{

134+

id: "task-manager",

135+

workspace: "/tmp/workspace-task-manager",

136+

subagents: {

137+

allowAgents: ["planner"],

138+

},

139+

},

140+

{

141+

id: "planner",

142+

workspace: "/tmp/workspace-planner",

143+

},

144+

],

145+

},

146+

});

147+148+

const result = await spawnSubagentDirect(

149+

{

150+

task: "spawn default target",

151+

},

152+

{

153+

agentSessionKey: "agent:task-manager:main",

154+

},

155+

);

156+157+

expect(result).toMatchObject({

158+

status: "accepted",

159+

childSessionKey: expect.stringMatching(/^agent:task-manager:subagent:/),

160+

});

161+

});

162+79163

it("accepts a spawned run across session patching, runtime-model persistence, registry registration, and lifecycle emission", async () => {

80164

const operations: string[] = [];

81165

let persistedStore: Record<string, Record<string, unknown>> | undefined;