Skip to content

fix(sidebar): count sessions awaiting input apart from running ones when folded - #1423

Merged
agegr merged 2 commits into
agegr:mainfrom
Zhangs-11:fix/collapsed-awaiting
Oct 29, 2026
Merged

agegr merged 2 commits into
agegr:mainfrom
Zhangs-11:fix/collapsed-awaiting

Conversation

@Zhangs-11

Copy link
Copy Markdown
Contributor

Closes #1400

Problem

A session parked on a blocking extension dialog shows the amber "waiting for your input" dot while its project is expanded. Once the project is collapsed, the group's summary counts it as running and shows the blue spinner instead, as if work were still going on. The collapsed pinned section does the same with its blue dot.

Reproduce on main

  1. Add a global extension, e.g. ~/.pi/agent/extensions/ask.js:

    export default function ask(pi) {
      pi.registerCommand("ask", {
        handler: async (_args, ctx) => {
          await ctx.ui.confirm("Waiting dialog", "Leave this unanswered.");
        },
      });
    }
  2. In a saved session, send /ask and leave the dialog open. The row shows the amber dot.

  3. Collapse its project: the header shows the spinner and 1. Pin the session and collapse the pinned section: the header shows the blue running dot.

Cause

buildSessionTree() (lib/session-tree.ts) gives the group and pinned-header rows only running and unread counts. awaitingIds is a subset of runningIds, so an awaiting family is counted as running, while its row shows the awaiting state first.

Fix

  • activityCounts() counts each family the way its row shows it: awaiting input if any member awaits, else running if any member runs; unread as before. The group and pinned-header rows carry the new awaiting count, and running no longer includes awaiting families.
  • A collapsed group's ActivitySummary shows an amber dot and count beside the spinner's count, and the collapsed pinned header gets an amber dot. Both use the existing sidebar.agentAwaitingInput label and the awaiting dot's #d97706, so no new strings.
  • Mixed project: both counts. Only awaiting: the amber count, no spinner.
  • The project menus' badges (ProjectWorktreePicker) still count runs only; ActivitySummary's awaiting defaults to 0 there.

docs/agents/sessions.md said the group and pinned-header counts stay unchanged for awaiting sessions (from #1145). I updated that note, since this PR changes it as #1400 asks.

Checks

  • Tree model tests: an awaiting family counts as awaiting, not running; a mixed group and a pinned section split the two counts.
  • Render tests: the collapsed group shows both counts, or only the amber one; the collapsed pinned header shows the amber dot without the running one.
  • npm test (2872 passed, 1 skipped, 0 failed), node_modules/.bin/tsc --noEmit, npm run lint.
  • In headless Chrome with the extension above, one session awaiting /ask and another running a long extension command in the same project: the collapsed group shows ⟳ 1 ● 1 (amber). With the awaiting session pinned and the pinned section collapsed, its header shows only the amber dot.

🤖 Generated with Claude Code

Zhangs-11 and others added 2 commits October 26, 2026 14:24
…hen folded

A collapsed project group and the collapsed pinned section counted a
session parked on an extension dialog as running, so the amber
awaiting-input dot of the expanded row turned into the blue spinner.
Folded headers now count awaiting families on their own: an amber dot
and count in a group's summary, an amber dot on the pinned header, and
the spinner only for families still working.

Closes agegr#1400

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@agegr

agegr commented Oct 29, 2026

Copy link
Copy Markdown
Owner

Thanks. I reproduced #1400 on main with a tree-model test: a group and a pinned section whose only sessions await input both reported running: 1. With this PR they report running: 0, awaiting: 1, and a mixed group shows both counts. The amber reuses the awaiting dot's #d97706, as is-awaiting modifiers next to the existing running and unread ones. They set only backgrounds: no new text colors, no row-height changes, no new strings.

The branch conflicted with main: #1357 removed archivedAt from session rows, and #1338 added a top spacer row. I merged main and resolved both in lib/session-tree.ts and its test, with no other changes. tsc, lint and the sidebar tests pass (Node 22 and 24). The project menus' badges still count an awaiting session as running, as you noted. That can be a separate follow-up.

@agegr
agegr merged commit f9d7173 into agegr:main Oct 29, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Collapsed projects show a running spinner for sessions awaiting user input

2 participants