fix(qa): expose codex tools for runtime parity

This commit is contained in:
Vincent Koc
2026-05-17 06:46:27 +08:00
parent 2c9f68f42b
commit 37dcf385e5
15 changed files with 454 additions and 48 deletions

View File

@@ -346,6 +346,7 @@ export function createOpenClawTools(
!embedded ||
options?.sourceReplyDeliveryMode === "message_tool_only" ||
messageExplicitlyAllowed;
const includeSubagentSpawnTool = !embedded || options?.allowGatewaySubagentBinding === true;
const effectiveCallGateway = embedded
? createEmbeddedCallGateway()
: openClawToolsDeps.callGateway;
@@ -424,6 +425,9 @@ export function createOpenClawTools(
config: resolvedConfig,
callGateway: openClawToolsDeps.callGateway,
}),
]),
...(includeSubagentSpawnTool
? [
createSessionsSpawnTool({
agentSessionKey: options?.agentSessionKey,
agentChannel: options?.agentChannel,
@@ -441,7 +445,8 @@ export function createOpenClawTools(
inheritedToolAllowlist: options?.inheritedToolAllowlist,
inheritedToolDenylist: options?.inheritedToolDenylist,
}),
]),
]
: []),
createSessionsYieldTool({
sessionId: options?.sessionId,
onYield: options?.onYield,

View File

@@ -123,6 +123,24 @@ describe("openclaw-tools update_plan gating", () => {
expect(toolNames(denied)).not.toContain("message");
});
it("keeps subagent spawn available for trusted embedded gateway-bound runs", () => {
setEmbeddedMode(true);
const defaultTools = createOpenClawTools({
config: {} as OpenClawConfig,
disablePluginTools: true,
});
const gatewayBoundTools = createOpenClawTools({
config: {} as OpenClawConfig,
disablePluginTools: true,
allowGatewaySubagentBinding: true,
});
expect(toolNames(defaultTools)).not.toContain("sessions_spawn");
expect(toolNames(defaultTools)).not.toContain("sessions_send");
expect(toolNames(gatewayBoundTools)).toContain("sessions_spawn");
expect(toolNames(gatewayBoundTools)).not.toContain("sessions_send");
});
it("registers update_plan when explicitly enabled", () => {
const config = {
tools: {