BTW side tab disappears after visiting a subagent
Description
A /btw tab opens in the side panel, but after opening a subagent and returning to the parent session, the tab is gone and its answer is no longer reachable.
The parent and its subagent share the root shell tab's side strip. BTW stores its chats per routed session, so while the child is routed Panel.list receives the child session and reports the parent's btw:* tab as missing. The transient-panel cleanup then drops it from the shared strip.
Expected: the BTW tab and its answer stay in the shared strip across a subagent visit.
Plugins
None. Built-in /btw panel.
OpenCode version
0.0.0-dev-1349 (also present on current dev)
Steps to reproduce
- Open a session and run
/btw <question>. - Wait for the answer tab to appear in the side panel.
- Open a subagent from the timeline.
- Return to the parent session.
- The BTW tab is gone.
Screenshot
Can provide a recording if needed.
Operating System
Windows 10
Terminal
Desktop app
Thanks for the detailed report. I couldn't reproduce this here: it needs the desktop app with a real /btw answer and a real subagent session, and my sandbox has neither. A maintainer with the desktop app will need to check it.
Your steps are clear enough to follow as they are. A short recording of the tab disappearing would still help whoever picks this up.
Related items, most closely related first:
- #63050: an open PR that changes the same side-panel cleanup of temporary tabs, but for terminals that have exited
- #62169: an open PR that turns
/btwinto a side chat behind a feature flag - #50879: a request about
/btwanswers that can't be recovered once their dialog closes
Confirmed, and the mechanism you describe checks out in the code. The side strip belongs to the shell tab and is shared across its routed sessions, but a transient panel lists only its routed session's tabs: while the subagent is routed, the BTW panel does not list the parent's btw tab (its chats live in the parent session's store), so transient cleanup in packages/app/src/runtime/plugin/panels.tsx drops the stored key from the strip.
I could not run a live desktop repro here, so I verified the path statically and covered it with a regression test instead.
Fix is ready on fanyzp/opencode@9f51d17b (branch btw-subagent-tab): transient cleanup now drops a stored key only once the panel stops listing it for the session that listed it, so a tab another routed session owns stays stored while that session is not routed. The same change covers the other per-session transient panels (terminal, file, sources), which had the same shape. Full app unit suite (2909 tests), typecheck, and lint are green.