You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
tui: sidebar missing when viewing a subagent session — no context usage or cost for that session #48548
When navigating into a subagent (child) session in the opencode2 TUI, the session sidebar is not rendered. Since the Context section lives in the sidebar, there is no way to see the subagent session's own context usage (tokens / percentage) or cost while viewing it. The sidebar only appears for the root session.
Reproduction
In opencode2, run a prompt that spawns a subagent (e.g. the task tool).
Navigate into the child session: down (session.child.first) to open the subagent picker, or right (session.child.next) to go to the next child session.
Observe that the sidebar is missing while viewing the subagent session.
session.sidebar.toggle (<leader>b) does not bring it back in the child session.
Expected Behavior
The sidebar should be available in subagent session views as well, with the Context section showing that session's token usage and cost.
Actual Behavior
The sidebar is absent for child/subagent sessions, so context usage and cost for that specific session cannot be inspected anywhere in the TUI.
Impact
For subagent-heavy workflows, per-subagent context pressure and spend are invisible in the TUI. The parent session's sidebar does not compensate for this (see also #45417 for subagent cost not being aggregated).
Environment
opencode2 v0.0.0-beta-19425
Linux x86_64
npm install (@opencode/cli)
Reacted by aurora95, mccaullinsjason, Michael Alexander, Millio345 and Marcelo Sizer
Confirming. The two issues compound: there is no sidebar while you are in the child session, and the root session's sidebar excludes everything the child spent (#45417, #47822). So for a fan-out there is no place in the TUI that shows the child's spend.
Partial workaround until the sidebar renders for child sessions: a root-sidebar plugin that aggregates descendants. api.client.session.children({ path: { sessionID } }) returns each child's cost and tokens, so you can render "subagents: $X" next to the root Context block. It does not give you the per-child context pressure you are after, but it stops the spend from being invisible.
Building that now on macOS v1.18.31, will link it here once it works.
The native sidebar skips subagent sessions, so I built /context-breakdown: it
lists every child session with its own ctx, % and per-category breakdown
(system, schemas, user/assistant, reasoning, tool args, residual), alongside
the main session.
opencode-context-indicator — still in a testing stage; with your help and
feedback we can make it better together. Dual V1 + V2, tested against 2.0.21+,
everything local.
Still valid on v2.0.23 (v2 tip fad352c): session-frame.tsx still returns sidebarVisible = false for any session with a parentID, before the manual toggle is considered — so the sidebar (and context/cost) remains unavailable in subagent sessions.
Opened #59573 for this. The sidebar check in session-frame.tsx returned false for any session with a parentID before looking at the setting or the toggle. The PR removes that check, so subagent sessions get the sidebar and its Context block like the root session.
Thanks for the detailed report. I tried to reproduce this with a simulated model on the latest release (2.2.0; the beta you're on wouldn't start in our test harness). The subagent ran and the root session showed its sidebar, but my automated run never managed to open the child session (the subagent picker didn't select it), so I couldn't watch the sidebar there myself. That's a gap in my test run, not evidence that the problem doesn't happen.
The code backs up your report: the TUI's session frame hides the sidebar for any session that has a parent session, and that check runs before both the auto setting and the manual toggle. So in a subagent session the sidebar can't appear, and <leader>b has no visible effect there. Related:
A maintainer will need to confirm by opening a child session by hand. If you can, it would help to know whether you opened the subagent through the picker (down) or with right, and how wide your terminal was.
still broken on 2.2.4. open a subagent and there's no context %, no token count, no cost for that session, and ctrl+x b doesn't help because parentID sessions never render the sidebar. the parent's numbers aren't a substitute.
#59573 removes exactly that check and has been open since oct 27 — can someone prio it? and fwiw the original report (#38495) got closed as not planned instead of fixed, which is why this keeps coming back.
Closing this for now, since we haven't heard back. We asked how you opened the subagent session (the down picker or right) and how wide your terminal was, because our automated run never got into the child session and couldn't confirm the missing sidebar directly.
We didn't rule the problem out. The TUI code does hide the sidebar for any session that has a parent session, and open PR #59573 changes exactly that. Related: #45417 (subagent cost not added to the parent session) and #50795 (a subagent session hides the effective model in the footer).
If this still happens on a current v2 release, please comment with those details and we can reopen it. Thanks for the clear report.
Still reproducible on OpenCode 2.2.5 (Linux x86_64, WSL2), so adding current evidence rather than opening a duplicate.
Repro:
Open a root session using a model that reports usage (for example opencode-go/deepseek-v4.1-flash).
Confirm the root session shows the right-side Context block (Context — 120,282 tokens — 60% used on a 200k model).
Dispatch a subagent and open the child session (down → subagent picker → Enter, or right).
The child session shows the composer (Subagents / Shell / Terminals) but no sidebar and no Context block. session.sidebar.toggle (ctrl+x b) does nothing.
Source on 2.2.5: packages/tui/src/component/session-frame.tsx returns false from sidebarVisible for any session with a parentID, before the session.sidebar setting or manual toggle is considered. The child route also replaces the prompt with the composer, so the prompt-footer context meter is not mounted either.
For the child session, the data is present: the last assistant message reports input 382, cache.read 99,328, output 103, reasoning 356 (about 100,169 context tokens on a 200k model), but there is no UI surface that shows it.
Expected: the child session shows the same right-side Context block as the root session.
Actual: no context usage or cost is visible for the child session.
This is the same root cause as #59573; please consider reopening or tracking this until that lands. No new feature request needed.
Activity
JLegends commentedon Sep 17, 2026
Confirming. The two issues compound: there is no sidebar while you are in the child session, and the root session's sidebar excludes everything the child spent (#45417, #47822). So for a fan-out there is no place in the TUI that shows the child's spend.
Partial workaround until the sidebar renders for child sessions: a root-sidebar plugin that aggregates descendants.
api.client.session.children({ path: { sessionID } })returns each child'scostandtokens, so you can render "subagents: $X" next to the root Context block. It does not give you the per-child context pressure you are after, but it stops the spend from being invisible.Building that now on macOS v1.18.31, will link it here once it works.
VladSmr commentedon Oct 2, 2026
The native sidebar skips subagent sessions, so I built /context-breakdown: it
lists every child session with its own ctx, % and per-category breakdown
(system, schemas, user/assistant, reasoning, tool args, residual), alongside
the main session.
opencode-context-indicator — still in a testing stage; with your help and
feedback we can make it better together. Dual V1 + V2, tested against 2.0.21+,
everything local.
https://github.com/VladSmr/opencode-context-indicator
npm: opencode-context-indicator
Ploppy3 commentedon Oct 5, 2026
Still valid on v2.0.23 (v2 tip
fad352c):session-frame.tsxstill returnssidebarVisible = falsefor any session with aparentID, before the manual toggle is considered — so the sidebar (and context/cost) remains unavailable in subagent sessions.saneksa commentedon Oct 27, 2026
Opened #59573 for this. The sidebar check in
session-frame.tsxreturnedfalsefor any session with aparentIDbefore looking at the setting or the toggle. The PR removes that check, so subagent sessions get the sidebar and its Context block like the root session.opencodejr commentedon Oct 28, 2026
Thanks for the detailed report. I tried to reproduce this with a simulated model on the latest release (2.2.0; the beta you're on wouldn't start in our test harness). The subagent ran and the root session showed its sidebar, but my automated run never managed to open the child session (the subagent picker didn't select it), so I couldn't watch the sidebar there myself. That's a gap in my test run, not evidence that the problem doesn't happen.
The code backs up your report: the TUI's session frame hides the sidebar for any session that has a parent session, and that check runs before both the auto setting and the manual toggle. So in a subagent session the sidebar can't appear, and
<leader>bhas no visible effect there. Related:A maintainer will need to confirm by opening a child session by hand. If you can, it would help to know whether you opened the subagent through the picker (
down) or withright, and how wide your terminal was.sebastianlungu commentedon Oct 30, 2026
still broken on 2.2.4. open a subagent and there's no context %, no token count, no cost for that session, and ctrl+x b doesn't help because parentID sessions never render the sidebar. the parent's numbers aren't a substitute.
#59573 removes exactly that check and has been open since oct 27 — can someone prio it? and fwiw the original report (#38495) got closed as not planned instead of fixed, which is why this keeps coming back.
opencodejr commentedon Oct 31, 2026
Closing this for now, since we haven't heard back. We asked how you opened the subagent session (the
downpicker orright) and how wide your terminal was, because our automated run never got into the child session and couldn't confirm the missing sidebar directly.We didn't rule the problem out. The TUI code does hide the sidebar for any session that has a parent session, and open PR #59573 changes exactly that. Related: #45417 (subagent cost not added to the parent session) and #50795 (a subagent session hides the effective model in the footer).
If this still happens on a current v2 release, please comment with those details and we can reopen it. Thanks for the clear report.
Alek2077 commentedon Nov 3, 2026
Still reproducible on OpenCode 2.2.5 (Linux x86_64, WSL2), so adding current evidence rather than opening a duplicate.
Repro:
opencode-go/deepseek-v4.1-flash).Context — 120,282 tokens — 60% usedon a 200k model).down→ subagent picker → Enter, orright).Subagents / Shell / Terminals) but no sidebar and no Context block.session.sidebar.toggle(ctrl+x b) does nothing.Source on 2.2.5:
packages/tui/src/component/session-frame.tsxreturnsfalsefromsidebarVisiblefor any session with aparentID, before thesession.sidebarsetting or manual toggle is considered. The child route also replaces the prompt with the composer, so the prompt-footer context meter is not mounted either.For the child session, the data is present: the last assistant message reports
input 382,cache.read 99,328,output 103,reasoning 356(about 100,169 context tokens on a 200k model), but there is no UI surface that shows it.Expected: the child session shows the same right-side Context block as the root session.
Actual: no context usage or cost is visible for the child session.
This is the same root cause as #59573; please consider reopening or tracking this until that lands. No new feature request needed.