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): aggregate subagent costs into sidebar spent total by malventano · Pull Request #27952 · anomalyco/opencode

Conversation

@malventano

@malventano malventano commented May 16, 2026 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown

When subagents are spawned during a session, their spending does not show up in the sidebar total. Only the parent session own cost is displayed. This PR fixes it by summing the existing cost values already tracked for each child and grandchild session into the spent display, so the number reflects what was actually spent across the entire session tree. Viewing a subagent shows its own cost plus all of its descendants costs. No new data needs to be stored or collected. All prior sessions will reflect the correct total immediately once this is deployed.

The TUI sidebar shows $ spent from session.cost, which only tracks the current session own usage. Subagents spawned via the task tool have their costs tracked in separate child sessions (parentID not null) and never appear in the parent total.

A parent session running 3 subagents at $0.50 each would show $0.25 (its own cost) rather than the actual $1.75 spent.

Changes

packages/plugin/src/tui.ts Add all(): ReadonlyArray<Session> to TuiPluginState.session. Previously only exposed count() and get(id).

packages/opencode/src/cli/cmd/tui/plugin/api.tsx Implement all() returning sync.data.session.

packages/opencode/src/cli/cmd/tui/feature-plugins/sidebar/context.tsx Replace session()?.cost ?? 0 with iterative DFS over descendants (children, grandchildren, etc.). Display stays unchanged, just $X.XX spent.

Notes

  • Only includes sessions reachable via parentID from the currently viewed session. Unrelated sessions from sibling directories are not included.
  • No DB changes. Purely display-time computation. Child sessions already share the same directory as their parent, so they are always loaded together in sync.data.session.
  • If viewing a subagent directly, shows its own cost plus its descendants (not aggregated upward).

Sorry, something went wrong.

Uh oh!

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

All reactions
malventano added 2 commits May 16, 2026 19:08
@malventano
feat(tui): aggregate subagent costs into sidebar spent total
a83d509
@malventano
fix(tui): guard cost aggregation against placeholder session ID
d1c63fe
@github-actions github-actions Bot added the needs:compliance This means the issue will auto-close after 2 hours. label May 16, 2026
@github-actions

github-actions Bot commented May 16, 2026

Copy link
Copy Markdown
Contributor

This PR doesn't fully meet our contributing guidelines and PR template.

What needs to be fixed:

  • PR description is missing required template sections. Please use the PR template.

Please edit this PR description to address the above within 2 hours, or it will be automatically closed.

If you believe this was flagged incorrectly, please let a maintainer know.

All reactions

Sorry, something went wrong.

Uh oh!

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

@github-actions

github-actions Bot commented May 16, 2026

Copy link
Copy Markdown
Contributor

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

Potential Duplicate Found

PR #25712: feat(tui): show subagent cost rollup in sidebar and task history
#25712

Why it's related: This PR appears to address the exact same issue — showing aggregated subagent costs in the sidebar. PR #25712 was specifically titled to include "subagent cost rollup in sidebar," which is the core functionality of the current PR #27952. These PRs likely have overlapping or identical goals and implementation.

Recommendation: Check if PR #25712 was already merged, closed, or superseded. If it's still open or pending, there may be duplicate work that should be consolidated.

All reactions

Sorry, something went wrong.

Uh oh!

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

@malventano malventano closed this May 16, 2026
@malventano

malventano commented May 16, 2026

Copy link
Copy Markdown
Author

Closed in favor of #25712 which covers the same problem more completely (server-side cost computation, per-task display, cached sync with invalidation).

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
@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
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

needs:compliance This means the issue will auto-close after 2 hours.

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.

1 participant

@malventano
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.