fix: time to first token for generations that stream no text - #43
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes LFE-16664
completionStartTimewas only set when amessage_updatecarried a non-empty text part, so a generation that never streams prose reported no TTFT at all — a model that calls a tool straight away, or one that reasons before answering. The gate now accepts the first delta of any kind: text, reasoning or tool call, since each is a streamed completion token.Measured in a real pi project (90 days, 49 generations): 13 of 49 (27 %) carried no TTFT, and every one was a tool-call-only completion. The gate has been in place since the plugin's first commit.
Verification
[tool-only](tool call, no text, no reasoning) and[think-only](reasoning then tool call, no text). Both fail against the previous gate. Each also asserts its own premise — no text part, no reasoning part — so it cannot keep passing while no longer covering the bug.tsc --noEmitclean.mainis 128; the two new tests are the whole delta.Relation to #39
Supersedes the TTFT half of #39, which extended the same gate to reasoning only and explicitly left tool-call-only generations broken ("There is no token to time there") — i.e. 100 % of the cases actually observed. If this lands, #39 narrows to the inline-
<think>split.