Repository navigation
fix(messages): mark clean EOF without message_stop as failed - #576
franciscojavierarceo merged 3 commits into
Conversation
On a premature HTTP EOF (no message_stop), the Messages stream already sends the client an error frame and no successful terminal. However, the agentic.execute span was unconditionally marked completed, so telemetry reported a successful turn that the client never saw. Add record_terminal_outcome to choose the span outcome from the same has_completed_round() gate that finish() uses to emit the error: a completed round keeps its stop-reason outcome; otherwise the execution is failed with FailureCategory::Stream. This is part of vllm-project#313's requirement that an incomplete Messages stream never appear successful. Test: trace test asserting a clean EOF without message_stop yields an error frame and a failed/error-status execution span with error.type=stream. Signed-off-by: Jack Wei <[email protected]>
The previous fix pushed messages_stream.rs to 503 production lines, three over the pre-commit rust-file-sizes limit of 500. Shorten the record_terminal_outcome doc comment to one line so the file is back at 500 without changing behavior. Signed-off-by: Jack Wei <[email protected]>
|
the clean-EOF path now marks |
|
Good catch — thanks. You're right: the clean-EOF path failed the Fixed in
Verification: full metrics suite (17 passed), the original span regression, fmt, clippy ( |
The clean-EOF path failed the execution span but still finished the inference stage with no error, marking it successful for the same incomplete upstream response. Finish the stage with FailureCategory::Stream when the round did not complete, and assert the stage outcome alongside the execution outcome in a metrics regression test. Signed-off-by: Jack Wei <[email protected]>
bca8796 to
13909e3
Compare
franciscojavierarceo
left a comment
There was a problem hiding this comment.
the clean-EOF path now marks both the inference stage and execution outcome as failed, with a focused regression test. looks good to me.
Summary
Part of #313. On a premature HTTP EOF (no
message_stop), the Messages stream already sends the client anevent: errorframe and no successful terminal (finish()refuses to synthesize one). However,messages_stream_bodyunconditionally calledexecution.completed_with_stop_reason(...), so theagentic.executespan was recorded ascompletedwithStatus::Unset— telemetry reported a successful turn the client never saw.This adds
record_terminal_outcome, which derives the span outcome from the samehas_completed_round()gatefinish()uses to emit the error:completed/incomplete);failedwithFailureCategory::Stream(error.type=stream,Status::Error), with delivery stilldeliveredsince the error frame reached the client.This does not change client-visible frames or tool dispatch. The intentional
max_tokensmid-call tolerance from #345 is untouched.Test Plan
cargo fmt -- --check— passed.cargo clippy --workspace --all-targets -- -D warnings— passed, 0 warnings.cargo test -p agentic-server-core --test execution_trace_test messages_stream— 5 passed, including newmessages_stream_clean_eof_without_message_stop_is_failedasserting the error frame plus a failed/error-status span witherror.type=stream.cargo test -p agentic-server-core --test messages_stream_test— 29 passed (existing EOF/incomplete-stream cases unchanged).cargo test --workspace --no-fail-fast— all targets pass except two pre-existing environment-dependent tests (messages_returns_anthropic_error_for_unreachable_upstreamandmessages_gateway_loop_returns_anthropic_error_for_unreachable_upstream, expected 502 / got 504 on this host; reproduced on pristineorigin/main, unrelated to this change).