diff --git a/src/cli/bootstrap-external.ts b/src/cli/bootstrap-external.ts index 44e3baeeef7..08b16d5ac59 100644 --- a/src/cli/bootstrap-external.ts +++ b/src/cli/bootstrap-external.ts @@ -357,6 +357,25 @@ async function ensureDefaultWorkspacePath( }); } +async function ensureSubagentDefaults(openclawCommand: string, profile: string): Promise { + const settings: Array<[string, string]> = [ + ["agents.defaults.subagents.maxConcurrent", "8"], + ["agents.defaults.subagents.maxSpawnDepth", "2"], + ["agents.defaults.subagents.maxChildrenPerAgent", "10"], + ["agents.defaults.subagents.archiveAfterMinutes", "180"], + ["agents.defaults.subagents.runTimeoutSeconds", "0"], + ["tools.subagents.tools.deny", "[]"], + ]; + for (const [key, value] of settings) { + await runOpenClawOrThrow({ + openclawCommand, + args: ["--profile", profile, "config", "set", key, value], + timeoutMs: 10_000, + errorMessage: `Failed to set ${key}=${value}.`, + }); + } +} + async function probeForWebApp(port: number): Promise { const controller = new AbortController(); const timer = setTimeout(() => controller.abort(), 1_500); @@ -1355,6 +1374,8 @@ export async function bootstrapCommand( // the same gateway target on subsequent requests. await ensureGatewayPort(openclawCommand, profile, gatewayPort); + await ensureSubagentDefaults(openclawCommand, profile); + let gatewayProbe = await probeGateway(openclawCommand, profile, gatewayPort); let gatewayAutoFix: GatewayAutoFixResult | undefined; if (!gatewayProbe.ok) {