fix(agent-pod): clone deterministically, not through a headless LLM call

git clone is mechanical -- routing it through spawnPi meant a crash gave zero diagnostic output, just a silent exit code. Direct runGit call now, same as commitPending/the squash-merge sequence. Drops the now-unused runStageWithResolver.
This commit is contained in:
Story Crater Bot
2026-08-18 18:57:18 -07:00
parent e204f0c050
commit 67e55ec868
+10 -10
View File
@@ -159,14 +159,6 @@ data:
return parseVerdictLine(result.lastText, "RESOLUTION"); return parseVerdictLine(result.lastText, "RESOLUTION");
} }
async function runStageWithResolver(cwd, stage, prompt, task) {
let result = await spawnPi({ agent: stage, prompt, cwd });
if (result.code === 0) return result;
const resolution = await askResolver(cwd, task, `Stage "${stage}" exited with code ${result.code}. Its stderr tail:\n${result.stderrTail}`);
if (resolution === "RETRY") result = await spawnPi({ agent: stage, prompt, cwd });
return result;
}
function taskSessionLabel(task) { function taskSessionLabel(task) {
return `task-${task.replace(/[^a-zA-Z0-9]/g, "-")}`; return `task-${task.replace(/[^a-zA-Z0-9]/g, "-")}`;
} }
@@ -666,8 +658,16 @@ data:
return pipelineSession; return pipelineSession;
}; };
const clone = await runStageWithResolver(cwd, "planner", `Run exactly this command, verbatim, no variation: git clone --branch ${baseBranch} ${repo} . -- the trailing dot is required, it clones directly into the current directory instead of creating a subdirectory. Do not cd anywhere first or after. Do nothing else.`, "clone"); // Deterministic, not routed through an LLM -- clone is 100% mechanical
if (clone.code !== 0) return finish("clone-crashed"); // (same reasoning as commitPending/the squash-merge sequence below), and
// was the one place left that broke that pattern: a headless spawnPi
// call here meant a crash gave zero diagnostic output, just a silent
// exit code with nothing to debug from.
const clone = await runGit(cwd, ["clone", "--branch", baseBranch, repo, "."]);
if (clone.code !== 0) {
pipelineSession.gitError = clone.out;
return finish("clone-crashed");
}
if (!fs.existsSync(path.join(cwd, ".git"))) return finish("clone-missing"); if (!fs.existsSync(path.join(cwd, ".git"))) return finish("clone-missing");
// No --tasks given: discover the phase/task board from the repo's own // No --tasks given: discover the phase/task board from the repo's own