Skip to content

Conversation

@Coderxrohan
Copy link

Issue

When resuming a session, session.usage_info is not populated until a prompt is sent, making it impossible to access token usage during the initial resumed session phase.

Fix

Populate usage_info directly from the session.resume response and attach it to the CopilotSession object during resume.

Impact

Token usage is now immediately available after resume_session, enabling clients to display current usage without waiting for the first prompt.

Testing

  • Resumed an existing session locally
  • Verified session.usage_info is available immediately after resume

Fixes: #312

@Coderxrohan Coderxrohan requested a review from a team as a code owner February 4, 2026 10:35
@Coderxrohan
Copy link
Author

Added usage_info as a first-class property on CopilotSession, populated it during both create_session and resume_session, and kept it in sync by updating it on incoming session events. This makes token usage available immediately after resuming a session without waiting for the first prompt.

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.

Resuming session doesn't automatically fetch 'session.usage_info' until a prompt is sent

1 participant