Skip to content

Make branch source refresh explicit - #2616

Merged
ymichael merged 4 commits into
mainfrom
bb/explain-branch-selector-behavior-thr_93h7uc2akd
Aug 28, 2026
Merged

ymichael merged 4 commits into
mainfrom
bb/explain-branch-selector-behavior-thr_93h7uc2akd

Conversation

@ymichael

@ymichael ymichael commented Aug 28, 2026 •

Copy link
Copy Markdown
Collaborator

Human comments

What was wrong

The new-thread branch selector used one host.list_branches request for three different jobs: inspecting the checkout, refreshing remote refs, and paginating branch choices. That made an initial/default selection wait on network work it did not need. Remote freshness needed to be explicit, and the branch displayed by the selector needed to remain the exact branch submitted for creation rather than being reinterpreted later.

What changed

  • Split the host RPC into host.inspect_git_source for checkout/default/dirty metadata and host.list_branch_options for branch pagination.
  • Compose cached inspection and branch options concurrently on initial load while a throttled fetch runs in the background.
  • Make picker-open request an explicit blocking refresh when the user asks for authoritative choices.
  • Submit the selector's resolved main or origin/main value as a named branch and trust named branches during creation.
  • Keep creation off the network: unresolved defaults inspect cached refs while refreshing remotes in the background.
  • Route explicit picker refreshes through the owning TanStack query, including initial-fetch coalescing and retries, so isFetching, cancellation, and cache ownership remain correct.
  • Add bb project branches --refresh; expose it through live CLI help and document it in the project guide.
  • Bump HOST_DAEMON_PROTOCOL_VERSION from current main's 173 to 174 for the changed host command contract.
  • Add coverage for cached/background reads, blocking refreshes, retry/coalescing races, branch ordering/filtering, bare and non-Git sources, multiple remotes, creation policy, CLI output, and wire contracts.

How you verified

  • Focused app branch-query and cache-owner suites — 8 tests passed.
  • Focused host-daemon branch dispatch suite — 17 tests passed.
  • Focused server suites for project workspace routing, named/default branch creation, and public environments — 24 tests passed.
  • Updated named/default creation-policy suites — 16 tests passed.
  • Full app suite — 3,505 tests passed, 4 skipped.
  • Focused host-daemon and server contract suites — 37 and 35 tests passed.
  • Focused CLI project suite — 24 tests passed.
  • Plugin SDK, domain, and Plugin API Map test/typecheck matrix — 465 tests passed across 62 files.
  • Plugin Guide production build passed.
  • Turbo typechecks passed for @bb/app, @bb/cli, @bb/domain, @bb/host-daemon, @bb/host-daemon-contract, @bb/server, and @bb/server-contract.
  • Targeted formatting checks and git diff --check passed.

Fixes: N/A — no issue was filed for this thread.

AGENT GENERATED

@ymichael

Copy link
Copy Markdown
Collaborator Author

@slopcop

@ymichael
ymichael force-pushed the bb/explain-branch-selector-behavior-thr_93h7uc2akd branch from b2f2a0e to 149a031 Compare August 28, 2026 03:22
@ymichael
ymichael force-pushed the bb/explain-branch-selector-behavior-thr_93h7uc2akd branch from 149a031 to 9481f33 Compare August 28, 2026 18:19
@ymichael
ymichael merged commit 7cdd77b into main Aug 28, 2026
24 of 25 checks passed
@ymichael
ymichael deleted the bb/explain-branch-selector-behavior-thr_93h7uc2akd branch August 28, 2026 21:16
SawyerHood pushed a commit that referenced this pull request Aug 28, 2026
## What was wrong

PR #2616 removed the `host.list_branches` command from the host daemon
contract and its dispatch table, but one call to it stayed behind in
`host-branches-dispatch.test.ts`. `main` is red: `tsc` reports TS2820 for the
unknown command type, and the test itself throws
`onlineRpcHandlers[command.type] is not a function`.

## What changed

- `apps/host-daemon/test/command/host-branches-dispatch.test.ts` dispatches
  `host.inspect_git_source` with `remoteRefresh: "blocking"`, like the other
  tests in the same describe block. A blocking refresh keeps the promise
  pending until the fetch ends, which is what this test waits for.

## How you verified

- `pnpm exec turbo run typecheck test --filter=@bb/host-daemon` passes, 45
  test files. The repaired test runs instead of throwing.

> AGENT GENERATED

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
ymichael pushed a commit that referenced this pull request Aug 28, 2026
## What was wrong

PR #2616 removed the `host.list_branches` command from the host daemon
contract and its dispatch table, but one call to it stayed behind in
`host-branches-dispatch.test.ts`. `main` is red: `tsc` reports TS2820 for the
unknown command type, and the test itself throws
`onlineRpcHandlers[command.type] is not a function`.

## What changed

- `apps/host-daemon/test/command/host-branches-dispatch.test.ts` dispatches
  `host.inspect_git_source` with `remoteRefresh: "blocking"`, like the other
  tests in the same describe block. A blocking refresh keeps the promise
  pending until the fetch ends, which is what this test waits for.

## How you verified

- `pnpm exec turbo run typecheck test --filter=@bb/host-daemon` passes, 45
  test files. The repaired test runs instead of throwing.

> AGENT GENERATED

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
SawyerHood added a commit that referenced this pull request Aug 28, 2026
## Human comments

## What was wrong

#2616 split the host RPC `host.list_branches` into
`host.inspect_git_source` (checkout metadata, `remoteRefresh:
"background" | "blocking"`) and `host.list_branch_options` (branch
pagination). One call in
`apps/host-daemon/test/command/host-branches-dispatch.test.ts` kept the
removed name.

CI is red on `main` and on every open PR:

- `Checks (ubuntu-latest, Node 22.x)` —
`test/command/host-branches-dispatch.test.ts(392,11): error TS2820: Type
'"host.list_branches"' is not assignable`.
- `Tests (packages, ubuntu-latest, Node 22.x)` —
`host.inspect_git_source dispatch > serializes branch refresh and
provisioning fetches for one repository` fails with `File did not appear
within 2000ms: .../refresh-started`. The removed command never triggers
the delayed upload-pack, so the marker never appears.

## What changed

`apps/host-daemon/test/command/host-branches-dispatch.test.ts` — one
call site.

The test asserts that a blocking remote refresh holds the repository
lock while a worktree provisions, so the provisioning fetch waits.
Blocking refresh moved to `host.inspect_git_source`, and the test
already sits inside that command's `describe` block. The call now uses
`{ type: "host.inspect_git_source", path: repoPath, remoteRefresh:
"blocking" }`, and the promise is renamed `branchListing` ->
`sourceInspection` to match.

No source, contract, wire, CLI, or doc changes.
`HOST_DAEMON_PROTOCOL_VERSION` is untouched, because the command
contract does not change here.

## How you verified

- `pnpm exec turbo run typecheck --filter=@bb/host-daemon` — passes. It
fails on `main` with TS2820.
- `pnpm exec turbo run test --filter=@bb/host-daemon --
host-branches-dispatch` — 18 tests pass, including the serialization
test that fails on `main`.

> AGENT GENERATED

Co-authored-by: Sawyer Hood <[email protected]>
Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
ymichael added a commit that referenced this pull request Aug 31, 2026
…omments

Land the dispatch-queue rework on main's newer trunk:

- HOST_DAEMON_PROTOCOL_VERSION resolves to 176 (main's 175 + 1) with the
  branch narration reduced to the one thing a daemon observes: the three
  branch-only `system/*` event types leaving `threadEventSchema`. Main
  deleted the historical narration block, so the file keeps main's shape.
- @get-bb/plugin-sdk bumped 0.4.30 -> 0.4.31 via scripts/bump-plugin-sdk.mjs
  (main had moved past the branch's stale 0.4.33 lineage); bundled types,
  sdk-public-api.json and the plugin registry snapshots regenerated.
- thread-create uses main's resolveManagedBaseBranchForCreate shape;
  #2616 removed resolveManagedNamedBaseBranchSpec and the originKind arm.
- Composer queue UI adopts main's "follow-up" wording (#2695) while keeping
  the branch's queue rows, wait lines and visuals.
- The bb-cli and bb-plugin-authoring skills were restructured on main into
  references/; the branch's CLI surface (`--send-at`, queued delivery,
  `bb thread count`, `bb thread retry`) and plugin surface
  (`bb.experimental_hooks`, `message.queued`/`message.dispatched`/
  `turn.failed`, the new SDK type exports) are documented there instead.
- apps/app comments removed to satisfy main's `bb/no-comments` rule (#2624).

Co-Authored-By: Claude Fable 5 <[email protected]>
ymichael added a commit that referenced this pull request Aug 31, 2026
…omments

Land the dispatch-queue rework on main's newer trunk:

- HOST_DAEMON_PROTOCOL_VERSION resolves to 176 (main's 175 + 1) with the
  branch narration reduced to the one thing a daemon observes: the three
  branch-only `system/*` event types leaving `threadEventSchema`. Main
  deleted the historical narration block, so the file keeps main's shape.
- @get-bb/plugin-sdk bumped 0.4.30 -> 0.4.31 via scripts/bump-plugin-sdk.mjs
  (main had moved past the branch's stale 0.4.33 lineage); bundled types,
  sdk-public-api.json and the plugin registry snapshots regenerated.
- thread-create uses main's resolveManagedBaseBranchForCreate shape;
  #2616 removed resolveManagedNamedBaseBranchSpec and the originKind arm.
- Composer queue UI adopts main's "follow-up" wording (#2695) while keeping
  the branch's queue rows, wait lines and visuals.
- The bb-cli and bb-plugin-authoring skills were restructured on main into
  references/; the branch's CLI surface (`--send-at`, queued delivery,
  `bb thread count`, `bb thread retry`) and plugin surface
  (`bb.experimental_hooks`, `message.queued`/`message.dispatched`/
  `turn.failed`, the new SDK type exports) are documented there instead.
- apps/app comments removed to satisfy main's `bb/no-comments` rule (#2624).

Co-Authored-By: Claude Fable 5 <[email protected]>
ymichael added a commit that referenced this pull request Sep 1, 2026
…omments

Land the dispatch-queue rework on main's newer trunk:

- HOST_DAEMON_PROTOCOL_VERSION resolves to 176 (main's 175 + 1) with the
  branch narration reduced to the one thing a daemon observes: the three
  branch-only `system/*` event types leaving `threadEventSchema`. Main
  deleted the historical narration block, so the file keeps main's shape.
- @get-bb/plugin-sdk bumped 0.4.30 -> 0.4.31 via scripts/bump-plugin-sdk.mjs
  (main had moved past the branch's stale 0.4.33 lineage); bundled types,
  sdk-public-api.json and the plugin registry snapshots regenerated.
- thread-create uses main's resolveManagedBaseBranchForCreate shape;
  #2616 removed resolveManagedNamedBaseBranchSpec and the originKind arm.
- Composer queue UI adopts main's "follow-up" wording (#2695) while keeping
  the branch's queue rows, wait lines and visuals.
- The bb-cli and bb-plugin-authoring skills were restructured on main into
  references/; the branch's CLI surface (`--send-at`, queued delivery,
  `bb thread count`, `bb thread retry`) and plugin surface
  (`bb.experimental_hooks`, `message.queued`/`message.dispatched`/
  `turn.failed`, the new SDK type exports) are documented there instead.
- apps/app comments removed to satisfy main's `bb/no-comments` rule (#2624).

Co-Authored-By: Claude Fable 5 <[email protected]>
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