Skip to content

feat: add sub-agent cost breakdown with recursive session walker - #13588

Closed
JudicaelPoumay wants to merge 18 commits into
anomalyco:devfrom
JudicaelPoumay:feat/cost-breakdown
Closed

feat: add sub-agent cost breakdown with recursive session walker#13588
JudicaelPoumay wants to merge 18 commits into
anomalyco:devfrom
JudicaelPoumay:feat/cost-breakdown

Conversation

@JudicaelPoumay

@JudicaelPoumayJudicaelPoumay commented Feb 14, 2026

Copy link
Copy Markdown

Summary

Add sub-agent cost breakdown with recursive session walker
Add recursive costs() utility for sub-agent expenditure tracking

The cost of the session/agents now includes the cost of subagents.
This recursively applies when inspecting sub-agents.
Subagents cost is visible in the chat

Comprehensive test coverage (13 new tests)

Visual changes

  1. cost display unchanged, but now accounts for the total session (including sub-agents).
    When inside an agent, display the total cost of that agent and its sub-agents.
image
  1. Added visible agent task cost inside the chat
image

Similar changes for the Web app

Verification

Passed packages/util/src/cost.test.ts (7 tests)
Passed packages/app/src/components/session/session-context-metrics.test.ts (6 tests)
Typecheck passes for all affected packages (@opencode-ai/ui, @opencode-ai/util, @opencode-ai/app, opencode)
Note: @opencode-ai/enterprise typecheck failure is pre-existing on dev (unrelated custom-elements.d.ts issue)

…alker
Adds a costs() utility that recursively walks sub-agent sessions to compute own vs total cost. Updates UI/TUI to display the breakdown. Fixesanomalyco#11027
@github-actions

Copy link
Copy Markdown
Contributor

Hey! Your PR title feat(util,app): add sub-agent cost breakdown with recursive session walker doesn't follow conventional commit format.

Please update it to start with one of:

  • feat: or feat(scope): new feature
  • fix: or fix(scope): bug fix
  • docs: or docs(scope): documentation changes
  • chore: or chore(scope): maintenance tasks
  • refactor: or refactor(scope): code refactoring
  • test: or test(scope): adding or updating tests

Where scope is the package name (e.g., app, desktop, opencode).

See CONTRIBUTING.md for details.

@JudicaelPoumayJudicaelPoumay changed the title feat(util,app): add sub-agent cost breakdown with recursive session walkerfeat: add sub-agent cost breakdown with recursive session walkerFeb 14, 2026
@JudicaelPoumay
JudicaelPoumay marked this pull request as draft February 14, 2026 12:46
@JudicaelPoumay
JudicaelPoumay marked this pull request as ready for review February 14, 2026 17:17
@JudicaelPoumay
JudicaelPoumay marked this pull request as draft February 14, 2026 17:18
Comment threadpackages/enterprise/src/custom-elements.d.ts

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.

This change seems unrelated. Is this related?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

No, this is a draft PR. Mostly vibe coded so far, so there a lot of AI garbage still. Had to push to work on another computer.

@JudicaelPoumayJudicaelPoumay changed the title feat: add sub-agent cost breakdown with recursive session walkerrefactor: remove cost indicators from UI and i18nFeb 15, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@JudicaelPoumayJudicaelPoumay changed the title refactor: remove cost indicators from UI and i18nfeat: add sub-agent cost breakdown with recursive session walkerFeb 15, 2026
@JudicaelPoumay
JudicaelPoumay marked this pull request as ready for review February 15, 2026 13:17
@github-actions

Copy link
Copy Markdown
Contributor

Closing this pull request because it has had no updates for more than 60 days. If you plan to continue working on it, feel free to reopen or open a new PR.

Sign up for freeto 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.

Cost of session doesn't include cost of subagents [FEATURE]: Display total cost for session

2 participants

@JudicaelPoumay@alexyaroshuk