From 5336d8019623138dd4b8e09ff819e252c8fcf433 Mon Sep 17 00:00:00 2001 From: bflatastic Date: Wed, 14 Oct 2026 02:12:08 +0700 Subject: [PATCH] command_batch: the step whose result passes the size cap says that it ran (#1727) --- crates/mcp/src/tools.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/mcp/src/tools.rs b/crates/mcp/src/tools.rs index 18b68ed5..df3f5a5c 100644 --- a/crates/mcp/src/tools.rs +++ b/crates/mcp/src/tools.rs @@ -967,12 +967,12 @@ fn command_batch(b: &mut dyn Backend, a: &Args) -> Result { let entry = json!({"ok": true, "result": v}); let size = entry.to_string().len(); if kept_bytes.saturating_add(size) > MAX_COMMAND_BATCH_BYTES { - // The results already kept stay; this step's is replaced by the reason the - // batch stops. The loop breaks either way — carrying on would defeat the cap — + // The results already kept stay; this step ran, and its result is replaced by + // the reason the batch stops (saying it ran, so nobody runs it again). The loop breaks either way — carrying on would defeat the cap — // and the atomic group below still closes, as for any stopped batch. failed += 1; values.push(Value::Null); - results.push(json!({"ok": false, "error": format!("batch results exceed {MAX_COMMAND_BATCH_BYTES} bytes; stopping the batch")})); + results.push(json!({"ok": false, "error": format!("this step ran, but the batch's results exceed {MAX_COMMAND_BATCH_BYTES} bytes: its result is dropped and the batch stops here")})); break; } kept_bytes += size;