Repository navigation
Search every folder the agent can use for @-mentions - #8076
Merged
ymichael merged 2 commits intoNov 25, 2026
Merged
Conversation
ymichael
force-pushed
the
bb/composer-mentions-across-folders-thr_psx98pzvux
branch
from
November 24, 2026 06:08
cc582d1 to
106b559
Compare
ymichael
added a commit
that referenced
this pull request
Nov 24, 2026
…der each result is from Squashed rebase of #8076 onto main after #8065. Extra folders now come from main's mergeWorkspaceFolderPaths, so a project folder replaced by an environment folder is searched through its replacement only. Plugin SDK 0.6.199 and host daemon protocol 284 for the host.list_paths rootPaths change. Co-Authored-By: Claude Opus 5.5 <[email protected]>
ymichael
force-pushed
the
bb/composer-mentions-across-folders-thr_psx98pzvux
branch
from
November 24, 2026 22:36
489e6c8 to
5c4cab1
Compare
…der each result is from Squashed rebase of #8076 onto main after #8065. Extra folders now come from main's mergeWorkspaceFolderPaths, so a project folder replaced by an environment folder is searched through its replacement only. Plugin SDK 0.6.202 and host daemon protocol 284 for the host.list_paths rootPaths change. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…in @-mention search Ranking all folders in one pass dropped every file whose relative path also existed in another searched folder, because the fuzzy matcher merged matches by path string. It now merges by item, so README.md from three folders gives three results. A symlinked extra folder made the daemon reject the whole multi-folder search, which hid every extra-folder result and showed "No matching mentions". host.list_paths takes followRootSymlink like host.list_files, and workspace folder search follows it; the files and thread storage routes keep rejecting symlinked roots. The composer now counts the extra-folder request in its loading and error state. Co-Authored-By: Claude Opus 5.5 <[email protected]>
ymichael
force-pushed
the
bb/composer-mentions-across-folders-thr_psx98pzvux
branch
from
November 25, 2026 00:04
2b535a7 to
664c551
Compare
ymichael
added a commit
that referenced
this pull request
Nov 25, 2026
…ess start speed (#8147) ## Human comments ## What was wrong Two tests in `packages/agent-runtime/src/runtime.process-lifecycle.test.ts` fail at random in `Tests (packages-host)` on loaded runners. Both depend on how fast processes start under CPU load. **`drains provider stderr before reporting process exit`** fails with `expected null to be 'stderr-after-exit'`, for example on #8075's merge run ([job](https://github.com/get-bb/bb/actions/runs/45507748534/job/138847431154), 2286 ms). The fake provider spawned a grandchild that inherits stderr, then exited at once. The grandchild had to boot Node and wait 50 ms before writing. After a provider exits, the runtime waits at most `PROVIDER_PROCESS_CLOSE_GRACE_MS` (1 s) for stderr to close. On a loaded runner, Node startup alone can take longer than that. **`does not wait for stalled replacement initialization during full shutdown`** times out at 15 s, followed by an unhandled `Provider "fake" failed to start: spawn .../node ENOENT` ([job](https://github.com/get-bb/bb/actions/runs/45506198560/job/138847994142); it failed on all three attempts of that branch, and took 12.1 s on #8076's passing run). Before reaching its stalled replacement, the test started and retired a full scripted-echo bridge. #8141 measured a full start at 3.7–4.6 s under load, and stopping one can take up to 5 s plus kill and stderr grace periods. On other PRs' loaded runs the test took 3–12 s. When it overran, Vitest timed the test out but its body kept running. `afterEach` removed `tmpDir`, and the replacement then spawned into the missing cwd, which Node reports as `spawn <node> ENOENT`. The ENOENT is a consequence of the timeout, not its cause. #8136 and #8141 fixed the sibling retirement tests the same way; this one was left. ## What changed `runtime.process-lifecycle.test.ts` only. No runtime code changes. - **stderr drain:** the grandchild reports ready over IPC, the provider exits only after that, and the grandchild writes to stderr 50 ms after the IPC channel disconnects, which happens when the provider exits. The write still lands after the exit, but Node startup no longer counts toward the 1 s grace period. - **stalled shutdown:** the first process is the idle child (`process.stdin.resume()`, no post-initialize requests) that the sibling tests use. The adapter it uses is pulled out into a `createIdleAdapter` helper that `createIdleProviderManager` now shares. The replacement still uses the real fake adapter on the raw stalled script, so it receives `initialize` and holds its reply for 3 s, which is the behavior under test. ## How you verified CPU starvation locally: the test runs at background QoS (`taskpolicy -b`) next to 32 busy-loop processes on a 16-core Mac. This reproduces both CI failures. | Test | Before | After | |---|---|---| | stderr drain | 2 CI-assertion failures before I stopped it | 6 of 6 pass | | stalled shutdown | 2 of 4 time out (18.9 s, 21.4 s); passes took 13.1 s and 2.3 s | 4 of 4 pass in 198–358 ms | Both tests still catch the bugs they guard: - stderr drain: with `PROVIDER_PROCESS_CLOSE_GRACE_MS` temporarily set to 0, the new test fails 3 of 3. - stalled shutdown: with `shutdown()` temporarily changed to await in-flight provider starts, the new test fails. `pnpm exec turbo run typecheck lint test --filter=@bb/agent-runtime`: pass (316 tests, 1 skipped). > AGENT GENERATED 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
ymichael
deleted the
bb/composer-mentions-across-folders-thr_psx98pzvux
branch
November 25, 2026 00:58
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Human comments
What was wrong
Since #8007 a thread's agent can read and write the project's folders on its machine and the environment's
additionalPaths, but the composer's @-mention search only looked in the main folder.GET /environments/:id/pathsandGET /projects/:id/pathseach ran onehost.list_pathson the main folder, and results carried a path relative to it. Files in the other folders could not be mentioned, though the agent could open them.What changed
Server.
searchWorkspaceFolderPaths(apps/server/src/services/projects/workspace-path-search.ts) sends onehost.list_pathswith the main folder and every extra folder asrootPaths. The extra folders are the project's folders for the machine plus the environment'sadditionalPaths: the same list the server builds for the agent. Both the turn's runtime config and the path routes get it fromlistEnvironmentExtraFolderPaths, so search and the agent's folders cannot drift.rootPathtofolderPath(nullfor the main folder). Afolders=extrasearch with no extra folders returns empty without calling the host.Daemon.
host.list_pathstakesrootPaths: string[](1–100) instead ofpath, and each entry carries itsrootPath. The daemon lists every root in parallel, skips roots that do not exist, and ranks all candidates in one pass under one limit, so a search is one round trip however many folders the thread has, and scores are comparable across folders.mergeRankedMatchesin@bb/fuzzy-match). Before this,README.mdin three folders returned one result, because matches with the same path string were treated as one.host.list_pathstakesfollowRootSymlink, likehost.list_files. Workspace folder search sets it, so a symlinked extra folder is searched through its target. Without it, the daemon rejected the whole search, and one symlinked folder hid every extra-folder result. The files and thread storage routes keepfalse.rootPathfrom its response (unchanged shape).POST /files/pathspasses the daemon result through, so it now also returnsrootPath.HOST_DAEMON_PROTOCOL_VERSION283 → 284.Contract and SDK.
folderPath:nullfor the main folder, otherwise the absolute folder its relativepathbelongs to (WorkspaceSearchPathEntry).foldersquery,mainorextra. Absent means all folders.sdk.environments.paths/sdk.projects.pathspass it through.CLI.
bb environment pathsprints results from an extra folder as absolute paths.bb project pathsprints JSON, which carriesfolderPath.Composer.
usePathSuggestionssends the main-folder query and a separatefolders=extraquery, and merges them as they arrive. Main-folder results appear as fast as before, and extra-folder results join when ready. The extra-folder query counts toward the menu's loading and error state, so the menu does not say "No matching mentions" while extra-folder results are still loading or after they fail.@/abs/path, which the agent opens directly, and the menu shows the folder as the result's secondary text.ThreadDetailView,RootComposeView), since workspace previews only take relative paths.Not changed.
useFileSearchSuggestions) still searches the main folder and thread storage only (includeExtraFolders: false). Its workspace preview tab cannot open absolute paths./Users/...still gives no completion. It needs a separate directory-browsing completion.Performance
Measured on a real multi-folder project: the main folder is a bb checkout (about 9,000 files), with extra folders
t3code(about 32,500 files) andbb-plugins. Requests used the composer's settings (limit=16, files and directories) against apnpm start:worktreeserver, 12 runs per query after a warm-up. The machine was heavily loaded (load average 232–465), so absolute numbers are noisy; compare columns.The first version sent one combined request. Because the daemon ranks large listings on one serial lane, main-folder results waited for the 32k-file folder, and in that first measurement the warm p50 for common queries went from about 210–330 ms (main folder only) to 1.3–2.6 s. Splitting the request keeps the first results at main-only speed. Extra-folder results add 50–520 ms p50, depending on how many entries the query matches.
The table was measured when the server still sent one
host.list_pathsper folder. Moving the multi-folder search into the daemon leaves the daemon's work about the same, and saves one host round trip for each extra folder beyond the first, which is about 180–250 ms per round trip on a remote host over bb Connect. Daemon-only timing on the samet3code+bb-pluginsextra folders (limit=48, 15 runs, load average about 60):How you verified
Live, same-named files and symlinked folders (
pnpm start:worktree, new-thread composer). The project has a main folder plus extra foldersextra-lib,extra-two, andlinked-three, which is a symlink. Each folder has aREADME.md.@readmelists all three READMEs, one per folder. Before the fix it listed two, and the API returned one for all folders together.@yakfindsyak-notes.mdin the symlinkedlinked-three. Before the fix, adding that folder made@zebra(inextra-lib) show "No matching mentions", and the API returnedinvalid_path ... must not be a symlink.Live (
pnpm start:worktree, real Claude Code thread, Accept Edits), on the multi-folder project above:@turbo.jsonlists the main folder'sturbo.json, thenturbo.json /Users/michael/Projects/bb-pluginsand other files frombb-pluginswith their folder path.bb-pluginsfile inserts aturbo.jsonchip. The sent message is@/Users/michael/Projects/bb-plugins/turbo.json …, and the agent read the file and replied with its first line./Users/michael/Projects/bb-plugins/turbo.jsonin the side panel.bb-pluginsresults too.Tests:
public-environments.test.ts: the environment route sends the main and extra folders in onehost.list_paths, mapsrootPathtofolderPath, honoursfolders=main|extra, and skips the host when there are no extra folders. The project route withhostIdsearches the project's folders.workspace-path-list.test.ts(daemon, real temp folders): roots are ranked together under one limit, each result names its root, and a missing root is skipped.workspace-path-list.test.ts: a file at the same relative path in three roots comes back three times, with and without a query. A symlinked root is searched withfollowRootSymlink: trueand rejected withfalse.fuzzy-matchindex.test.ts: distinct items that share a path are all returned. This test fails without the matcher change.usePathSuggestions.test.ts: results from another folder become absolute paths and keep their folder.environment.test.ts(CLI):bb environment pathsprints an extra-folder result as an absolute path.@bb/server,@bb/app,@bb/sdk,@bb/cli,@bb/server-contract, pluspnpm exec turbo run typecheck lint --filter='...[origin/main]'.🤖 Generated with Claude Code