From b060d8fc8834fd5643fc22cb2adbc053a1665d30 Mon Sep 17 00:00:00 2001 From: dave Date: Tue, 28 Apr 2026 20:14:32 +0000 Subject: [PATCH] fix(pty): always pass -p on resume so --include-partial-messages works MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 ... --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 ` on resume, even with empty prompt. --- server/src/agents/pty/runner.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/server/src/agents/pty/runner.rs b/server/src/agents/pty/runner.rs index b36b3c3b..cd94625c 100644 --- a/server/src/agents/pty/runner.rs +++ b/server/src/agents/pty/runner.rs @@ -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 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");