Skip to content

Conversation

@ulugbekna
Copy link
Contributor

No description provided.

Copilot AI review requested due to automatic review settings December 4, 2025 10:20
@ulugbekna ulugbekna enabled auto-merge December 4, 2025 10:20
@ulugbekna ulugbekna self-assigned this Dec 4, 2025
@vs-code-engineering vs-code-engineering bot added this to the November 2025 milestone Dec 4, 2025
Copilot finished reviewing on behalf of ulugbekna December 4, 2025 10:22
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves the accuracy of TTFT (Time To First Token) measurement in the xtab provider by ensuring it's only recorded when actual content is received, not on empty string responses. This prevents premature TTFT measurements that could occur when the streaming API sends an initial empty response before sending actual content.

Key Changes

  • Added a non-empty text check (text !== '') to the TTFT measurement condition in the streaming callback

firstTokenReceived.complete();
}
if (ttft === undefined) {
if (ttft === undefined && text !== '') {
Copy link

Copilot AI Dec 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Consider checking the delta parameter for other content types beyond text. The FetchStreamRecorder class in src/platform/chat/common/chatMLFetcher.ts (line 128) uses a more comprehensive check that includes delta.text, delta.beginToolCalls, delta.thinking?.text, and delta.copilotToolCalls.

If this provider can receive non-text content like tool calls or thinking tokens, TTFT should be measured when any of these are present, not just when text is non-empty. For example:

if (ttft === undefined && (text !== '' || delta.beginToolCalls || delta.thinking?.text || delta.copilotToolCalls)) {

However, if this specific context only deals with text responses, the current implementation is sufficient.

Suggested change
if (ttft === undefined && text !== '') {
if (
ttft === undefined &&
(
text !== '' ||
(delta && (
delta.beginToolCalls ||
(delta.thinking && delta.thinking.text) ||
delta.copilotToolCalls
))
)
) {

Copilot uses AI. Check for mistakes.
@ulugbekna ulugbekna added this pull request to the merge queue Dec 4, 2025
Merged via the queue into main with commit ae6df17 Dec 4, 2025
22 checks passed
@ulugbekna ulugbekna deleted the ulugbekna/supreme-swift branch December 4, 2025 11:00
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.

3 participants