GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat(tui): show subagent cost rollup in sidebar and task history by maxkomarychev · Pull Request #25712 · anomalyco/opencode

Conversation

@maxkomarychev

@maxkomarychev maxkomarychev commented May 4, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Subagent (Task tool) calls run in separate child sessions, so their LLM spend was previously invisible from the parent. The sidebar showed only the parent session's own cost, and the history task block had no cost line at all.

Add Session.cost(sessionID) that BFS-walks descendants and sums assistant message cost across the subtree, exposed via a new GET /session/:id/cost route (Hono + HttpApi parity). The TUI sync caches the rollup and invalidates it on message.updated for any completed assistant message, so subagent completions propagate to ancestor sidebars without tracking parent_id chains client-side.

Sidebar now renders $X.XX ($Y.YY subagents) spent when subagents exist, and the completed Task tool footer in the message stream gains a · $X.XX suffix showing that subagent task's total spend (its own plus its own descendants).

Issue for this PR

  • [FEATURE]:Show subagent token usage in TUI token counter #22103

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Please provide a description of the issue, the changes you made to fix it, and why they work. It is expected that you understand why your changes work and if you do not understand why at least say as much so a maintainer knows how much to value the PR.

If you paste a large clearly AI generated description here your PR may be IGNORED or CLOSED!

How did you verify your code works?

I ran the prompt "I want to test subagent cost feature. use @explore to in parallel for @src/ and @specs/ and explain their contents to me"

Screenshots / recordings

Screenshot 2026-05-04 at 15 24 59

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

If you do not follow this template your PR will be automatically rejected.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

malventano, Areiser, Cellule, ivanaguilario, ItsThareesh, egnerfl, vbfox, and bergmark reacted with thumbs up emoji zsiegel-khealth, ruslan-kurchenko, IlarionHalushka, alrebellato, Areiser, actellim, Cellule, ivanaguilario, and vbfox reacted with rocket emoji
All reactions
  • 👍 8 reactions
  • 🚀 9 reactions
@maxkomarychev
feat(tui): show subagent cost rollup in sidebar and task history
f0710f7
Subagent (Task tool) calls run in separate child sessions, so their
LLM spend was previously invisible from the parent. The sidebar showed
only the parent session's own cost, and the history task block had no
cost line at all.

Add `Session.cost(sessionID)` that BFS-walks descendants and sums
assistant message cost across the subtree, exposed via a new
`GET /session/:id/cost` route (Hono + HttpApi parity). The TUI sync
caches the rollup and invalidates it on `message.updated` for any
completed assistant message, so subagent completions propagate to
ancestor sidebars without tracking parent_id chains client-side.

Sidebar now renders `$X.XX ($Y.YY subagents) spent` when subagents
exist, and the completed Task tool footer in the message stream gains
a `· $X.XX` suffix showing that subagent task's total spend (its own
plus its own descendants).
@github-actions github-actions Bot added the needs:compliance This means the issue will auto-close after 2 hours. label May 4, 2026
@github-actions

github-actions Bot commented May 4, 2026

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

Results

Potentially Related PR:

  • fix(tui): propagate permissions from nested subagents and show full subtask tree #24638 - fix(tui): propagate permissions from nested subagents and show full subtask tree

    This PR also deals with nested subagent handling and subtask tree visualization in the TUI. While it focuses on permissions propagation, it shares the same area of concern (displaying information from nested subagent hierarchies in the TUI), so there could be overlapping changes or opportunities for coordination.

This PR (25712) appears to be the only one specifically addressing subagent cost rollup display in the sidebar and task history.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions github-actions Bot removed the needs:compliance This means the issue will auto-close after 2 hours. label May 4, 2026
@github-actions

github-actions Bot commented May 4, 2026

Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

maxkomarychev reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@maxkomarychev
Merge remote-tracking branch 'upstream/dev' into tui-subagent-cost-ro…
5173697
…llup
@maxkomarychev maxkomarychev mentioned this pull request May 4, 2026
[FEATURE]:Show subagent token usage in TUI token counter #22103
Closed
1 task done
@github-actions github-actions Bot mentioned this pull request May 16, 2026
feat(tui): aggregate subagent costs into sidebar spent total #27952
Closed
@malventano

malventano commented May 16, 2026

Copy link
Copy Markdown

This is a solid PR and much needed as subagent spending is currently effectively invisible.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@malventano

malventano commented May 16, 2026

Copy link
Copy Markdown

The status bar (prompt/index.tsx:351) and subagent footer (subagent-footer.tsx:45) still read session.cost directly, showing only the current session's cost instead of the aggregated total. Was this intentional or an oversight? Happy to follow up with a PR if needed.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions github-actions Bot mentioned this pull request May 17, 2026
📊 AI CLI 工具社区动态日报 2026-05-17 zx0828/big_model_radar#60
Open
@jxt1009

jxt1009 commented Jun 9, 2026

Copy link
Copy Markdown

Any progress on this 👀 would love to get that info without having to check my billing section to get the info summarized...

Cellule reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@lapwno lapwno mentioned this pull request Jun 14, 2026
[Desktop] Subagent UI 不可见 - 建议添加子任务展示界面 #32292
Closed
@github-actions github-actions Bot mentioned this pull request Jun 30, 2026
feat(tui): show session status in prompt area #34628
Closed
@yuki-kanemaru yuki-kanemaru mentioned this pull request Jul 9, 2026
feat(tui): show subagent status in sidebar #36042
Closed
3 of 6 tasks
@github-actions github-actions Bot mentioned this pull request Jul 31, 2026
feat(tui): show optional daily session cost #39807
Closed
3 of 6 tasks
@github-actions github-actions Bot mentioned this pull request Aug 14, 2026
feat(tui): [v2] show cache hit rate in sidebar #42503
Closed
3 of 6 tasks
@AndyS77 AndyS77 mentioned this pull request Aug 20, 2026
fix(core): roll up subagent cost into parent session and fix fork double-counting #43645
Closed
4 tasks done
@github-actions github-actions Bot mentioned this pull request Aug 29, 2026
feat(tui): list active and recent subagents in the sidebar #46109
Closed
3 tasks done
@github-actions github-actions Bot mentioned this pull request Sep 22, 2026
fix(core): roll up subagent cost into session cost across TUI, stats, and ACP #50737
Closed
4 tasks done
@thdxr

thdxr commented Oct 10, 2026

Copy link
Copy Markdown
Member

This branch has been upgraded to V2. We're no longer taking PRs for V1. If you think this is still relevant, please port it over and open it for V2.

— from 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@thdxr thdxr closed this Oct 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@maxkomarychev @malventano @jxt1009 @thdxr
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.