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:
@@ -112,13 +112,14 @@ fn run_agent_pty_blocking(
|
|||||||
// Launch mode: resume an existing session or start fresh.
|
// Launch mode: resume an existing session or start fresh.
|
||||||
if let Some(sid) = session_id_to_resume {
|
if let Some(sid) = session_id_to_resume {
|
||||||
// Resume: --resume <session_id> restores previous conversation context.
|
// 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("--resume");
|
||||||
cmd.arg(sid);
|
cmd.arg(sid);
|
||||||
if !prompt.is_empty() {
|
cmd.arg("-p");
|
||||||
cmd.arg("-p");
|
cmd.arg(prompt);
|
||||||
cmd.arg(prompt);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
// Fresh session: deliver the full rendered prompt via -p.
|
// Fresh session: deliver the full rendered prompt via -p.
|
||||||
cmd.arg("-p");
|
cmd.arg("-p");
|
||||||
|
|||||||
Reference in New Issue
Block a user