这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@balanceiskey
Copy link
Contributor

@balanceiskey balanceiskey commented Oct 24, 2025

What problem(s) was I solving?

Users couldn't find sessions in the cmd+k command palette when searching for text that was actually displayed in the UI. The disconnect happened because:

  1. UI Display Logic: The WUI displays session text using a fallback pattern: session.title || session.summary || session.query (see CommandPaletteMenu.tsx:218 and formatting.ts:160)
  2. Search Logic Mismatch: The backend SearchSessionsByTitle was only searching the title field
  3. Result: Sessions without an explicit title (showing their summary or query instead) wouldn't appear in search results even when users typed the exact text they saw in the UI

Additionally, the search was returning sessions that shouldn't be user-facing:

  • Parent sessions (which have children and aren't "real" leaf sessions)
  • Archived sessions
  • Draft sessions
  • Discarded sessions

What user-facing changes did I ship?

Users can now find sessions in cmd+k search by typing any part of the text they see displayed in the UI:

  • Search now works across title, summary, and query fields
  • Search results are cleaner - only shows active, leaf sessions
  • No more confusing results from archived/draft/discarded sessions
  • No more parent sessions cluttering results

How I implemented it

Updated SearchSessionsByTitle in hld/store/sqlite.go:

  1. Expanded search scope: Changed from single field (title LIKE ?) to multi-field search (title LIKE ? OR summary LIKE ? OR query LIKE ?)
  2. Added leaf session filter: Added subquery to exclude sessions that have children
  3. Added status filters: Filter out archived (archived = 1), draft (status = 'draft'), and discarded (status = 'discarded') sessions
  4. Updated API documentation: Modified openapi.yaml to reflect new search behavior and comprehensive description

Added comprehensive test coverage in hld/store/sqlite_test.go:

  • Test for leaf session filtering (only children returned, not parents)
  • Tests for excluding archived, draft, and discarded sessions
  • Test for multi-field search across title, summary, and query
  • Verified ordering by last_activity_at DESC

How to verify it

  • I have ensured make check test passes

Manual Testing

To verify this fix manually:

  1. Start the WUI in dev mode (make wui-dev)
  2. Create test sessions with different field combinations:
    • Session with only title set
    • Session with only summary set (no title)
    • Session with only query set (no title or summary)
  3. Open cmd+k command palette
  4. Search for text from each field and verify all sessions appear in results
  5. Archive a session and verify it no longer appears in search
  6. Create a child session and verify the parent doesn't appear in search

Description for the changelog

fix(hld): Session search now searches across title, summary, and query fields to match UI display logic; filters to only active leaf sessions

Update SearchSessionsByTitle to:
- Search across title, summary, and query fields (matching UI fallback display)
- Filter to only leaf sessions (no children)
- Exclude archived, draft, and discarded sessions

This ensures cmd+k session search in WUI finds sessions that display their
query/summary text when no explicit title is set.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

Important

Looks good to me! 👍

Reviewed everything up to dc300ca in 2 minutes and 19 seconds. Click for details.
  • Reviewed 219 lines of code in 3 files
  • Skipped 0 files when reviewing.
  • Skipped posting 8 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. hld/api/openapi.yaml:519
  • Draft comment:
    Good update: The OpenAPI spec now clearly documents that the search will match across title, summary, and query fields and returns only leaf (non-archived, non-draft, non-discarded) sessions.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50% This comment is purely informative, describing what the OpenAPI spec now documents. It doesn't provide a suggestion, ask for confirmation, or point out a potential issue.
2. hld/store/sqlite.go:1787
  • Draft comment:
    In SearchSessionsByTitle, the SQL query appends a fixed 'LIMIT 20' clause regardless of the user-provided limit, and then the result slice is truncated in Go. Consider parameterizing the LIMIT directly in the SQL query to avoid over-fetching rows when a lower limit is requested.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
3. hld/store/sqlite.go:1795
  • Draft comment:
    Update the inline comment: It currently refers to 'substring matching anywhere in title' but now the search applies to title, summary, and query fields. Adjust the comment for consistency.
  • Reason this comment was not posted:
    Comment was on unchanged code.
4. hld/store/sqlite.go:1810
  • Draft comment:
    The filtering for leaf sessions using the 'NOT EXISTS' clause is well implemented and ensures that parent sessions are excluded.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50% This comment is purely informative and does not provide any actionable feedback or suggestions for improvement. It simply praises the implementation without offering any specific guidance or questions.
5. hld/store/sqlite_test.go:864
  • Draft comment:
    The test cases for SearchSessionsByTitle are comprehensive, covering case-insensitive search, exclusion of archived/draft/discarded sessions, filtering to leaf sessions, and matching across all three fields. Excellent coverage!
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50% This comment is purely informative, as it only praises the comprehensiveness of the test cases without providing any actionable feedback or suggestions for improvement.
6. hld/store/sqlite_test.go:453
  • Draft comment:
    The 'GetSessionConversationWithParentChain' tests effectively validate the parent-child-grandchild conversation chain ordering. This ensures that full historical context is retrieved in the right order.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
7. hld/store/sqlite.go:0
  • Draft comment:
    Overall, the use of parameterized queries and error handling is robust. Consider refactoring repeated scanning code in methods like GetSession and ListSessions into helper functions to reduce duplication, though this is a low-priority improvement.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50% None
8. hld/store/sqlite.go:1816
  • Draft comment:
    Typographical issue: There appears to be an extraneous backtick at the end of the SQL condition on line 1816 (AND status != 'discarded''`). This backtick should likely be removed to avoid potential SQL syntax errors.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 0% vs. threshold = 50% The comment is incorrect. The backtick is part of a multi-line SQL string literal in Go that starts several lines above. Removing it would break the SQL query. The backtick is intentional and required for the code to work properly. Could there be a case where the backtick should be moved to a different line for better readability? Should the SQL query formatting be changed? No, the current formatting is clear and follows standard Go practices for multi-line string literals. The backtick placement is correct and conventional. The comment is incorrect and should be deleted. The backtick is a necessary part of the Go string literal syntax and removing it would break the code.

Workflow ID: wflow_KAOYMS2W7XB4efxw

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

@K-Mistele K-Mistele merged commit 475f063 into humanlayer:main Oct 24, 2025
8 checks passed
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