Skip to content

Include hidden entries in host file listings with server-owned exclusions - #3390

Merged
andrewkchan merged 3 commits into
mainfrom
list-paths-include-hidden
Sep 10, 2026
Merged

andrewkchan merged 3 commits into
mainfrom
list-paths-include-hidden

Conversation

@andrewkchan

@andrewkchan andrewkchan commented Sep 10, 2026 •

Copy link
Copy Markdown
Collaborator

Human comments

This fixes #2093 without also regressing performance for the file search in projects with huge node_modules, etc. Basically right now hidden dirs are unconditionally skipped, this adds an option to the list_files and list_paths commands that allows to include hidden files.

What was wrong

The host daemon's shared recursive walker (listPathsRecursively in apps/host-daemon/src/command-handlers/file-list.ts) unconditionally skipped every dot-prefixed entry, node_modules, and symlinks. Both host.list_files and host.list_paths go through it and neither command carried a field to relax the rule, so quick-open, @-mentions, the Monaco file tree, and every files.listPaths consumer inherited it. .github/workflows/ci.yml could be read through host.read_file but never appeared in a listing. See #2093 and the investigation report.

The dot rule was also accidentally doing gitignore's job: the report measured that simply removing it lets .venv, .turbo, and .next dominate results and slow each keystroke by 80 to 150x on Python and Next.js repos. So the policy had to move rather than just be deleted.

What changed

Three commits, in order:

  1. includeHidden becomes a required boolean on host.list_files and host.list_paths. The server decides it per route: environment and project path search and files.list/files.listPaths default to true; thread storage and the two skill enumerators pass false (the skill read path uses dotfiles: "deny", so listing dot entries there would produce clickable 404s). Monaco passes true explicitly; the docs plugin passes false to keep .obsidian and similar out of vault sync. The public files routes, SDK FileListArgs, and bb file list|paths --no-hidden expose it.
  2. excludeNames becomes a required string[] on both commands. The daemon only hardcodes .git; the server fills a default set from apps/server/src/routes/path-list-policy.ts (node_modules, .venv, venv, .turbo, .next, .cache, __pycache__, .DS_Store). This mirrors the always-ignored globs the host-watcher already uses. The public files routes, SDK, and bb file list|paths --exclude <names...> accept a replacement list. Array length and name length are bounded by new @bb/domain constants.
  3. HOST_DAEMON_PROTOCOL_VERSION 197 → 198, since both new wire fields are required.

Docs updated: bb-guide-customization.md template, the bb-cli skill's thread-operation.md, and the plugin-authoring backend-sdk.md reference. host.browse_directory (the home-folder picker) is intentionally unchanged.

Deviation from the issue's proposal: no respectGitignore field. We want gitignored files in search and the tree; the curated exclude list handles the directories that actually dominate checkouts.

How you verified

New tests, which fail before each commit and pass after:

  • file-list.test.ts: dot entries listed only when includeHidden is true; excluded names skipped at any depth (files and directories); .git never listed even with includeHidden: true and an empty exclude list.
  • contract.test.ts: list commands are rejected without includeHidden or excludeNames, with an empty name, or with more than FILE_LIST_EXCLUDE_NAMES_MAX names; protocol version pinned to 198.
  • host-file-routes.test.ts: default includeHidden: true and default exclude list are filled when the payload omits them; explicit includeHidden: false and excludeNames pass through to the daemon.
  • public-environments.test.ts and public-thread-data.test.ts assert the per-route defaults on the wire.

Commands run:

pnpm exec turbo run typecheck --filter=@bb/host-daemon-contract --filter=@bb/host-daemon --filter=@bb/server --filter=@bb/server-contract --filter=@bb/sdk --filter=@bb/cli --filter=bb-plugin-simple-notes --filter=bb-plugin-monaco-editor
pnpm exec turbo run test --filter=@bb/host-daemon-contract
pnpm exec turbo run test --filter=@bb/host-daemon -- --run src/command-handlers/file-list.test.ts test/command/workspace-dispatch.test.ts
pnpm exec turbo run test --filter=@bb/server -- --run test/files/host-file-routes.test.ts test/public/public-environments.test.ts test/public/public-thread-data.test.ts test/public/public-project-workspace-routing.test.ts test/public/public-project-skills.test.ts test/internal/internal-environment-change.test.ts test/threads/thread-runtime-config.test.ts
pnpm exec turbo run test --filter=@bb/sdk --filter=@bb/cli --filter=@bb/domain --filter=bb-plugin-simple-notes --filter=bb-plugin-monaco-editor

All pass. Manual probe of the real listHostPaths handler against this repo's checkout (the issue's repro root):

before: query ci.yml, includeHidden=false (126 ms)
  apps/mobile/e2e/subflows/clear-open-confirmation.yaml

after: query ci.yml, includeHidden=true, default excludes (68 ms)
  .github/workflows/ci.yml
  .github/ISSUE_TEMPLATE/config.yml
  .github/workflows/approve-contributor.yml
  ...

after: query turbo, default excludes (72 ms)
  turbo.json
  scripts/prune-turbo-cache.mjs
  ...

after: query turbo, no excludes (3138 ms)
  node_modules/.pnpm/[email protected]/node_modules/turbo/LICENSE
  ...

full tree with defaults: contains .github/workflows/ci.yml=true, any .turbo path=false, any .git path=false

Fixes #2093

🤖 Generated with Claude Code

AGENT GENERATED

andrewkchan and others added 3 commits September 9, 2026 21:15
The host daemon walker unconditionally skipped every dot-prefixed entry,
so quick-open, @-mentions, and the Monaco file tree could not find files
such as .github/workflows/ci.yml. Make hidden-entry inclusion a required
field on host.list_files and host.list_paths, decided by the server:
workspace search and the Monaco tree include hidden entries, while thread
storage, skill enumeration, and the docs plugin keep them hidden. Expose
includeHidden on the public files routes, SDK, and bb file CLI.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Including hidden entries lets dependency and cache directories such as
.venv, .turbo, and .next dominate quick-open results and slow every
keystroke. Move that exclusion policy to the server: host.list_files and
host.list_paths take a required excludeNames list, the daemon only refuses
.git on its own, and the server fills a default set (node_modules, .venv,
venv, .turbo, .next, .cache, __pycache__, .DS_Store). The public files
routes, SDK, and bb file CLI accept excludeNames to replace that set.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
host.list_files and host.list_paths gained required includeHidden and
excludeNames fields, so enrolled daemons must update to accept them.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
@andrewkchan
andrewkchan merged commit a315e16 into main Sep 10, 2026
16 checks passed
@andrewkchan
andrewkchan deleted the list-paths-include-hidden branch September 10, 2026 04:36
ymichael added a commit that referenced this pull request Sep 10, 2026
## 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:

```sh
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
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.

Path listing hides every dotfile and node_modules unconditionally, so file search cannot find .github/workflows/ci.yml

1 participant