anomalyco / anomalyco/opencode
tui: subagent tabs not restored after Ctrl+C restart until running subagent completes
@simonklee is already working on this.
Since Jul 26, 2026.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
Summary
After closing opencode2 with Ctrl+C while a subagent (background or foreground) is still running and then reopening it, the entire shell/subagent tab list is empty on reopen — neither the running subagent nor previously-completed (older) subagents appear. The moment the running subagent completes, the full list repopulates at once (older completed subagents + the now-completed one). The tab list is not restored on restart until the in-flight subagent finishes. Started after a recent next-channel update.
Environment
- opencode version: 0.0.0-next-16234 (
opencode2, next channel; binary/home/scan/.bun/bin/opencode2→@opencode-ai/cli, bun install) - OS: Linux 7.0.0-28-generic (#28~24.04.1-Ubuntu SMP PREEMPT_DYNAMIC) x86_64
- Terminal: ghostty (TERM=xterm-256color, TERM_PROGRAM unset)
- Shell: /bin/zsh
- Install/channel: next (bun-installed
@opencode-ai/cli) - Active plugins:
gsd-core.js,herdr-agent-state.js,opencode-models-discovery@latest
Reproduction
- Launch
opencode2in a workspace and run a few subagents so there are completed (older) subagents in the subagent tab list. - Trigger another subagent (background or foreground) that runs long enough to inspect mid-flight.
- While that subagent is still running, press Ctrl+C to close
opencode2. - Reopen
opencode2in the same workspace. - Navigate down to the shell and subagent tabs.
- Observe: the tab list is empty — neither the running subagent nor the older completed subagents appear.
- Wait for the running subagent to finish, then check the tabs again — the full list repopulates at once (older completed subagents + the now-completed one).
Expected Behavior
The subagent tab list should be restored on reopen, including previously-completed subagents and any subagent that is still running, so the user can see in-flight and historical subagents immediately after a restart.
Actual Behavior
The entire subagent tab list is empty after a Ctrl+C restart while a subagent is running. Nothing appears — not the running subagent, not older completed subagents — until the running subagent completes, at which point the whole list (old completed + the just-completed) repopulates together. The user loses visibility into all subagents (historical and in-flight) after a restart until the in-flight one finishes.
Additional Context
- Affects both background and foreground subagents (per reporter).
- The subagent process survives the Ctrl+C and completes later — the bug is that the tab list is not restored on reopen, not that the subagent is killed.
- Older completed subagents also vanish from the list on reopen; they reappear together with the running one's tab once it completes.
- Started after a recent next-channel update (reporter noticed it recently; current build
0.0.0-next-16234). - Consistently reproducible since the update.
- Workarounds: none known; the full list repopulates only after the running subagent completes.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.