Skip to content

fix(serve): include all finalized text logprobs in done events - #176

Closed
Afloat16 wants to merge 2 commits into
Edge0-AI:mainfrom
Afloat16:fix/20261111-response-done-logprobs
Closed

Afloat16 wants to merge 2 commits into
Edge0-AI:mainfrom
Afloat16:fix/20261111-response-done-logprobs

Conversation

@Afloat16

Copy link
Copy Markdown
Contributor

What & why

response.output_text.done carries the finalized text, but its logprobs currently contains only entries left in the pending queue. Usually the queue has already been drained into deltas, so the done event reports an empty list while the final content part has the token probabilities.

Finalize pending probabilities into the content part before emitting the done event, and include the complete list there. This keeps the finalized text event and finalized content part consistent for clients that consume completion events.

Area

  • Engine, CLI or server (edge0-infer/)

How was it tested?

Built and ran tests/unit/cli/serve_protocol_test.cpp with tools/cli/serve_protocol.cpp using GCC 14/C++17 and the existing portal request fixtures. The new assertion fails on the base encoder; all protocol tests pass after the change. Both fully emitted and trailing pending probabilities are covered, with exact equality to the finalized content part.

No model or HTTP server is needed for these tests.

Checklist

  • Added completion-event regression coverage
  • Existing Chat/Responses protocol fixture and stream checks pass

@Afloat16

Copy link
Copy Markdown
Contributor Author

Merged main at 3b056d5 in 6291283 and resolved the test-file conflict while preserving the upstream Messages coverage and this PR's finalized-logprob checks.

The rebuilt CPU moe_test_serve_protocol target passes. Its regression still verifies that response.output_text.done contains the same accumulated logprobs as the final text item, with and without a pending tail.

@shuk777

shuk777 commented Nov 19, 2026

Copy link
Copy Markdown
Collaborator

Closing as part of clearing this pre-hygiene queue; see #298 (comment) for the note on the updated review process. Thank you again.

@shuk777 shuk777 closed this Nov 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants