Skip to content

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

Open
Zhangs-11 wants to merge 1 commit into
agegr:mainfrom
Zhangs-11:fix/collapsed-awaiting
Open

Zhangs-11 wants to merge 1 commit 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

…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>

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

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

1 participant