diff --git a/codex-rs/app-server/src/thread_sample.rs b/codex-rs/app-server/src/thread_sample.rs index 289190f7ae..a170ede9d3 100644 --- a/codex-rs/app-server/src/thread_sample.rs +++ b/codex-rs/app-server/src/thread_sample.rs @@ -55,8 +55,6 @@ use tokio_util::sync::CancellationToken; use tokio_util::task::TaskTracker; const SAMPLE_TIMEOUT: Duration = Duration::from_secs(30); -// Bytes conservatively bound tokens, including for byte-fallback tokenizers. -const MAX_PROMPT_BYTES: usize = 4_000; const MAX_OUTPUT_BYTES: usize = 64 * 1024; const THREAD_SNAPSHOT_NOTE: &str = concat!( "\nThis snapshot is a copy of the source thread’s history taken while its turn was still running. ", @@ -85,13 +83,10 @@ pub(crate) async fn generate_sample( rpc_gate: Arc, ) -> SampleResult { let deadline = Instant::now() + SAMPLE_TIMEOUT; - if task.params.expected_turn_id.trim().is_empty() - || task.params.prompt.trim().is_empty() - || task.params.prompt.len() > MAX_PROMPT_BYTES - { - return Err(invalid_request(format!( - "thread/sample requires expectedTurnId and a prompt of at most {MAX_PROMPT_BYTES} bytes", - ))); + if task.params.expected_turn_id.trim().is_empty() || task.params.prompt.trim().is_empty() { + return Err(invalid_request( + "thread/sample requires a nonblank expectedTurnId and prompt", + )); } let (sender, receiver) = oneshot::channel(); let originator = AuthStorageOriginator::current(); diff --git a/codex-rs/app-server/tests/suite/v2/thread_sample.rs b/codex-rs/app-server/tests/suite/v2/thread_sample.rs index e3c40aa3e1..b62fd44d6d 100644 --- a/codex-rs/app-server/tests/suite/v2/thread_sample.rs +++ b/codex-rs/app-server/tests/suite/v2/thread_sample.rs @@ -1319,13 +1319,7 @@ async fn sample_rejects_invalid_sources_and_prompts() -> Result<()> { "Predict".to_string(), "latest finished turn", ), - (parent.clone(), turn.clone(), String::new(), "prompt"), - ( - parent.clone(), - turn.clone(), - "x".repeat(4_001), - "at most 4000 bytes", - ), + (parent, turn, String::new(), "prompt"), ] { let id = client .send_raw_request(