Skip to content

Comments

feat: enhance CurrentRequest interface with prompt timing and tracking#3958

Open
TylerLeonhardt wants to merge 1 commit intomainfrom
tyler/homely-silverfish
Open

feat: enhance CurrentRequest interface with prompt timing and tracking#3958
TylerLeonhardt wants to merge 1 commit intomainfrom
tyler/homely-silverfish

Conversation

@TylerLeonhardt
Copy link
Member

No description provided.

Copilot AI review requested due to automatic review settings February 24, 2026 01:33
@TylerLeonhardt TylerLeonhardt self-assigned this Feb 24, 2026
@vs-code-engineering vs-code-engineering bot added this to the February 2026 milestone Feb 24, 2026
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 pull request enhances the CurrentRequest interface in the Claude Code Agent to track prompt timing metrics for performance monitoring. The changes add two new tracking fields to capture when prompts are yielded to the SDK and when the first response token is received, enabling time-to-first-token and total request duration measurements through trace logging.

Changes:

  • Added promptYieldedAt and firstTokenReceived fields to the CurrentRequest interface for timing tracking
  • Initialize timing fields when creating current request instances
  • Log time-to-first-token when the first message arrives from the SDK
  • Log total request duration when result messages are received

Comment on lines +217 to +218
promptYieldedAt: number;
firstTokenReceived: boolean;
Copy link

Copilot AI Feb 24, 2026

Choose a reason for hiding this comment

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

The new fields promptYieldedAt and firstTokenReceived are not marked as readonly, which is inconsistent with the existing fields in the CurrentRequest interface (stream, toolInvocationToken, token, yieldRequested). Since these fields are mutated after initialization, they should not be marked as readonly. However, this creates an inconsistency in the interface design pattern.

Consider whether these tracking fields should be separated into a different structure or if the pattern is acceptable for mutable tracking state. The existing pattern suggests all CurrentRequest fields should be readonly references to the original request, but these new fields are tracking state that changes during request processing.

Copilot uses AI. Check for mistakes.
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