Skip to content

feat(tui): move search to background worker with deferred filters#55

Merged
samzong merged 1 commit into
mainfrom
feat/tui-background-search
Jun 16, 2026
Merged

feat(tui): move search to background worker with deferred filters#55
samzong merged 1 commit into
mainfrom
feat/tui-background-search

Conversation

@samzong

@samzong samzong commented Jun 16, 2026

Copy link
Copy Markdown
Owner

What's changed?

  • Move TUI search off the main thread into a background SearchWorker that runs text search first, then semantic refinement
  • Defer filter edits until Esc applies them, using draft state for source, project, time range, and sort
  • Track search request IDs to ignore stale responses when typing quickly
  • Show inline search feedback in the query box (queued, searching, refining semantic)
  • Increase search debounce to 250ms

Why

  • Hybrid text+semantic search was blocking the TUI event loop, making typing and navigation feel sluggish
  • Filter tweaks previously triggered immediate re-searches; deferring until Esc keeps the filter panel usable without redundant work

Verification

  • cargo test — 247 tests passed (192 unit, 7 CLI, 5 eval harness, 43 regression)

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 841534350e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/tui/app.rs
if !self.semantic_ready() {
self.run_search(store, engine, None);
pub fn apply_search_response(&mut self, store: &Store, response: SearchResponse) {
if response.id != self.active_search_id || response.query != self.query.trim() {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Invalidate in-flight searches when applying filters

When filters are applied while a previous search for the same query is still in flight, close_filters updates the active filters but only queues a debounced replacement search; until that new request is sent, this guard still accepts the old response because it only compares request id and query text. That can briefly replace the list with results from the old source/project/time scope under the new filter bar, and a quick Enter can open a session outside the selected filters; invalidate the active request or include the filter snapshot in the staleness check when filters change.

Useful? React with 👍 / 👎.

Signed-off-by: samzong <samzong.lu@gmail.com>
@samzong samzong force-pushed the feat/tui-background-search branch from 8415343 to 12be17a Compare June 16, 2026 15:46
@samzong samzong merged commit e8755db into main Jun 16, 2026
1 check passed
@samzong samzong deleted the feat/tui-background-search branch June 16, 2026 15:50
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.

1 participant