Skip to content

fix(app): show progress on session icons while a background shell runs - #56661

Open
ysm-dev wants to merge 1 commit into
anomalyco:devfrom
ysm-dev:background-shell-spinner
Open

ysm-dev wants to merge 1 commit into
anomalyco:devfrom
ysm-dev:background-shell-spinner

Conversation

@ysm-dev

@ysm-dev ysm-dev commented Oct 18, 2026

Copy link
Copy Markdown
Contributor

Issue for this PR

Closes #56660

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

The session icon (titlebar tab, home row) shows the progress indicator while a session or one of its subagents is running, but not while a background shell is. useSessionTabAvatarState only counts session status and pending inbox items. A background shell is not a session, and its parent goes idle when the turn ends, so the icon drops back to the avatar while the shell keeps running.

busy now also counts a running shell from data.shell.listBySession(id). It runs for every session in the family, so a shell started by a subagent keeps the parent's icon busy too. The shell store drops a shell on shell.exited and shell.deleted, and the status === "running" check covers an exited shell that arrives in the initial list.

Two things to know. A long-lived shell, like a dev server, keeps the indicator on until it exits. And shells come from the locations the app has loaded, so one that was already running in a project the app has not synced yet shows up once that project syncs or a live event arrives.

How did you verify your code works?

  • New case in the tabs keeper suite: a tab with a running shell, a tab whose subagent has one, and a tab whose only shell already exited. The first two get the indicator, the third does not, and a shell.exited event clears it. It fails on dev (tab B never gets the indicator) and passes with this change. Dropping the status === "running" check makes it fail on the exited-shell tab.
  • To run it, from packages/app: PLAYWRIGHT_PORT=4310 bun run test:e2e:built -- e2e/regression/tabs.spec.ts -g "background shell". It passed 10 of 10 at 5 workers with no retries.
  • The tabs, home, new-session, subagent navigation, session header, multi-server and timeline-stream specs: 116 passed. Four other tests fail on my macOS machine with and without this change.
  • bun run check passes.
  • Home list benchmark (500-session load, 20 churn updates at 5,000 sessions, 5 serial runs each): before and after ranges overlap on every metric.
  • This used the e2e mock server, not a live agent.

Screenshots / recordings

Before: tab B has a running shell and tab C's subagent has one, but both show the avatar.

Before: tabs B and C show their project avatars

After: both show the progress indicator. Tab A, whose shell already exited, keeps its avatar.

After: tabs B and C show the progress indicator

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@github-actions

Copy link
Copy Markdown
Contributor

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

@opencode-agent opencode-agent Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. I ran the new e2e test against the change (it passes) and against the base project-avatar-state.ts (it fails because tab B gets no progress indicator), and typecheck passes in packages/app.

The new check reads the reactive shell store. Exited and deleted shells are removed from that store, and the status === "running" filter covers exited shells in the first list, so the indicator won't stick. It also matches how the TUI already treats running shells (shell-tab.tsx), so a long-running dev server keeping the indicator on is consistent.

Public API: unchanged.

No concerns.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

web: session icon shows no progress indicator while a background shell runs

1 participant