From 4e6ae25505208f1dfc4792b6065a204afdf6c5fe Mon Sep 17 00:00:00 2001 From: Aliou Diallo Date: Mon, 12 Jan 2026 16:30:08 +0100 Subject: [PATCH] fix(coding-agent): prevent session selector from closing immediately when current folder has no sessions Remove auto-cancel in loadCurrentSessions() so users can press Tab to switch to "all" scope. Add context-aware empty state messages. --- packages/coding-agent/CHANGELOG.md | 4 ++++ .../modes/interactive/components/session-selector.ts | 12 +++++++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/packages/coding-agent/CHANGELOG.md b/packages/coding-agent/CHANGELOG.md index a07112c0..eb124244 100644 --- a/packages/coding-agent/CHANGELOG.md +++ b/packages/coding-agent/CHANGELOG.md @@ -7,6 +7,10 @@ - Extension example: `notify.ts` for desktop notifications via OSC 777 escape sequence ([#658](https://github.com/badlogic/pi-mono/pull/658) by [@ferologics](https://github.com/ferologics)) - Inline hint for queued messages showing the `Alt+Up` restore shortcut ([#657](https://github.com/badlogic/pi-mono/pull/657) by [@tmustier](https://github.com/tmustier)) +### Fixed + +- Session selector now stays open when current folder has no sessions, allowing Tab to switch to "all" scope ([#661](https://github.com/badlogic/pi-mono/pull/661) by [@aliou](https://github.com/aliou)) + ## [0.43.0] - 2026-01-11 ### Breaking Changes diff --git a/packages/coding-agent/src/modes/interactive/components/session-selector.ts b/packages/coding-agent/src/modes/interactive/components/session-selector.ts index 747c0b4a..eb89acc2 100644 --- a/packages/coding-agent/src/modes/interactive/components/session-selector.ts +++ b/packages/coding-agent/src/modes/interactive/components/session-selector.ts @@ -145,7 +145,13 @@ class SessionList implements Component { lines.push(""); // Blank line after search if (this.filteredSessions.length === 0) { - lines.push(theme.fg("muted", " No sessions found")); + if (this.showCwd) { + // "All" scope - no sessions anywhere that match filter + lines.push(theme.fg("muted", " No sessions found")); + } else { + // "Current folder" scope - hint to try "all" + lines.push(theme.fg("muted", " No sessions in current folder. Press Tab to view all.")); + } return lines; } @@ -298,10 +304,6 @@ export class SessionSelectorComponent extends Container { this.header.setLoading(false); this.sessionList.setSessions(sessions, false); this.requestRender(); - // If no sessions found, cancel - if (sessions.length === 0) { - this.onCancel(); - } }); }