Skip to content

feat: filter sessions by state with Tab/Shift+Tab in menu - #314

Merged
kbwo merged 2 commits into
mainfrom
i-can-t-generate-an-informed-branch-name-without-understanding-issue-310-could-you-either-grant-permission-for-webfetch-or-paste-the-issue-description-once-i-have-that-information-i-ll-analyze-the-options-and-provide-a-branch-name
Jun 28, 2026
Merged

feat: filter sessions by state with Tab/Shift+Tab in menu#314
kbwo merged 2 commits into
mainfrom
i-can-t-generate-an-informed-branch-name-without-understanding-issue-310-could-you-either-grant-permission-for-webfetch-or-paste-the-issue-description-once-i-have-that-information-i-ll-analyze-the-options-and-provide-a-branch-name

Conversation

@kbwo

@kbwo kbwo commented Jun 28, 2026

Copy link
Copy Markdown
Owner

Closes #310.

Problem

The menu could only filter sessions by text (branch, path, session name). There was no way to narrow the list to the sessions that need attention (busy/waiting) versus those free for new work (idle).

Approach

Issue #310 proposed two UX options (a s-then-letter sub-mode, or a cycling toggle). This implements a refined version of the cycling option: a session-state filter as an independent dimension that composes with the existing text search, driven by a single keypress.

  • Tab cycles the filter forward: All → Busy → Waiting → Idle → All; Shift+Tab cycles backward.
  • The active filter is shown in the footer, alongside a Tab-State Filter hint in the controls line.
  • The state filter and the text search are applied in one pipeline, so both can be active at once.

Why this over the issue's options: a single keypress is fastest (the core need), it adds no separate keymap/mode to learn, and Tab/Shift+Tab don't collide with the existing top-level shortcuts.

Details

  • The four internal session states collapse into three user-facing categories: pending_auto_approval folds into Waiting, mirroring the status display in statusIcons.ts.
  • Rows without a running session have no state, so they are excluded under any specific filter (shown only when the filter is All).
  • Filter logic lives in filterByQuery.ts next to the existing text filter and is unit-tested.

Known limitation

Tab does not cycle while the text-search input is active (/ mode), matching the existing handler that early-returns in search mode. The query is preserved when leaving search mode, so both filters can still be combined; simultaneous "type and Tab" would need follow-up.

Verification

  • npm run typecheck, npm run lint pass.
  • New unit tests in src/utils/filterByQuery.test.ts (filter categories, pending→waiting folding, session-less exclusion, forward/backward cycling, labels) pass; full suite: 1760 passed. The 6 failing files are pre-existing *.submodule.test cases that fail in this sandbox because git config --global cannot write ~/.gitconfig — unrelated to this change.

🤖 Generated with Claude Code

kbwo and others added 2 commits June 28, 2026 23:55
Closes #310. The menu could only filter sessions by text (branch, path,
session name); there was no way to narrow to the sessions that need
attention (busy/waiting) versus those free for new work (idle).

Add a state filter as an independent dimension that composes with the
existing text search. Tab cycles it forward (All -> Busy -> Waiting ->
Idle -> All) and Shift+Tab backward; the active filter is shown in the
footer. The four internal session states collapse into three user-facing
categories (pending_auto_approval folds into Waiting), mirroring the
status display. Rows without a running session are excluded under any
specific state.

The filter logic lives in filterByQuery.ts alongside the text filter and
is unit-tested; the Menu applies both filters in one pipeline.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Show the active "Filtered: ..." (text search) and "State filter: ..."
indicators directly above the list they narrow, instead of in the footer
status block. The footer keeps only the controls/hints line, with the
redundant "Filtered:" prefix dropped from it.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@kbwo
kbwo marked this pull request as ready for review June 28, 2026 15:06
@kbwo
kbwo merged commit bc5ccfa into main Jun 28, 2026
1 check 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.

Feature Request: Filter sessions by state (idle/busy/waiting) in session list

1 participant