Skip to content

feat(sidebar): replace binary source tabs with multi-select origin filter (#3418)#3566

Open
rodboev wants to merge 2 commits into
nesquena:masterfrom
rodboev:pr/unified-sidebar-filter
Open

feat(sidebar): replace binary source tabs with multi-select origin filter (#3418)#3566
rodboev wants to merge 2 commits into
nesquena:masterfrom
rodboev:pr/unified-sidebar-filter

Conversation

@rodboev

@rodboev rodboev commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Thinking Path

What Changed

  • static/sessions.js: replaced _sessionSourceFilter string with _activeOriginFilters Set; replaced _setSessionSourceFilter / _restoreSessionSourceFilter with _toggleOriginFilter / _restoreOriginFilters; replaced two-tab renderer with a funnel-button popover that lists origin checkboxes; updated localStorage key to hermes-origin-filters; updated new-session reset and CLI empty-state guard; origin normalization maps all CLI-class sessions to 'cli' unconditionally.
  • static/style.css: added .session-filter-bar, .session-origin-popover, .session-origin-checkbox, .session-origin-count styles; kept old .session-source-tabs selectors with a deprecation comment for cache-busted clients.
  • tests/test_issue2351_cli_session_source_filter.py: updated string assertions to match the new state variable and popover structure.
  • tests/test_active_empty_session_sidebar.py: updated the new-session test to verify Set-based initialization.

Why It Matters

Users with mixed-origin setups can now view sessions from multiple origins simultaneously or filter to any subset, instead of flipping between two mutually exclusive views.

Verification

pytest tests/test_issue2351_cli_session_source_filter.py -v --timeout=60
pytest tests/test_active_empty_session_sidebar.py -v --timeout=60
pytest tests/ -v --timeout=60

Risks / Follow-ups

Model Used

Claude Opus 4.8 via Claude Code CLI

Closes #3418

@greptile-apps

greptile-apps Bot commented Jun 4, 2026

Copy link
Copy Markdown

Greptile Summary

This PR replaces the binary WebUI/CLI source tab toggle with a multi-select funnel-popover that lets users filter sessions by any combination of origins (WebUI, CLI, and future gateway types). The state variable changes from a _sessionSourceFilter string to a _activeOriginFilters Set, and _partitionSidebarSessionRows is removed in favor of inline filtering chains inside renderSessionListFromCache.

  • static/sessions.js: _toggleOriginFilter/_restoreOriginFilters replace the old tab helpers; origin filtering is inlined; a funnel-button popover with per-origin checkboxes replaces the two-button tab bar; localStorage key changes to hermes-origin-filters.
  • static/style.css: New .session-filter-bar and .session-origin-popover styles added; deprecated .session-source-tabs kept for cache-busted clients.
  • Tests updated to assert against new variable names, popover structure, and Set-based initialization.

Confidence Score: 2/5

Not safe to merge: renderSessionListFromCache crashes on every call due to a missing archivedCount declaration, breaking the entire sidebar for all users.

The inline refactoring of _partitionSidebarSessionRows left archivedCount undeclared — it is referenced at two points inside renderSessionListFromCache but never assigned anywhere in the new code. This throws a ReferenceError on every sidebar render, making the session list completely non-functional. Additionally, _hydrateTodosFromSession was accidentally dropped from newSession() alongside the now-obsolete filter reset line.

static/sessions.js — the archivedCount omission and the accidental removal of _hydrateTodosFromSession both live here.

Important Files Changed

Filename Overview
static/sessions.js Replaces string-based source filter with a Set-based multi-select origin filter and inlines _partitionSidebarSessionRows; introduces a crash: archivedCount is used but never declared in the refactored code, and _hydrateTodosFromSession was accidentally removed from newSession().
static/style.css Adds CSS for .session-filter-bar, .session-origin-popover and related selectors; keeps deprecated .session-source-tabs styles for cache-busted clients. No issues.
tests/test_active_empty_session_sidebar.py Updates test assertion from string-based filter reset to Set-based initialization check. Straightforward update, no issues.
tests/test_issue2351_cli_session_source_filter.py Updates static-string assertions to match new variable names and popover structure. No issues.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[renderSessionListFromCache] --> B[allMatched: ensureActiveSessionRowPresent]
    B --> C[withMessages: filter by message/activity state]
    C --> D1[webuiSessionCount]
    C --> D2[cliSessionCount]
    C --> E[sourceFiltered: filter by _activeOriginFilters Set]
    E --> F[profileFiltered: exclude default_hidden]
    F --> G[projectFiltered: filter by _activeProject]
    G --> H[sessionsRaw: filter archived]
    H --> I[sessions: collapse lineage + attach children]
    I --> J[Render session rows]
    G --> K[archivedCount UNDEFINED]
    K --> L[Show/hide archived toggle]
Loading

Comments Outside Diff (1)

  1. static/sessions.js, line 4857-4860 (link)

    P0 archivedCount is never declared in the refactored code

    The old _partitionSidebarSessionRows function computed archivedCount and returned it in its result object. That function was deleted and its logic was inlined into renderSessionListFromCache, but the archivedCount accumulation was not ported over. Accessing an undeclared variable throws ReferenceError: archivedCount is not defined on every call to renderSessionListFromCache, making the entire sidebar non-functional.

    The fix is to add const archivedCount = projectFiltered.filter(s => s.archived).length; after projectFiltered is computed.

Reviews (3): Last reviewed commit: "fix(sidebar): prevent popover close on c..." | Re-trigger Greptile

Comment thread static/sessions.js
Comment thread static/sessions.js
@rodboev rodboev force-pushed the pr/unified-sidebar-filter branch from ed27a78 to bae58df Compare June 9, 2026 08:34
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.

UX: unified sidebar session filter (origin multi-select) instead of WebUI/CLI tabs

1 participant