diff --git a/crates/buzz-agent/src/config.rs b/crates/buzz-agent/src/config.rs index 1d5a3df3b..3d9557a1a 100644 --- a/crates/buzz-agent/src/config.rs +++ b/crates/buzz-agent/src/config.rs @@ -3,7 +3,10 @@ use std::time::Duration; pub const PROTOCOL_VERSION: u32 = 2; pub const MAX_PROMPT_BYTES: usize = 1024 * 1024; -pub const MAX_SYSTEM_PROMPT_BYTES: usize = 512 * 1024; +/// Ceiling on the combined system prompt (harness prompt + persona + hints). +/// Raised from 512 KiB to 1 MiB to fit large discovered skill/AGENTS.md hint +/// sections; matches `MAX_PROMPT_BYTES`. +pub const MAX_SYSTEM_PROMPT_BYTES: usize = 1024 * 1024; /// Total per-result byte ceiling (text + images). Sized for image-bearing /// results — view_image can legitimately return multi-MiB base64 payloads. /// Text is governed by the much smaller `BUZZ_AGENT_MAX_TOOL_RESULT_TEXT_BYTES`. diff --git a/crates/buzz-agent/src/lib.rs b/crates/buzz-agent/src/lib.rs index 5e4988b23..cec1cdc7a 100644 --- a/crates/buzz-agent/src/lib.rs +++ b/crates/buzz-agent/src/lib.rs @@ -285,7 +285,7 @@ async fn session_new(app: &Arc, id: Value, params: Value, wire_tx: &WireSen } else { format!("{base}\n\n{hints}") }; - // Reject combined prompts exceeding 512KB. + // Reject combined prompts exceeding MAX_SYSTEM_PROMPT_BYTES. if prompt.len() > MAX_SYSTEM_PROMPT_BYTES { return reject( wire_tx, diff --git a/crates/buzz-agent/tests/fake_llm.rs b/crates/buzz-agent/tests/fake_llm.rs index e3e83a6f0..4fcc5ae73 100644 --- a/crates/buzz-agent/tests/fake_llm.rs +++ b/crates/buzz-agent/tests/fake_llm.rs @@ -423,7 +423,7 @@ async fn rejects_oversized_line() { #[tokio::test(flavor = "multi_thread", worker_threads = 2)] async fn session_new_rejects_oversized_system_prompt() { - // A systemPrompt exceeding 512KB must produce a JSON-RPC error, not a panic. + // A systemPrompt exceeding 1 MiB must produce a JSON-RPC error, not a panic. let url = spawn_fake_llm(vec![]).await; let mut h = Harness::spawn(&url).await; h.send( @@ -434,8 +434,8 @@ async fn session_new_rejects_oversized_system_prompt() { let r = h.recv().await; assert_eq!(r["result"]["protocolVersion"], 2); - // 600KB payload — exceeds the 512KB limit. - let big_prompt = "x".repeat(600 * 1024); + // 1100KB payload — exceeds the 1 MiB limit. + let big_prompt = "x".repeat(1100 * 1024); let id = h .send( "session/new", @@ -449,8 +449,8 @@ async fn session_new_rejects_oversized_system_prompt() { ); let err_msg = r["error"]["message"].as_str().unwrap_or(""); assert!( - err_msg.contains("512KB limit"), - "error message should mention 512KB limit, got: {err_msg}" + err_msg.contains("1024KB limit"), + "error message should mention 1024KB limit, got: {err_msg}" ); h.shutdown().await; }