Skip to content

Add subagent cost hover#322840

Draft
pwang347 wants to merge 1 commit into
mainfrom
pawang/subagentCost
Draft

Add subagent cost hover#322840
pwang347 wants to merge 1 commit into
mainfrom
pawang/subagentCost

Conversation

@pwang347

Copy link
Copy Markdown
Member

No description provided.

Copilot AI review requested due to automatic review settings June 24, 2026 22:30

Copilot AI left a comment

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.

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 IChatSubagentToolInvocationData with a persisted credits?: number field.
  • 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.
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