fix(auto-reply): guard empty rpc prompt

This commit is contained in:
Peter Steinberger
2025-12-10 14:26:03 +00:00
parent fd3516bc82
commit b61147aed0

View File

@@ -565,7 +565,13 @@ export async function runCommandReply(
const runId = params.runId ?? crypto.randomUUID();
const rpcPromptIndex =
promptIndex >= 0 ? promptIndex : finalArgv.length - 1;
const body = promptArg ?? "";
let body = promptArg ?? "";
if (!body || !body.trim()) {
body = templatingCtx.Body ?? templatingCtx.BodyStripped ?? "";
}
logVerbose(
`pi rpc prompt (${body.length} chars): ${body.slice(0, 200).replace(/\n/g, "\\n")}`,
);
// Build rpc args without the prompt body; force --mode rpc.
const rpcArgvForRun = (() => {
const copy = [...finalArgv];