opencode icon indicating copy to clipboard operation
opencode copied to clipboard

TUI session list shows no activity spinner for background shell commands

Open kernel-oops opened this issue 2 months ago • 4 comments

Description

In the TUI session list, the activity spinner beside a session covers a running turn and running subagents, but not background shell commands. A session whose turn has ended while it runs a long command in the background (for example a full test suite started with the shell tool's background option) shows no spinner in the list, so it looks idle, while the footer inside that session correctly shows 1 shell.

The list already treats background subagent work as activity, so leaving out background shells looks like an oversight.

Plugins

None needed.

OpenCode version

v2.0.16 (also the current v2 branch)

Steps to reproduce

  1. In a session, have the agent start a long command in the background (for example sleep 300 via the shell tool with background enabled) and let its turn end.
  2. Open the session list (/sessions).
  3. The session has no spinner, although the footer inside it shows 1 shell until the command exits.

Screenshot and/or share link

n/a

Operating System

Linux

Terminal

n/a

kernel-oops avatar Sep 28 '26 08:09 kernel-oops

This issue might be a duplicate of existing issues. Please check:

  • #28175: requests persistent live session status in the TUI, including visibility into background sessions.
  • #51336: requests a persistent session activity indicator and notes that background shell tasks may not be visible.

github-actions[bot] avatar Sep 28 '26 08:09 github-actions[bot]

Thanks for the clear report, @kernel-oops!

To restate the request: the session list (/sessions) should show its activity spinner while a session still has background shell commands running after its turn has ended, the same way the footer inside the session shows 1 shell.

Right now the list's spinner only covers a session, or one of its subagents, actively running a turn. Background shells are tracked separately and aren't part of that check. The session tabs' busy indicator doesn't count them either. So this works as currently designed rather than being a bug, but it's a reasonable improvement and I've marked it as a feature request for the maintainers to consider.

This can't be done as a plugin today, because plugins can't change the session list's status indicators. I've noted for the maintainers that it could be done either directly in the TUI, by checking for running shells owned by the session, or with a new plugin hook for per-session activity.

opencodejr[bot] avatar Oct 28 '26 03:10 opencodejr[bot]

Adding a TUI tab-strip data point to help fix this centrally (originally filed as #62505, confirmed duplicate).

Reproduction for tabs:

  1. Open two session tabs.
  2. In one session, run a long shell in the background (shell tool run_in_background, e.g. task_run.sh run ... -- python3 ... &).
  3. Once the turn ends, the transcript row keeps its spinner + Background badge, but the tab shows no spinner.

Same cause as the list: packages/tui/src/context/session-tabs.tsx status() checks data.session.status(id) === "running" and non-synthetic pending, but never data.shell.listBySession(id). ShellDisplay in packages/tui/src/routes/session/index.tsx does check data.shell.get(id), hence the mismatch. Fixing status() to also count running shells owned by each family member should fix the session list, tab strip, createProgramStatus, and likely the related gaps in #62365 and #48482. Web-side proposal #56661 (for #56660) may be a useful reference for the same pattern.

naihongzhou1029 avatar Nov 07 '26 04:11 naihongzhou1029

Thanks for the detailed report! This is intended: a session (or subagent) that ends its turn and leaves a shell running in the background counts as idle, so the session list, tabs and Subagents tab don't show it as working. You can still see running shells inside the session. Closing as not planned.

neriousy avatar Nov 27 '26 12:11 neriousy