detached 1a2ab42

fix(tui): hide empty sessions from the /sessions picker

Zero-message sessions no longer appear in the picker. Covers three
cases: the currently-running session (its file exists but no prompt
has landed in it yet), sessions the user exited immediately after
/clear, and any stale empties that PruneEmptySessions hasn't swept
yet.

Resuming an empty session was always a no-op, so nothing is lost.
The '(empty)' fallback summary in formatSessionRowPlain stays as
defense in case MessageCount > 0 but FirstUserText is blank.
commit
1a2ab427fe63f1e7617ad420b60c29b8245691a8
author
patriceckhart · · 2026-04-19 15:16 UTC
parent
961f99d
signature
unsigned
refs
tag: v0.0.37
1 file · +14 -2
M internal/agent/modes/session_dialog.go +14 -2
@@ -25,9 +25,21 @@ type sessionDialogAction struct {
2525
2626 func newSessionDialog() *sessionDialog { return &sessionDialog{} }
2727
28-// Open populates the dialog from root + cwd and shows it.
28+// Open populates the dialog from root + cwd and shows it. Empty
29+// sessions (zero messages) are filtered out so the currently-running
30+// session, a freshly-opened one that hasn't received a prompt yet,
31+// and any stale empties that haven't been pruned yet all stay out
32+// of the picker. Resuming an empty session is a no-op anyway.
2933 func (d *sessionDialog) Open(root, cwd string) {
30- d.sessions = core.DescribeSessions(root, cwd)
34+ all := core.DescribeSessions(root, cwd)
35+ filtered := make([]core.SessionSummary, 0, len(all))
36+ for _, s := range all {
37+ if s.MessageCount == 0 {
38+ continue
39+ }
40+ filtered = append(filtered, s)
41+ }
42+ d.sessions = filtered
3143 d.cursor = 0
3244 d.active = true
3345 }
@@ -25,9 +25,21 @@ type sessionDialogAction struct {
25 25
26 func newSessionDialog() *sessionDialog { return &sessionDialog{} }26 func newSessionDialog() *sessionDialog { return &sessionDialog{} }
27 27
28-// Open populates the dialog from root + cwd and shows it.28+// Open populates the dialog from root + cwd and shows it. Empty
29+// sessions (zero messages) are filtered out so the currently-running
30+// session, a freshly-opened one that hasn't received a prompt yet,
31+// and any stale empties that haven't been pruned yet all stay out
32+// of the picker. Resuming an empty session is a no-op anyway.
29 func (d *sessionDialog) Open(root, cwd string) {33 func (d *sessionDialog) Open(root, cwd string) {
30- d.sessions = core.DescribeSessions(root, cwd)34+ all := core.DescribeSessions(root, cwd)
35+ filtered := make([]core.SessionSummary, 0, len(all))
36+ for _, s := range all {
37+ if s.MessageCount == 0 {
38+ continue
39+ }
40+ filtered = append(filtered, s)
41+ }
42+ d.sessions = filtered
31 d.cursor = 043 d.cursor = 0
32 d.active = true44 d.active = true
33 }45 }

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 1

Tags 476

↑↓ moveenter openesc close