Skip to content

Fix slow file mentions by pruning Git-ignored paths - #3430

Merged
ymichael merged 1 commit into
mainfrom
bb/investigate-file-mentions-in-threads-thr_igk8qyjwk7
Sep 10, 2026
Merged

ymichael merged 1 commit into
mainfrom
bb/investigate-file-mentions-in-threads-thr_igk8qyjwk7

Conversation

@ymichael

Copy link
Copy Markdown
Collaborator

Human comments

What was wrong

After #3390 enabled hidden entries, every file-mention query recursively scanned ignored build output, dependency stores, and nested worktrees. Incremental typing started overlapping scans. A large checkout took 5.84 seconds to search roughly 304,000 entries, leaving the new-thread composer on “Searching mentions…”.

What changed

  • Project and environment searches ask Git for ignored paths and prune those subtrees before traversal. Tracked files and non-ignored untracked files remain searchable, including hidden files. Empty directories, linked worktrees, and non-Git workspaces remain supported.
  • Concurrent queries share pending discovery but rank their results independently. Completed and failed listings are discarded, so subsequent queries see file and ignore-rule changes. Each fresh Git-backed discovery uses two Git subprocesses; there are no per-file subprocesses.
  • General filesystem APIs and skill/thread-storage listing retain their existing ignore behavior. The server explicitly supplies the new respectGitIgnore daemon field; protocol version increases from 198 to 199.
  • Keep .pnpm-store and root-relative .claude/worktrees in the default exclusions. Exclusions now support exact root-relative paths as well as basenames. Update CLI help and guide/SDK documentation.

How you verified

226 relevant tests passed, including tracked files matched by ignore patterns, new untracked files, nested ignore rules and negation, linked worktrees, hidden files, shared discovery, failure recovery, and refresh after edits:

pnpm exec turbo run test --filter=@bb/host-daemon -- file-list.test.ts workspace-path-list.test.ts
pnpm exec turbo run test --filter=@bb/host-daemon -- workspace-dispatch.test.ts
pnpm exec turbo run test --filter=@bb/server -- host-file-routes.test.ts public-environments.test.ts internal-environment-change.test.ts public-thread-data.test.ts
pnpm exec turbo run test --filter=@bb/host-daemon-contract
pnpm exec turbo run typecheck --filter=@bb/host-daemon --filter=@bb/server --filter=@bb/cli

With both new directory exclusions disabled, the same checkout improved from 5.84 s / 304,068 entries to 119 ms / 6,681 entries, retaining README and hidden workflows.

Verified in an isolated source app with Worktree selected: incremental @README search returned tracked and untracked files, selecting the untracked file inserted its mention, and an arbitrary Git-ignored build directory was omitted. The source CLI confirmed general filesystem listing can still inspect ignored files. No deployed instance was changed.

AGENT GENERATED

@ymichael
ymichael merged commit 459e9f1 into main Sep 10, 2026
16 checks passed
@ymichael
ymichael deleted the bb/investigate-file-mentions-in-threads-thr_igk8qyjwk7 branch September 10, 2026 20:33
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