Skip to content

Implement session usage updates - #92

Merged
egor-baranov merged 6 commits into
mainfrom
session-usage
Apr 14, 2026
Merged

Implement session usage updates#92
egor-baranov merged 6 commits into
mainfrom
session-usage

Conversation

@egor-baranov

@egor-baranov egor-baranov commented Apr 13, 2026

Copy link
Copy Markdown
Collaborator

Implement https://agentclientprotocol.com/rfds/session-usage RFD that is already present in SDKs

@egor-baranov
egor-baranov requested a review from slapoguzov April 13, 2026 14:10
Comment thread src/TokenCount.ts
* [outputTokens]: number of output tokens (including reasoning output tokens)
* [reasoningOutputTokens]: number of reasoning output tokens
*/
export interface TokenCount {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why do we need TokenCount and Usage structures for basically the same information?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I think we can migrate to Usage from internal TokenCount but I'm not sure we should do it in a current mr

Comment thread src/CodexAcpServer.ts
return {
stopReason: "cancelled",
usage: this.buildPromptUsage(sessionState.lastTokenUsage),
_meta: this.buildQuotaMeta(sessionState),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

shouldn't we now remove usage info from meta? cc @dtim

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

We now expose token usage through PromptResponse.usage, but _meta.quota is still consumed on the IDE side for quota accounting and telemetry (LlmResponseMetadataEvent). I think we can refactor it after migration to the new entities (in a different mr)

@egor-baranov
egor-baranov merged commit a55d055 into main Apr 14, 2026
3 checks passed
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