Skip to content

fix(tui): clear stale status filter when no sessions match#362

Closed
mstege wants to merge 1 commit intoasheshgoplani:mainfrom
mstege:fix/status-filter-empty-list
Closed

fix(tui): clear stale status filter when no sessions match#362
mstege wants to merge 1 commit intoasheshgoplani:mainfrom
mstege:fix/status-filter-empty-list

Conversation

@mstege
Copy link
Copy Markdown

@mstege mstege commented Mar 18, 2026

Had a fun time debugging this one. After upgrading to 0.26.3, my TUI showed "No Sessions Yet" even though sessions clearly existed (header bar had the correct count).

Turns out loadUIState() restores the persisted status filter on startup. If the sessions that matched that filter got removed in the meantime, rebuildFlatItems() filters everything out and you end up with an empty list. The header counts are fine because they read from h.instances directly, not from flatItems.

In my case I had 18 sessions in error state (tmux server wasnt running), removed them all with ad rm, created new ones, and the TUI just showed nothing. The old "error" filter was still saved in the sqlite metadata and kept hiding everything.

The fix just clears the status filter when it would produce an empty result but sessions are actually there.

repro steps

  1. have sessions in some status (e.g. error)
  2. filter to that status (gets persisted to ui_state metadata)
  3. remove all those sessions
  4. add new sessions with a different status
  5. restart AD, session list is empty

workaround

quit AD, then run:

sqlite3 ~/.agent-deck/profiles/default/state.db \
  "UPDATE metadata SET value='{\"preview_mode\":0,\"status_filter\":\"\"}' WHERE key='ui_state';"

when all sessions matching the persisted status filter get removed,
rebuildFlatItems() produces an empty list on next startup because
loadUIState() restores the old filter. the header bar shows the
correct count but the session list stays empty.

this clears the filter automatically when it would result in an
empty list but sessions actually exist.
@asheshgoplani
Copy link
Copy Markdown
Owner

Closing: this fix is already on main. The stale status filter auto-clear logic was applied in an earlier commit. Thank you for the contribution!

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.

2 participants