fix: measure firstResponseMs on first NDJSON line, not first tool_use#789
Open
km-git007 wants to merge 2 commits intogarrytan:mainfrom
Open
fix: measure firstResponseMs on first NDJSON line, not first tool_use#789km-git007 wants to merge 2 commits intogarrytan:mainfrom
km-git007 wants to merge 2 commits intogarrytan:mainfrom
Conversation
docs: Slate agent integration research + design doc (garrytan#782)
The firstResponseMs metric was documented as "time from spawn to first NDJSON line" but the code only set it on the first tool_use event within an assistant message. This caused the metric to measure time to first tool call rather than time to first Claude response—often inflating the value by 5-15 seconds. Now correctly measures time from spawn to the first NDJSON line received, which accurately reflects Claude's response latency for rate-limit and performance diagnostics. Changes: - Moved firstResponseMs timing capture to line-read loop (line 212-215) - Removed buggy timing capture from tool_use handler (was line 224) - Updated comment to clarify we track inter-turn latency for tool calls
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.
Summary
The E2E test diagnostic metric `firstResponseMs` was measuring the wrong event:
This caused the metric to be inflated by 5-15 seconds, undermining rate-limit diagnostics.
What Changed
Testing
Existing test suite passes. Future test runs will show accurate ~100-300ms for `firstResponseMs` instead of previous 5000-15000ms.