From 562f35d584a9a454457d60b184fdb7e413fe1afe Mon Sep 17 00:00:00 2001 From: Pavlo Ratushnyi Date: Fri, 16 Oct 2026 12:33:10 +0200 Subject: [PATCH] test(serve): conversation smoke control with the cache off; print request failures LELEKA_CONVERSATION_CACHE=off runs the same requests with StackConfig::conversation None (nothing reused, the second read of B must repeat the first), so a failure can be told apart from the cache. A failed request now prints a CONV FAILED line with the error and the stack's health before the panic. Co-Authored-By: Claude Opus 5.5 --- .../src/backend_original_serve_smoke.rs | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/crates/leleka-runtime/src/backend_original_serve_smoke.rs b/crates/leleka-runtime/src/backend_original_serve_smoke.rs index b774a212..26d85eab 100644 --- a/crates/leleka-runtime/src/backend_original_serve_smoke.rs +++ b/crates/leleka-runtime/src/backend_original_serve_smoke.rs @@ -373,7 +373,10 @@ fn timed(stack: &mut OriginalServeStack<'_, '_>, prompt: &[u32], max_new: usize, tokens.extend_from_slice(round); Ok(()) }, &mut || false) - .unwrap_or_else(|e| panic!("conversation smoke request failed: {e:?}")); + .unwrap_or_else(|e| { + eprintln!("CONV FAILED n={} error={e:?} health={:?}", prompt.len(), stack.health()); + panic!("conversation smoke request failed: {e:?}") + }); assert_eq!(outcome.produced, tokens.len()); (tokens, first.unwrap_or(f64::NAN), started.elapsed().as_secs_f64() * 1e3, stack.reused_tokens()) } @@ -384,7 +387,8 @@ fn timed(stack: &mut OriginalServeStack<'_, '_>, prompt: &[u32], max_new: usize, /// tokens of the same request read from the empty prompt (`forget_conversation`). Prints TTFT for both. /// Extra inputs: `LELEKA_CONVERSATION_SYSTEM_REPEAT` (system prompt repetitions, default 120 = a root checkpoint /// past 2048 tokens), `LELEKA_CONVERSATION_MAX_NEW` (default 48). `STRATA_CKPT_REREAD=1` turns every restore -/// into a re-read (the Original's check of the checkpoint). +/// into a re-read (the Original's check of the checkpoint). `LELEKA_CONVERSATION_CACHE=off` runs the same requests +/// with the cache off (the control: nothing is reused and the second read of B must repeat the first). #[test] #[ignore = "one explicitly scheduled inherited KAR+MTP load and GPU; no live-owner overlap"] fn original_serve_conversation_smoke_resume_matches_a_full_read() { @@ -423,7 +427,9 @@ fn original_serve_conversation_smoke_resume_matches_a_full_read() { let mut config = StackConfig::new(8192); config.capacity = env::var("LELEKA_ORIGINAL_SERVE_CAPACITY").ok().and_then(|v| v.parse().ok()).unwrap_or(1024); config.rt_directory = env::var_os("LELEKA_ORIGINAL_SERVE_RT_DIR").map(PathBuf::from); - config.conversation = Some(crate::qwen_forward::original_serve_stack::ConversationConfig::original()); + let cache = env::var("LELEKA_CONVERSATION_CACHE").map_or(true, |v| v != "off"); + config.conversation = cache.then(crate::qwen_forward::original_serve_stack::ConversationConfig::original); + eprintln!("CONV cache={}", if cache { "on" } else { "off" }); let mut stack = match OriginalServeStack::open(&binding, context.as_ref(), Rc::clone(&context), config) { Ok(stack) => stack, Err(failure) => panic!("the Original serve stack did not open: {}", failure.describe()), @@ -453,7 +459,11 @@ fn original_serve_conversation_smoke_resume_matches_a_full_read() { second.extend(tokenizer.encode(next_turn, true).expect("second turn")); let (cached, ttft_b, total_b, reused_b) = timed(&mut stack, &second, max_new, eos); eprintln!("CONV B(cache) n={} reused={reused_b} ttft={ttft_b:.1}ms total={total_b:.1}ms out={cached:?}", second.len()); - assert!(reused_b > 0 || env::var_os("STRATA_CKPT_REREAD").is_some(), "the second turn must resume from a checkpoint"); + if cache { + assert!(reused_b > 0 || env::var_os("STRATA_CKPT_REREAD").is_some(), "the second turn must resume from a checkpoint"); + } else { + assert_eq!(reused_b, 0, "nothing is reused with the cache off"); + } assert_eq!(stack.health(), None); // 3. the same second request read from the empty prompt