Repository navigation
Conversation
…r keystroke Every branch-options request sent host.inspect_git_source (git status, ref reads, background fetch) next to host.list_branch_options, so each debounced keystroke cost two host RPCs and a git status, and /branches chained them into two serial round trips. host.list_branch_options now takes remoteRefresh (background | blocking) and includeSource, and returns the source inspection alongside the page when asked. The server asks for it on picker open, on /branches, and on a search with no inspection from the last 30 s for that host path; other searches reuse the remembered inspection. Protocol 282. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Drop includeSource, the source result field and the server's 30 s inspection memory. /branches now sends host.inspect_git_source and host.list_branch_options together, both with remoteRefresh "blocking"; the daemon de-duplicates the in-flight fetch per repo, so both read after the same fetch. Picker reads keep main's parallel pair. host.list_branch_options takes remoteRefresh "background" | "blocking" (the unused "none" is gone), so the protocol stays at 282. Co-Authored-By: Claude Opus 5.5 <[email protected]>
ymichael
deleted the
bb/branch-picker-one-daemon-call-per-keystroke-thr_4muh68dm9r
branch
November 24, 2026 22:20
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
Refreshing branches (
GET /projects/:id/branches, used by the picker's Refresh,bb project branchesandsdk.projects.branches) chained its two host RPCs: the server senthost.inspect_git_sourcewith a blocking remote fetch, waited for the reply, and only then senthost.list_branch_optionsso the list would include fetched branches. On a remote host that is two serial round trips. This is finding #5 of the server→daemon RPC audit.What changed
HOST_DAEMON_PROTOCOL_VERSION281 → 282.host.list_branch_optionstakesremoteRefresh: "background" | "blocking", the same values ashost.inspect_git_source. The server only ever sent"none", which is gone. A 281 daemon rejects"blocking", so the bump is required.apps/server/src/routes/projects.ts): both branch routes send the two RPCs together with the sameremoteRefresh./branchesis now one round trip.bb-environment-provider-hostlistBranchOptions):"blocking"awaitsrefreshRemoteBranchesbefore reading refs. That function keeps one in-flight fetch per repo, so the two blocking RPCs share a singlegit fetchand both read after it. The git plugin's local"none"call is unchanged.Removing
git statusfrom every keystroke, which an earlier revision did with a server-side inspection cache, is left out. It needs either that cache, whose search responses carry state up to 30 s stale, or a change to the response shape.How you verified
Live A/B on the host-RPC latency rig. A second daemon reached through a proxy adding 100 ms each way (~200 ms RTT). The proxy decodes WebSocket frames to log every
host-rpc.request, and the remote daemon logs every git spawn. The project is a clone of this repo (9,101 files, 1,730 remote branches); 10 rounds each of open, four keystrokes and/branches./branches, remote (n=10)git fetchper refreshselectedBranch, and/brancheswith and without a query. Also identical for a repo mid-merge with conflicts plus a dirty tree, and for a non-git folder.Tests:
host-branches-dispatch.test.ts: a blockinghost.list_branch_optionssent while a background fetch is held open waits for it and lists the fetched branch. It fails if"blocking"behaves like"background".public-project-workspace-routing.test.ts:/brancheshas both blocking RPCs in flight before either replies.turbo run typecheck lintpasses for@bb/server,@bb/host-daemon,@bb/host-daemon-contract,bb-environment-provider-hostandbb-plugin-bb--git.🤖 Generated with Claude Code