fix(pty): always pass -p on resume so --include-partial-messages works

claude CLI 2.1.97 strictly enforces that --include-partial-messages
requires --print/-p to be set. The resume path skipped -p when the
prompt was empty (which is the common case on respawns when there's
no fresh failure context to inject), so the spawned claude process
saw `--resume <sid> ... --include-partial-messages` without -p and
exited with code 1: "include-partial-messages requires --print and
--output-format=stream-json".

Net effect: every coder respawn with prior_sessions > 0 and empty
prompt was failing immediately, looking exactly like a rate-limit
(empty agent log, zero tool calls). 819 hit retry-limit (4/3) and
got marked blocked because of this — not because of any actual code
or rate-limit issue.

Fix: always pass `-p <prompt>` on resume, even with empty prompt.
This commit is contained in:
dave
2026-04-28 20:14:32 +00:00
parent 20e1210818
commit b060d8fc88
+6 -5
View File
@@ -112,13 +112,14 @@ fn run_agent_pty_blocking(
// Launch mode: resume an existing session or start fresh.
if let Some(sid) = session_id_to_resume {
// Resume: --resume <session_id> restores previous conversation context.
// Only the failure context (prompt) is sent as a new message via -p.
// The failure context (or empty string) is sent as a new message via -p.
// Always pass -p so --include-partial-messages (added below) works:
// claude CLI requires --print/-p to be set when --include-partial-messages
// is used, regardless of whether the prompt is empty.
cmd.arg("--resume");
cmd.arg(sid);
if !prompt.is_empty() {
cmd.arg("-p");
cmd.arg(prompt);
}
cmd.arg("-p");
cmd.arg(prompt);
} else {
// Fresh session: deliver the full rendered prompt via -p.
cmd.arg("-p");