Skip to content

Commit ccf012d

Browse files
committed
tests: cover ignored EOS at the output limit
A request with ignore_eos keeps generating past end-of-sequence tokens, so its last sampled token can be an EOS id even though it finished on the output limit. Assert that the terminal event reports the length reason and the output-limit termination. Validation: the new case fails on the unfixed runtime at the terminal-event assertion (reason "stop", termination Eos) in the release library test build. Design-Signed-Off-By: Hermes Agent (DeepSeek V4.1 Flash); design-review=2d93
1 parent 0ce6de8 commit ccf012d

1 file changed

Lines changed: 33 additions & 0 deletions

File tree

‎helios/src/server/runtime/phase_tests.rs‎

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -715,6 +715,39 @@ fn exact_system_and_prompt_checkpoints_publish_only_after_snapshot_completion()
715715
assert_eq!((metrics.prefill_tokens, metrics.generated_tokens), (13, 3));
716716
}
717717

718+
#[test]
719+
fn ignored_eos_at_the_output_limit_finishes_for_length() {
720+
let fixture = Fixture::new();
721+
let (sender, receiver) = mpsc::channel();
722+
let (mut incoming, mut generation) = fixture.incoming(vec![0], 2);
723+
incoming.prompt.ignore_eos = true;
724+
sender.send(vec![incoming]).unwrap();
725+
let mut worker = fixture.worker(receiver);
726+
assert_eq!(worker.admit().unwrap(), ControlFlow::Continue(true));
727+
advance(&mut worker, GraphKind::Init, 1, None);
728+
advance(&mut worker, GraphKind::Prefill, 2, Some(5));
729+
advance(&mut worker, GraphKind::Snapshot, 3, None);
730+
advance(&mut worker, GraphKind::Decode, 4, Some(5));
731+
advance(&mut worker, GraphKind::Snapshot, 5, None);
732+
assert!(worker.publish().unwrap());
733+
let mut finished = Vec::new();
734+
while let Ok(event) = generation.events.try_recv() {
735+
if let GenerationEvent::Finished {
736+
generated_tokens,
737+
reason,
738+
termination,
739+
..
740+
} = event
741+
{
742+
finished.push((generated_tokens, reason, termination));
743+
}
744+
}
745+
assert_eq!(
746+
finished,
747+
vec![(2, "length", crate::output::Termination::OutputLimit)]
748+
);
749+
}
750+
718751
#[test]
719752
fn disabled_host_store_preserves_decode_prefix_reuse_and_cancellation() {
720753
let fixture = Fixture::new();

0 commit comments

Comments
 (0)