Add subagent cost hover#322840
Draft
pwang347 wants to merge 1 commit into
Draft
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds Copilot credit (AIC) cost information to subagent UI by persisting per-subagent credit totals on the tool invocation and surfacing them in the subagent collapse-button hover, including after reload.
Changes:
- Extend
IChatSubagentToolInvocationDatawith a persistedcredits?: numberfield. - Track and persist per-subagent accumulated credits in the agent-host session handler while still forwarding deltas into the parent-turn cost accumulator.
- Update the subagent content part hover to show model + formatted credit cost, and add/extend unit tests for hover rendering.
Show a summary per file
| File | Description |
|---|---|
src/vs/workbench/contrib/chat/test/browser/widget/chatContentParts/chatSubagentContentPart.test.ts |
Normalizes hover content for assertions and adds tests for credit cost hover behavior. |
src/vs/workbench/contrib/chat/common/chatService/chatService.ts |
Adds credits?: number to subagent toolSpecificData to enable persistence across reloads. |
src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatSubagentContentPart.ts |
Builds hover tooltip from model + credits and refreshes credits from toolSpecificData updates. |
src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostSessionHandler.ts |
Accumulates per-subagent credits, persists them onto toolSpecificData, and enriches serialized history with credits. |
Copilot's findings
- Files reviewed: 4/4 changed files
- Comments generated: 4
Comment on lines
+2025
to
+2028
| if (total > 0 && invocation.toolSpecificData?.kind === 'subagent' && invocation.toolSpecificData.credits !== total) { | ||
| invocation.toolSpecificData.credits = total; | ||
| invocation.notifyToolSpecificDataChanged(); | ||
| } |
Comment on lines
+2008
to
+2012
| // Track this subagent's own credits (AIC) separately from the | ||
| // turn-wide accumulator so they can be surfaced on the subagent | ||
| // tool's hover and persisted via its `toolSpecificData`. The | ||
| // per-invocation total is also forwarded into the shared | ||
| // accumulator that feeds the parent turn's reported cost. |
Comment on lines
+2795
to
+2797
| // Surface this subagent's accumulated credits (AIC) on its | ||
| // tool's hover after a reload by writing them onto the | ||
| // serialized subagent tool call. |
Comment on lines
+772
to
+773
| // Credits (AIC) may arrive at or after completion as the | ||
| // subagent's child turns report their final usage. |
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.
No description provided.