diff --git a/src/agent/subagents/manager.ts b/src/agent/subagents/manager.ts index e1d39c9..e0be8d5 100644 --- a/src/agent/subagents/manager.ts +++ b/src/agent/subagents/manager.ts @@ -534,6 +534,9 @@ export function buildSubagentArgs( // Create new agent (original behavior) args.push("--new-agent", "--system", type); args.push("--tags", `type:${type}`); + // Default all newly spawned subagents to non-memfs mode. + // This avoids memfs startup overhead unless explicitly enabled elsewhere. + args.push("--no-memfs"); if (model) { args.push("--model", model); } @@ -575,9 +578,6 @@ export function buildSubagentArgs( if (!isDeployingExisting) { if (config.memoryBlocks === "none") { args.push("--init-blocks", "none"); - if (config.mode === "stateless") { - args.push("--no-memfs"); - } } else if ( Array.isArray(config.memoryBlocks) && config.memoryBlocks.length > 0 diff --git a/src/tests/agent/subagent-model-resolution.test.ts b/src/tests/agent/subagent-model-resolution.test.ts index 5da54e0..15d8389 100644 --- a/src/tests/agent/subagent-model-resolution.test.ts +++ b/src/tests/agent/subagent-model-resolution.test.ts @@ -121,7 +121,7 @@ describe("resolveSubagentLauncher", () => { }); describe("buildSubagentArgs", () => { - const baseConfig: Omit = { + const baseConfig: SubagentConfig = { name: "test-subagent", description: "test", systemPrompt: "test prompt", @@ -129,31 +129,28 @@ describe("buildSubagentArgs", () => { recommendedModel: "inherit", skills: [], memoryBlocks: "none", + mode: "stateful", }; - test("adds --no-memfs for stateless subagents with memoryBlocks none", () => { - const args = buildSubagentArgs( - "test-subagent", - { ...baseConfig, mode: "stateless" }, - null, - "hello", - ); + test("adds --no-memfs for newly spawned subagents by default", () => { + const args = buildSubagentArgs("test-subagent", baseConfig, null, "hello"); expect(args).toContain("--init-blocks"); expect(args).toContain("none"); expect(args).toContain("--no-memfs"); }); - test("does not add --no-memfs for stateful subagents with memoryBlocks none", () => { + test("does not force --no-memfs when deploying an existing subagent agent", () => { const args = buildSubagentArgs( "test-subagent", - { ...baseConfig, mode: "stateful" }, + baseConfig, null, "hello", + "agent-existing", ); - expect(args).toContain("--init-blocks"); - expect(args).toContain("none"); + expect(args).toContain("--agent"); + expect(args).not.toContain("--new-agent"); expect(args).not.toContain("--no-memfs"); }); });