Skip to content

Composer @ picker serves stale and missing threads and projects (realtime-only cache, 200-entry cap, ungated path rows) #5475

Closed

Description

@cristoslc

Summary

Typing @ in the composer's mention picker in the thread pane serves wrong, stale, and missing results. Observed on 0.46.0 main: threads that exist are not found by exact title search (no rename involved), projects fail to appear, a thread renamed outside the client keeps its old title in the menu until the app reloads, and workspace path rows answering an earlier keystroke survive into the current query. Expected: every non-hidden non-archived thread and project is mentionable by its visible text, and menu rows always answer the text currently in the composer.

Versions and environment

  • bb 0.46.0, from source at main commit 69a2386623e7fe44e01436d7cfb109af36106de0
  • macOS 26.7.1, Node v24.14.0 (source checkout)
  • Not provider-related: reproduces headlessly with zero network beyond the app's own API stubs
  • Live symptom first reported from a bb session running ~50+ projects/threads of real usage; the repro below does not need that dataset

Steps to reproduce

Automated, headless. Four vitest cases in a new test file apps/app/src/hooks/usePromptMentions.freshness.test.tsx (uncommitted, working tree of 69a2386; the file drives usePromptMentions through real stores with a stubbed fetch):

  1. cd apps/app && pnpm exec vitest run src/hooks/usePromptMentions.freshness.test.tsx

Each case fails on current main as written:

  1. Rename never reaches the menu. Sidebar bootstrap serves thread "Deploy notes"; menu query deploy shows it. The stubbed server then renames the thread to "Ship checklist" (what an ✨ autotitle pass or another window does). Menu closed and reopened with query ship: zero suggestions. The sidebar-derived candidate pool uses a query with staleTime: Infinity and is only ever freshened by websocket patch events, so any missed event strands the pool until reload. (Root cause links below.)
  2. Project created outside the cache never appears. Same setup; server adds project "Fresh Project"; menu reopened with query fresh: zero suggestions. Projects come from the same realtime-owned cache.
  3. Stale path rows from the previous keystroke. Query old settles and shows path row /docs/old-notes.md. Immediately retyped to lag (which matches the thread row, not the file): the old path row is still rendered because path suggestions are not gated on the settled debounced query, unlike the plugin source which is.
  4. Threads beyond the 200-entry cap are unmentionable. 210 seeded threads; exact-title search for "Bulk thread 205": zero suggestions. The candidate pool is sliced at THREAD_MENTION_CANDIDATE_LIMIT = 200 in sidebar display order, so every thread past it is unmentionable, rename or not.

Manual cross-check of case 4's mechanism: useSidebarNavigationThreadSelection(selectThreadMentionCandidates) slices the sidebar's thread list to 200 (permalink in Evidence); the operator's instance has far more active threads, which matches the reported "threads not listed when searched".

Did NOT reproduce: with ≤200 seeded threads whose titles are current — search and ordering are correct; the defects are confined to freshness, pool coverage, and cross-source gating.

Expected vs actual

Case 1, verbatim (after the rename and reopen):

AssertionError: expected [] to deeply equal [ ObjectContaining{…} ]

Case 3, verbatim (immediately after retyping old → lag, with the debounce still pending):

AssertionError: expected [ { kind: 'path', …(5) } ] to deeply equal []
- []
+ [ { "entryKind": "file", "kind": "path", "name": "old-notes.md",
+     "path": "/docs/old-notes.md", "replacement": "/docs/old-notes.md",
+     "source": "workspace" } ]

Cases 2 and 4 fail identically to case 1's shape ([] where a specific thread or project row is expected). The two pre-existing usePromptMentions suites still pass, so the harness is not the variable.

Evidence

Root causes (permalinks to 69a2386623e7fe44e01436d7cfb109af36106de0):

Investigating thread: thr_9tsqmt9sva (bb session "Fix thread pane search picker"); the four failing tests and their harness came out of that session.

What you ruled out

  • Not a duplicate of Search and typeahead stall on full-text SQL, repeated file discovery, and slow mention providers #4413: that report targets latency (blocking full-text SQL, file discovery, slow providers). These are correctness/data-freshness defects that reproduce instantly with zero load; the two can be fixed independently.
  • Not the fuzz matcher: with ≤200 fresh candidates all names match, rank, and render correctly (case-level fixtures pass).
  • Not the fallback thread-list fetch: it is unreachable whenever sidebar data exists, so its 10s staleness is moot for the reported symptoms.
  • Not timing flake: all four failures are deterministic assertions at stable states, not races the test observed once.

Suggested priority and effort (optional)

High for heavy bb usage: with more than ~200 active threads some threads are permanently unmentionable, and any missed realtime patch strands titles/projects until reload. Workaround: reload the app window (and keep under 200 threads). No data loss; effort probably Medium — the palette's debounced server-side useThreadSearch already implements the pattern this wants.

AGENT GENERATED

Activity

  1. added theissue type on Oct 14, 2026
  2. added
    ui
    confirmed-repro
    on Oct 14, 2026
  3. bb-slop-cop commented on Oct 14, 2026

    @bb-slop-cop
    Contributor

    🚨 SLOP COP 🚨 · new-issue-autopilot

    • Classification applied: Bug · Priority Medium · Effort Medium · ui. No existing values were replaced.
    • Report and reproduction: REPRODUCED, high root-cause confidence; label confirmed-repro. Five regression cases fail on trusted main in both clean checkouts; the report includes the complete test and outputs.
    • Root cause: matching starts from a truncated sidebar pool; reopening trusts an indefinitely fresh cache after missed updates; path rows retain previous-query debounce and placeholder data.
    • Ready fix: PR #5476, not merged. 257 changed text lines across five files; 74 relevant tests, lint/typecheck, and whitespace checks pass. Realtime loss is simulated; the fix refreshes on reopening.

    AGENT GENERATED

  4. self-assigned this
    on Oct 14, 2026
  5. removed their assignment
    on Oct 14, 2026
  6. added a commit that references this issue on Oct 14, 2026
    6b8a999
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    confirmed-reproui

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions