diff --git a/crates/mcp/src/intake.rs b/crates/mcp/src/intake.rs index 272c2a6ec..35a7bb17a 100644 --- a/crates/mcp/src/intake.rs +++ b/crates/mcp/src/intake.rs @@ -146,10 +146,15 @@ impl Shared { fn long_running(&self, st: &State) -> Option { let r = st.running.as_ref()?; let secs = r.since.elapsed(); - (secs >= self.busy_after).then(|| json!({"running": r.label, "requestId": r.key, "seconds": secs.as_secs()})) + // A long id isn't repeated: every busy reply would carry it twice. + let key = r.key.as_deref().filter(|k| k.len() <= MAX_ECHOED_ID); + (secs >= self.busy_after).then(|| json!({"running": r.label, "requestId": key, "seconds": secs.as_secs()})) } } +/// The longest running request id a busy reply repeats (as JSON, quotes included). +const MAX_ECHOED_ID: usize = 256; + /// The id of a request message: `Some` when `msg` is a JSON-RPC 2.0 request with a usable id. fn request_id(msg: &Value) -> Option<&Value> { let o = msg.as_object()?;