Fix subagent output paths and deepresearch robustness

This commit is contained in:
Advait Paliwal
2026-04-17 18:00:24 -07:00
parent 6f3eeea75b
commit 40939859b9
7 changed files with 190 additions and 13 deletions

View File

@@ -238,6 +238,75 @@ export function patchPiSubagentsSource(relativePath, source) {
"\t\t...(modelOverrides[index] ? { model: modelOverrides[index] } : {}),",
].join("\n"),
);
patched = replaceAll(
patched,
[
"\t\t\t\tcwd: t.cwd,",
"\t\t\t\t...(modelOverrides[i] ? { model: modelOverrides[i] } : {}),",
].join("\n"),
[
"\t\t\t\tcwd: t.cwd,",
"\t\t\t\toutput: t.output,",
"\t\t\t\t...(modelOverrides[i] ? { model: modelOverrides[i] } : {}),",
].join("\n"),
);
patched = replaceAll(
patched,
[
"\t\tcwd: t.cwd,",
"\t\t...(modelOverrides[i] ? { model: modelOverrides[i] } : {}),",
].join("\n"),
[
"\t\tcwd: t.cwd,",
"\t\toutput: t.output,",
"\t\t...(modelOverrides[i] ? { model: modelOverrides[i] } : {}),",
].join("\n"),
);
patched = replaceAll(
patched,
[
"\t\tconst behaviors = agentConfigs.map((c, i) =>",
"\t\t\tresolveStepBehavior(c, { skills: skillOverrides[i] }),",
"\t\t);",
].join("\n"),
[
"\t\tconst behaviors = agentConfigs.map((c, i) =>",
"\t\t\tresolveStepBehavior(c, { output: tasks[i]?.output, skills: skillOverrides[i] }),",
"\t\t);",
].join("\n"),
);
patched = replaceAll(
patched,
"\tconst behaviors = agentConfigs.map((config) => resolveStepBehavior(config, {}));",
"\tconst behaviors = agentConfigs.map((config, i) => resolveStepBehavior(config, { output: tasks[i]?.output, skills: skillOverrides[i] }));",
);
patched = replaceAll(
patched,
[
"\t\tconst taskCwd = resolveParallelTaskCwd(task, input.paramsCwd, input.worktreeSetup, index);",
"\t\treturn runSync(input.ctx.cwd, input.agents, task.agent, input.taskTexts[index]!, {",
].join("\n"),
[
"\t\tconst taskCwd = resolveParallelTaskCwd(task, input.paramsCwd, input.worktreeSetup, index);",
"\t\tconst outputPath = typeof input.behaviors[index]?.output === \"string\"",
"\t\t\t? resolveSingleOutputPath(input.behaviors[index]?.output, input.ctx.cwd, taskCwd)",
"\t\t\t: undefined;",
"\t\tconst taskText = injectSingleOutputInstruction(input.taskTexts[index]!, outputPath);",
"\t\treturn runSync(input.ctx.cwd, input.agents, task.agent, taskText, {",
].join("\n"),
);
patched = replaceAll(
patched,
[
"\t\t\tmaxOutput: input.maxOutput,",
"\t\t\tmaxSubagentDepth: input.maxSubagentDepths[index],",
].join("\n"),
[
"\t\t\tmaxOutput: input.maxOutput,",
"\t\t\toutputPath,",
"\t\t\tmaxSubagentDepth: input.maxSubagentDepths[index],",
].join("\n"),
);
break;
case "schemas.ts":
patched = replaceAll(

View File

@@ -147,8 +147,8 @@ function prepareWorkspace(packageSpecs) {
const result = spawnSync(
process.env.npm_execpath ? process.execPath : "npm",
process.env.npm_execpath
? [process.env.npm_execpath, "install", "--prefer-offline", "--no-audit", "--no-fund", "--no-dry-run", "--legacy-peer-deps", "--loglevel", "error", "--prefix", workspaceDir, ...packageSpecs]
: ["install", "--prefer-offline", "--no-audit", "--no-fund", "--no-dry-run", "--legacy-peer-deps", "--loglevel", "error", "--prefix", workspaceDir, ...packageSpecs],
? [process.env.npm_execpath, "install", "--prefer-online", "--no-audit", "--no-fund", "--no-dry-run", "--legacy-peer-deps", "--loglevel", "error", "--prefix", workspaceDir, ...packageSpecs]
: ["install", "--prefer-online", "--no-audit", "--no-fund", "--no-dry-run", "--legacy-peer-deps", "--loglevel", "error", "--prefix", workspaceDir, ...packageSpecs],
{ stdio: "inherit", env: childNpmInstallEnv() },
);
if (result.status !== 0) {