Skip to content

feat(tui): extend session browser search to match session IDs#3708

Merged
Sayt-0 merged 1 commit into
docker:mainfrom
dgageot:feat/sessions-search-by-id
Jul 17, 2026
Merged

feat(tui): extend session browser search to match session IDs#3708
Sayt-0 merged 1 commit into
docker:mainfrom
dgageot:feat/sessions-search-by-id

Conversation

@dgageot

@dgageot dgageot commented Jul 17, 2026

Copy link
Copy Markdown
Member

The /sessions browser search filter previously matched only session titles. Users who copy a session ID (e.g. from ctrl+y or a log) and paste it into the search box got no results, which made it hard to jump back to a known session.

This change extends filterSessions so that a query also matches against the session ID, case-insensitively and with - characters stripped on both sides. That means full UUIDs, dash-less variants, and partial fragments — however the user pastes or types them — all resolve to the right session. Title matching is completely unchanged.

A new test TestSessionBrowserSearchByID covers full-ID, dash-less, partial-with-dashes, partial-without-dashes, case-insensitive, title-fallback, and no-match cases.

@dgageot
dgageot requested a review from a team as a code owner July 17, 2026 08:33
@aheritier aheritier added area/tui For features/issues/fixes related to the TUI kind/feat PR adds a new feature (maps to feat:). Use on PRs only. labels Jul 17, 2026

@docker-agent docker-agent left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assessment: 🟢 APPROVE

The ID-matching logic is correct and the implementation is clean. One minor edge case worth considering: a query consisting entirely of dashes (e.g. ---) reduces to an empty idQuery after stripping, so the ID path never matches, and the title path also never matches, leaving the user with an empty results list. See the inline comment for details.

func (d *sessionBrowserDialog) filterSessions() {
query := strings.ToLower(strings.TrimSpace(d.textInput.Value()))
// IDs are matched with dashes stripped so partial UUIDs paste-match.
idQuery := strings.ReplaceAll(query, "-", "")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[low] Dash-only query filters out all sessions instead of showing all

When a user types a string composed entirely of dashes (e.g. ---), query is non-empty ("---"), so the if query != "" guard fires and filtering is applied. However, idQuery becomes "" after dash-stripping, making matchesSessionID return false. Normal session titles do not contain "---" either, so every session is filtered out and the user sees an empty list.

A user who pastes or types --- might reasonably expect all sessions to appear (as if the query were empty), but instead gets zero results with no feedback. The test suite does not cover this edge case.

One way to address it: after computing idQuery, if it is empty reset query to "" so the loop treats the input as no-op filtering:

idQuery := strings.ReplaceAll(query, "-", "")
if idQuery == "" {
    query = ""
}

This keeps both the title path and the ID path consistent with the intent that a "blank" query (or one that reduces to blank) shows all sessions.

Confidence Score
🟡 moderate 75/100

@Sayt-0
Sayt-0 merged commit 2e38fb4 into docker:main Jul 17, 2026
11 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/tui For features/issues/fixes related to the TUI kind/feat PR adds a new feature (maps to feat:). Use on PRs only.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants