Skip to content

Minimum speed: judge only visible, flowing generation - #385

Merged
fylorn merged 2 commits into
mainfrom
fix/min-speed-review
Oct 30, 2026
Merged

fylorn merged 2 commits into
mainfrom
fix/min-speed-review

Conversation

@fylorn

@fylorn fylorn commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Follow-ups to #384 (minimum generation speed).

Changes

  1. Gemini hidden reasoning: the cumulative output count read from usageMetadata no longer includes thoughtsTokenCount. A stream that reported only reasoning kept the live speed and the judged speed at 0 until the text estimate caught up, which would end long answers.
  2. Summarised reasoning: Anthropic, Gemini and Bedrock reasoning and the Responses reasoning summary arrive a few sentences every few seconds while the model reasons fast. While such reasoning lasts nothing is judged, and its time is taken out of the window afterwards. Raw reasoning (Chat reasoning_content, Responses reasoning_text) is judged as before. Pace calibration no longer compares summary text with the full reasoning count: with a reasoning breakdown it compares visible text with output minus reasoning, without one it does not calibrate.
  3. Short pauses: nothing is judged while the stream is paused (no content for more than a second), and the silence threshold is min(5 s, window / 4), so a pause before a burst of tool arguments no longer counts as slow. The window range stays 5–120.
  4. After the answer: nothing is judged once the stop reason is seen or the final frame has been delivered.
  5. Ordering: the upstream failure and the speed on the record are applied only when the final outcome is still the speed cut (a tool-call or answer-filter denial at the end wins), and the outcome is reported before the held-back tail is sent.
  6. Early release: when an answer is cut (speed, idle timeout, abort, tool-call cut), the upstream stream and its slot are dropped as soon as reading stops, before the tail and the error frame are sent. Answers that end normally keep the previous lifetime: releasing them early made the Windows handover-under-load test fail.
  7. Abort first: a manual abort wins over a speed judgment due at the same moment.
  8. Medians: upstream checkup and /token-rate medians leave out failed rows; the only failed rows with a speed are speed cuts, whose speed is the judged window.

Docs and the protocol 58 notes now also say that Gemini streams requested without alt=sse are not judged. No wire types or message codes change.

Tests

  • min_speed.rs: summarised thinking arriving in bursts is not judged; a pause before a burst with a 5 s window is not judged; slow raw Chat reasoning is still ended.
  • ending.rs: hidden Gemini reasoning does not drive the speed; summarised reasoning is not judged while raw reasoning is; a reasoning summary does not skew calibration.
  • slow.rs: pauses wait for content, summarised reasoning is left out, nothing is judged after the end.
  • tw-store: a speed-cut row is not in the checkup or /token-rate speed samples.

The new tests fail against the previous code (the raw-reasoning test guards against over-excluding and passes on both).

🤖 Generated with Claude Code

fylorn and others added 2 commits October 30, 2026 23:42
Follow-ups to the minimum generation speed check:

- Gemini: the streamed output count no longer includes hidden reasoning
  (thoughtsTokenCount). A stream that reported only reasoning made the
  live speed and the judged speed 0 until the text estimate caught up.
- Reasoning that arrives as a summary (Anthropic, Gemini, Bedrock, the
  Responses reasoning summary) is not judged while it lasts and its time
  is taken out of the window afterwards. Raw reasoning (Chat
  reasoning_content, Responses reasoning_text) is judged as before. Pace
  calibration no longer compares summary text with the full reasoning
  count.
- Nothing is judged while the stream is paused (no content for more
  than a second), and the silence threshold is min(5 s, window / 4), so a
  pause before a burst of tool arguments no longer counts as slow.
- Nothing is judged once the answer has ended (stop reason seen or the
  final frame delivered).
- The health failure and the speed on the record are applied only when
  the final outcome is still the speed cut, and the outcome is reported
  before the held-back tail is sent, so record, health and what the
  client sees agree.
- The upstream stream and its slot are released as soon as reading
  stops (also for idle timeout and abort).
- A manual abort wins over a speed judgment due at the same moment.
- Upstream checkup and /token-rate medians leave out failed rows, whose
  speed (the judged window) is a different measure.
- Docs: Gemini streams without alt=sse are not judged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@fylorn
fylorn merged commit a785b99 into main Oct 30, 2026
6 checks passed
@fylorn
fylorn deleted the fix/min-speed-review branch October 30, 2026 17:11
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 30, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant