feat(sidebar): add show_kanban_sessions toggle to hide kanban worker sessions (#6780)

* feat(sidebar): add show_kanban_sessions toggle to hide kanban worker sessions

* fix(sidebar): kanban source-filter override + filtered-view cap (cron/webhook parity)

Gate re-review (Codex) found the kanban-hide addition missed cron/webhook
parity for the source-filter case:
- An explicit kanban source_filter now overrides the default hide (threaded
  source_filter into _dedupe_cli_sidebar_sessions_for_api, normalized with
  strip().lower() to match the loader), so a deliberate kanban view shows
  those rows even with the toggle off. Scoped to the matching source only.
- A dedicated KANBAN_PROJECT_CHIP_LIMIT bounds a filtered kanban-only view,
  mirroring CRON/WEBHOOK_PROJECT_CHIP_LIMIT.

Deliberately NOT changing the general exclude_sources: the original PR lets
kanban load on the source_filter=None path so the toggle-ON case works (the
hide is applied by _hide_from_default_sidebar only when the toggle is off).
Excluding kanban there would save the 20-row budget but break toggle-on
unless a bounded kanban merge is added (cron/webhook don't do that either) —
that query-budget optimization is deferred as a separate cross-cutting change.
The pinned-survives-hide finding is also out of scope (cron/webhook hide pinned
identically, confirmed by Codex). Adds bite-tested regressions.

Co-authored-by: vduke <vduke@users.noreply.github.com>

---------

Co-authored-by: nesquena-hermes <nesquena-hermes@users.noreply.github.com>
This commit is contained in:
Vincent Dukeandnesquena-hermes authored and GitHub committed 2026-08-09 02:53:25 +00:00
1 parent eb04bf5951
commit 64c2c12df7
9 files changed
+217 -3

No files matched your search

+9 -2
View File
@@ -52,6 +52,10 @@ CLI_VISIBLE_SESSION_LIMIT = 20
# sidebar window (#3172).
CRON_PROJECT_CHIP_LIMIT = 200
WEBHOOK_PROJECT_CHIP_LIMIT = 200
# Kanban worker runs are internal/background like cron+webhook; keep the same
# higher project-chip cap so project-assigned kanban rows stay addressable when
# the toggle is on, without letting them dominate the default sidebar window.
KANBAN_PROJECT_CHIP_LIMIT = 200
_CLI_SESSIONS_CACHE_TTL_SECONDS = 5.0
# While a turn is actively streaming, hold the CLI/cron projection longer than
# one poll interval (mirrors the route-level #4808 hold-down). The frontend
@@ -4976,7 +4980,7 @@ def new_session(workspace=None, model=None, profile=None, model_provider=None, p
s.save()
return s
def _hide_from_default_sidebar(session: dict, *, show_cron: bool = False, show_webhook: bool = False) -> bool:
def _hide_from_default_sidebar(session: dict, *, show_cron: bool = False, show_webhook: bool = False, show_kanban: bool = False) -> bool:
"""Return True for internal/background sessions hidden from the default list."""
sid = str(session.get('session_id') or '')
source = (
@@ -4989,6 +4993,8 @@ def _hide_from_default_sidebar(session: dict, *, show_cron: bool = False, show_w
return True
if not show_webhook and source == 'webhook':
return True
if not show_kanban and source == 'kanban':
return True
if bool(session.get('pre_compression_snapshot')):
return not bool(session.get('_show_pre_compression_snapshot'))
return False
@@ -5042,7 +5048,7 @@ def _is_intentionally_background_sidebar_session(session: dict) -> bool:
or session.get('raw_source')
or session.get('session_source')
)
return source in {'cron', 'webhook'} or sid.startswith('cron_')
return source in {'cron', 'webhook', 'kanban'} or sid.startswith('cron_')
def _include_project_hidden_background_sidebar_sessions(
@@ -7543,6 +7549,7 @@ def _load_cli_sessions_uncached(
limit=visible_session_limit if visible_session_limit is not None else (
CRON_PROJECT_CHIP_LIMIT if source_filter == 'cron'
else WEBHOOK_PROJECT_CHIP_LIMIT if source_filter == 'webhook'
else KANBAN_PROJECT_CHIP_LIMIT if source_filter == 'kanban'
else CLI_VISIBLE_SESSION_LIMIT
),
log=logger,