Repository navigation
Description
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
maincommit69a2386623e7fe44e01436d7cfb109af36106de0 - 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):
cd apps/app && pnpm exec vitest run src/hooks/usePromptMentions.freshness.test.tsx
Each case fails on current main as written:
- Rename never reaches the menu. Sidebar bootstrap serves thread "Deploy notes"; menu query
deployshows it. The stubbed server then renames the thread to "Ship checklist" (what an ✨ autotitle pass or another window does). Menu closed and reopened with queryship: zero suggestions. The sidebar-derived candidate pool uses a query withstaleTime: Infinityand is only ever freshened by websocket patch events, so any missed event strands the pool until reload. (Root cause links below.) - 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. - Stale path rows from the previous keystroke. Query
oldsettles and shows path row/docs/old-notes.md. Immediately retyped tolag(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. - 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 = 200in 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):
- Candidate pool cap and slicing:
thread-queries.tsL110, L292 - Sidebar-derived candidates win outright; the server fetch (limit 200, 10s stale) only runs pre-bootstrap:
thread-queries.tsL586-L615 - Realtime-owned, never-refetched cache policy (
staleTime: Infinity):sidebar-navigation-query.tsL41-L45 - Path suggestions not gated on the settled query, while the plugin source is:
usePromptMentions.tsL193-L201 vs L163-L177; debounce is 120 ms:usePathSuggestions.tsL10 - Partial staleness is never surfaced:
isLoadingis only true when the result set is empty:usePromptMentions.tsL268-L279 - Section groups re-rank on best-row match every keystroke, which adds order instability on top:
mention-candidates.tsL113-L127 - Thread match text is title-or-id only (aliases: id, resolved title):
threadMentionSuggestions.tsL58
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
bb-slop-cop commentedon Oct 14, 2026
🚨 SLOP COP 🚨 ·
new-issue-autopilotui. No existing values were replaced.confirmed-repro. Five regression cases fail on trusted main in both clean checkouts; the report includes the complete test and outputs.Let the @ picker match threads past the first 200 (get-bb#5476)