fix: Disable memfs for newly spawned subagents [LET-7975] (#1371)

This commit is contained in:
Devansh Jain
2026-03-12 18:10:10 -07:00
committed by GitHub
parent 9281afc4a4
commit c52ed0525f
2 changed files with 12 additions and 15 deletions

View File

@@ -534,6 +534,9 @@ export function buildSubagentArgs(
// Create new agent (original behavior) // Create new agent (original behavior)
args.push("--new-agent", "--system", type); args.push("--new-agent", "--system", type);
args.push("--tags", `type:${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) { if (model) {
args.push("--model", model); args.push("--model", model);
} }
@@ -575,9 +578,6 @@ export function buildSubagentArgs(
if (!isDeployingExisting) { if (!isDeployingExisting) {
if (config.memoryBlocks === "none") { if (config.memoryBlocks === "none") {
args.push("--init-blocks", "none"); args.push("--init-blocks", "none");
if (config.mode === "stateless") {
args.push("--no-memfs");
}
} else if ( } else if (
Array.isArray(config.memoryBlocks) && Array.isArray(config.memoryBlocks) &&
config.memoryBlocks.length > 0 config.memoryBlocks.length > 0

View File

@@ -121,7 +121,7 @@ describe("resolveSubagentLauncher", () => {
}); });
describe("buildSubagentArgs", () => { describe("buildSubagentArgs", () => {
const baseConfig: Omit<SubagentConfig, "mode"> = { const baseConfig: SubagentConfig = {
name: "test-subagent", name: "test-subagent",
description: "test", description: "test",
systemPrompt: "test prompt", systemPrompt: "test prompt",
@@ -129,31 +129,28 @@ describe("buildSubagentArgs", () => {
recommendedModel: "inherit", recommendedModel: "inherit",
skills: [], skills: [],
memoryBlocks: "none", memoryBlocks: "none",
mode: "stateful",
}; };
test("adds --no-memfs for stateless subagents with memoryBlocks none", () => { test("adds --no-memfs for newly spawned subagents by default", () => {
const args = buildSubagentArgs( const args = buildSubagentArgs("test-subagent", baseConfig, null, "hello");
"test-subagent",
{ ...baseConfig, mode: "stateless" },
null,
"hello",
);
expect(args).toContain("--init-blocks"); expect(args).toContain("--init-blocks");
expect(args).toContain("none"); expect(args).toContain("none");
expect(args).toContain("--no-memfs"); 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( const args = buildSubagentArgs(
"test-subagent", "test-subagent",
{ ...baseConfig, mode: "stateful" }, baseConfig,
null, null,
"hello", "hello",
"agent-existing",
); );
expect(args).toContain("--init-blocks"); expect(args).toContain("--agent");
expect(args).toContain("none"); expect(args).not.toContain("--new-agent");
expect(args).not.toContain("--no-memfs"); expect(args).not.toContain("--no-memfs");
}); });
}); });