Skip to content

Convert large text pastes into ordinary attachments (Codex Desktop behavior) - #3

Open
aotd1 wants to merge 126 commits into
upstream-mainfrom
pasted-text-attachments-upstream
Open

aotd1 wants to merge 126 commits into
upstream-mainfrom
pasted-text-attachments-upstream

Conversation

@aotd1

@aotd1 aotd1 commented Oct 5, 2026 •

Copy link
Copy Markdown
Owner

Human comments

What was wrong

Large clipboard text remained inline in the shared composer. Users had to save it as a file and attach it manually to keep their request and history compact. get-bb/bb#4910 proposes automatic conversion, following Codex Desktop's large-text Paste behavior.

What changed

  • A plain-text paste of 5,000 Unicode code points or more becomes a UTF-8 Pasted text.txt attachment. Preserve exact clipboard text, the existing request, selection, and focus. File/image pastes retain priority; typing and programmatic updates do not trigger conversion.
  • Reuse ordinary project attachment upload, storage, delivery, and persisted drafts. Add bounded previews, unique names, preparation/error states, retry, and explicit insertion-as-text recovery. Unfinished attachments block submission.
  • Integrate creation/removal with editor Undo/Redo. Share in-flight results across composer lifecycles, retain failed-upload recovery while another active manager needs it, and allow removal of attachments introduced by another editor. Redo reuses prepared files.
  • Preserve attachment display names and sizes in history, message editing, and Codex/Pi file descriptions. Existing daemon staging and provider adapters deliver ordinary files; this feature introduces no daemon wire change. CLI --file and SDK upload equivalents are documented.
  • Merge upstream main through 68a1e8b7aa84fbd836eb8825e4d042ae0c52e74a (2026-10-07, 150 upstream commits). Resolve draft/history conflicts while retaining attachment ownership, optional sizes, upstream thread-link Paste, and the simplified composer. Pasted-file content links now follow the source project when the composer moves between projects.

The threshold is a proposal: the inspected Codex build used 5,000 UTF-16 units; this prototype uses Unicode code points. This is observed behavior, not a published contract. The current plugin SDK has no shared Paste/Undo attachment hook, so the implementation is in the shared composer.

Upstream status: Sawyer approved opening the PR in Discord on 2026-10-07. The upstream review is now get-bb/bb#5098, targeting main and linked to get-bb/bb#4910. This fork PR remains the prototype/review history; its upstream-main base mirrors 68a1e8b7aa84fbd836eb8825e4d042ae0c52e74a.

Implementation and validation report.

BB prototype screenshot from the original manual verification (not a Codex Desktop screenshot):

BB editor: synthetic large paste as an attachment beside a short request

How you verified

Checks rerun through Turbo on the merged tree: 1,034 tests passed.

  • Composer, pasted-text recovery, thread-link Paste, uploads, drafts, and history: 334 passed.
  • Client-core drafts: 21 passed; thread-view: 91 passed; daemon dispatch/staging: 33 passed.
  • Codex provider: 350 passed; Pi: 204 passed, one existing skipped test.
  • Focused ACP pasted-text resource-link contract: 1 passed, 128 tests filtered out. This is not live OpenCode compatibility evidence.
  • Selected app/client-core/server-contract/thread-view/Codex/Pi/ACP typecheck and lint: 15 Turbo tasks passed, with existing lint warnings. The feature diff against the new upstream base passes git diff --check.

Regression coverage includes the six lifecycle cases added after review, source-project preservation through draft storage and submission, and preview links after moving the composer to a different project.

pnpm exec turbo run test --filter=@bb/app -- PromptBoxInternal AttachmentPreview ConversationAttachments ConversationMessageContent ThreadTimelineRows.actions usePromptDraftStorage useComposerAttachmentUploads pasted-text prompt-thread-link-paste pasted-thread-links
pnpm exec turbo run test --filter=@bb/client-core --filter=@bb/thread-view --filter=@bb/host-daemon -- prompt-draft user-message-parsing build-thread-timeline thread-dispatch
pnpm exec turbo run test --filter=bb-plugin-provider-codex --filter=bb-plugin-provider-pi
pnpm exec turbo run test --filter=@bb/provider-bridge-acp -- bridge.test -t 'pasted text file'
pnpm exec turbo run typecheck lint --filter=@bb/app --filter=@bb/client-core --filter=@bb/server-contract --filter=@bb/thread-view --filter=bb-plugin-provider-codex --filter=bb-plugin-provider-pi --filter=@bb/provider-bridge-acp

Earlier manual verification used synthetic 3,638,577-byte / 75,151-line text: exact download, draft/history reload, and a local Codex file read. Actual staging and Codex adaptation also ran inside an isolated Linux container without a mounted attachment directory. Those manual scenarios and the screenshot were not repeated on this update. A full turn on another enrolled host/container, native mobile clipboard events, and live non-Codex providers remain unverified. No user HAR or private clipboard data is included.

AGENT GENERATED

@aotd1
aotd1 marked this pull request as ready for review October 7, 2026 10:34
bb-slop-cop Bot and others added 3 commits October 7, 2026 08:59
🚨 **SLOP COP** 🚨 · `new-issue-autopilot`

## Human comments

## What was wrong

Provider session restoration omitted the runtime's existing construction
deadline when sending its JSON-RPC request. It therefore used the
transport's 30-second fallback instead of the two-minute construction
default and ignored configured construction limits. Reproduced on
trusted `origin/main` in two separate clean checkouts: [verified
report](https://get-bb.github.io/reports/issues/5080.html).

## What changed

Forward the existing construction timeout on the resume request,
matching start and fork. Extend the existing lifecycle regression with
default-deadline and short-configured-deadline restoration cases. No
provider, public protocol, schema, daemon wire contract, dependency,
generated file, migration, stored data, CLI surface, or packaging
change.

## How you verified

- Added the regression before changing production. Both clean baseline
runs failed the two restoration cases for the intended deadline
mismatch; the start-session control passed.
- After the one-line repair, all three focused cases pass: `pnpm exec
turbo run test --filter=@bb/agent-runtime --
src/runtime.lifecycle.test.ts -t 'uses the construction deadline'`.
- `pnpm exec turbo run test lint typecheck --filter=@bb/agent-runtime`
passes: 309 tests across 23 files, plus lint and typecheck.
- Both trusted base checkouts completed `pnpm install --frozen-lockfile
--prefer-offline` and `pnpm exec turbo run build` successfully.
- Formatting and `git diff --check` pass; no binary changes.
Changed-line count from `git diff --numstat origin/main`: **127 total**
across **two files** (one production addition; 82 test additions and 44
test deletions).
- No private session or live pi account was accessed. The behavioral
test loads the repository's actual bridge worker and scripted provider,
with a delayed child response and simulated runtime time.

Fixes get-bb#5080

> AGENT GENERATED

<!-- slopcop:rule=new-issue-autopilot run=run_fd2me3n1muxn8gki
sha=issue-5080 kind=summary -->

Co-authored-by: SawyerHood <[email protected]>
## Human comments

## What was wrong

On reload, the sidebar's provider icons could take ~20 s to appear. A
HAR from `ymichael.getbb.app` showed `GET /api/v1/system/providers?`
spending 20,005 ms in Chrome's **Stalled** phase before it was sent,
then 270 ms waiting on the server. It was the only stalled request out
of 270 on the same HTTP/3 connection, and the server log shows no slow
`/system/providers` requests. The wait is Chrome's HTTP cache lock: only
one in-flight request per URL may write the cache entry, and a second
request for the same URL waits for it, up to a 20 s timeout. App API
GETs used the default cache mode and the JSON responses have no
`Cache-Control`, so a stuck `/system/providers` request elsewhere in the
browser profile (most likely another bb tab or the page being reloaded)
held the lock. `useProviders()` returns an empty list until that request
completes, so thread rows rendered without icons.

## What changed

- `apps/app/src/lib/app-surface.ts`: `appSurfaceRequestInit` defaults to
`cache: "no-store"` unless the caller passes a cache mode. It is shared
by the app SDK client, the plugin SDK client, the Hono API client and
file previews, so these requests skip the HTTP cache and its lock. React
Query, plus the localStorage copy for providers, already caches the
JSON, so Chrome's HTTP cache added nothing for these requests.
- `apps/app/src/lib/api.ts`: the full-body file preview fetch passes
`cache: "default"`. File content routes answer with `private, no-cache`
plus an ETag, and this keeps the browser revalidating unchanged files
with a 304. That fetch can still hit the lock, as before. The partial
first fetch in file previews was already `no-store`.
- Logos, plugin bundles and static assets don't use this helper and keep
their long-lived browser caching. No wire, CLI or daemon changes.

## How you verified

- Reproduced the mechanism in headless Chrome against a stub server. Tab
A sent `GET /api/v1/system/providers?` and got no response; the same
request from tab B stalled **20,008 ms**, and the stub received it only
after the timeout. With `cache: "no-store"` on tab B's fetch, the
request took **1 ms**.
- Added a test to `app-surface.test.ts`: the default is `no-store` and a
caller's own cache mode is kept.
- `pnpm exec turbo run typecheck lint test --filter=@bb/app`: passes
(lint 0 errors; 587 test files passed, 2 skipped).
- Not yet re-checked on a real reload through `ymichael.getbb.app` with
the fix deployed.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

> AGENT GENERATED

---------

Co-authored-by: qa <qa@x>
Co-authored-by: Claude Opus 5.5 <[email protected]>
…Pad (get-bb#5097)

## Human comments

## What was wrong

Controls that appear on hover (message copy/side-chat/edit/actions,
disclosure chevrons, tab close buttons, notification and info-panel row
actions, sidebar row and header controls, and some plugin row actions)
are `opacity-0` until `group-hover`. Tailwind only applies `group-hover`
under `@media (hover: hover)`. The touch fallback that forces them
visible was `max-md:pointer-coarse:`, i.e. touch **and** narrower than
768px. A 13" iPad reports `hover: none` / `pointer: coarse` but is
1032px wide in portrait, so neither rule applied and the controls stayed
invisible. The tooltip library still opened tooltips for a trackpad or
Pencil pointer, which matches the Discord report ("Copy bug on 13"
iPad": a "Copy message" tooltip shown over empty space). The iPad mini
(744px) got the compact layout and was fine. The sidebar's CSS
hover-actions block had the same width-gated media query (see get-bb#3832).

## What changed

- One rule for every hover-revealed control: visible under `@media
(hover: none)`, the exact complement of the `(hover: hover)` gate on
`group-hover`. Screen width no longer decides visibility. Touch-target
sizing stays width-based.
- The shared helper `coarse-pointer-visibility`
(`COARSE_POINTER_HOVER_REVEAL_VISIBLE_CLASS`) is renamed to
`hover-reveal` (`HOVER_REVEAL_NO_HOVER_VISIBLE_CLASS`) with the value
`[@media(hover:none)]:opacity-100`, and the plugin registry is
regenerated. Existing plugin forks keep their vendored copy; only a fork
that re-pulls `coarse-pointer-visibility` by name from a newer release
would need the new name.
- Applied in `MessageActionBar`, `disclosure`, `tab-pill`,
`copy-button`, `SkillDetailView`, `NotificationCenter`, `info-list`,
`resource/row`, Automations runs, Tasks labels and presets, the Prompt
Library star, and the thread-list/navigation sidebar rows. `theme.css`'s
sidebar hover-actions block moves from `(max-width: 767px) and (pointer:
coarse)` to `(hover: none)`.
- On a wide touch screen the sidebar now follows the phone design:
section/project `+`, `…` and chevrons always visible, thread quick
actions left to the long-press menu.
- Two sidebar layout rules paired with those controls also move off the
width check: rows that permanently reserve action space (project label,
or parent with children) drop that reserve under `(hover: none)`, and a
collapsed environment group's status glyph moves into the hidden
actions' slot (`ThreadRow.tsx`, `ProjectRow.tsx`).
- An iPad with a trackpad still reports touch as its primary input, so
controls there are always visible rather than hover-revealed.
- No SDK, CLI or wire changes.

## How you verified

- Reproduced in the iOS Simulator against a `pnpm start:worktree` build:
the 13" iPad Pro (portrait, 1032px, `hover: none`) showed no message
actions and no sidebar controls; the iPad mini showed them.
- After the fix: the 13" iPad shows actions under both messages plus the
sidebar controls; the iPad mini and iPhone 17 are unchanged.
- Desktop Chrome (1376px): copy buttons opacity 0/0 at rest, 0/1 when
hovering the agent message; 1/1 with CDP touch emulation. Playwright
WebKit (Safari 26.6 engine): same numbers. Desktop Safari itself not
driven (WebDriver needs a Safari setting).
- get-bb#3832 tap case, desktop Chrome at 1280px with CDP touch emulation
(`hover: none`), tapping a long-titled sidebar row with
`Input.dispatchTouchEvent`:
- Base (`68a1e8b7aa`): after the tap the row stays `:hover`,
Archive/Thread actions go to opacity 1 and clickable, the title gains
30px padding and shrinks 237px → 207px. A parent row with children keeps
a permanent 30px gap.
- This PR: after the tap the row is still `:hover` but the actions stay
hidden, padding stays 0, the title stays 237px. The parent row's gap is
0.
- Same build with a mouse (no emulation): Archive hidden at rest, shown
on hover with the 30px inset, parent keeps its reserved space, all as
before.
- Not verified: landscape rotation and tapping in the iOS simulator (no
accessibility permission for scripted input), an iPad with a trackpad,
and a collapsed environment group (no worktree-environment fixture).
- `pnpm exec turbo run typecheck lint test --continue
--filter='...[origin/main]'`: 105/105 tasks passed on the first commit;
thread-list typecheck/lint/test (464 tests) passed after the second.
Three existing assertions were updated for the new class; no new tests,
since the bug is a CSS media condition a class-string test wouldn't
catch.

Fixes get-bb#3832

🤖 Generated with [Claude Code](https://claude.com/claude-code)

> AGENT GENERATED

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
Co-authored-by: qa <qa@x>
ymichael and others added 17 commits October 7, 2026 10:55
## Human comments

## What was wrong

Cron humanizer post-processing replaced "and" with a comma, then stripped commas after AM/PM. This removed connectors from hour ranges and separate times in the Automations list and detail page.

## What changed

Format time ranges as `9AM-5:59PM` before conjunction cleanup and preserve commas between separate times, such as `9AM, 5PM Mon, Wed, Fri`. Add formatter cases for ranges, multiple times, and other schedules.

## How you verified

- Four hour-range cases and two separate-time cases failed before their respective fixes and passed afterward.
- All 20 formatter tests passed: `pnpm exec turbo run test --filter=bb-plugin-automations -- src/format-schedule.test.ts`.
- `pnpm exec turbo run typecheck lint --filter=bb-plugin-automations` passed; lint reported five existing warnings and no errors.
- Reviewed before/after Chromium screenshots of the actual list row and detail components in Ladle at 390px and 1280px widths. The temporary range fixture was restored after capture.
- `git diff --check` passed.

> AGENT GENERATED
## Human comments

## What was wrong

ResourceMeta attached separators to items that wrapped onto new lines on
phones. Nested inline content could overflow its truncation wrapper,
hard-clipping long automation schedules instead of displaying an
ellipsis.

## What changed

Stack shared resource metadata and hide separators below the
small-screen
breakpoint. Bound items and nested content to the available width so
text
truncates with an ellipsis. Retain inline metadata and separators on
desktop.
Regenerate the plugin registry resource-atoms item; resource-list
already
references that item. Keep Automations using ResourceMeta and add a
responsive
Ladle story covering long schedules and lifecycle states.

## How you verified

- Reproduced through read-only inspection of the primary server; no
automations
  were changed.
- Retook and reviewed before/after source Ladle screenshots at 390px and
1280px.
- Verified 320px, 390px, 640px, and 1280px in Chromium: no horizontal
overflow,
no phone separators, desktop separators retained, and a schedule
ellipsis
at 320px. Inspected active, paused, completed, running, and failed rows.
- pnpm exec turbo run typecheck lint --filter=@bb/shared-ui
--filter=@bb/plugin-registry --filter=bb-plugin-automations
--filter=@bb/app
passed. App lint reported 250 warnings and plugin lint five, with no
errors.
- shared-ui has no lint script; direct oxlint on the touched source
passed.
- pnpm exec turbo run test --filter=@bb/plugin-registry passed (one
test),
  including generated registry consistency checks.
- Formatting and git diff --check passed. iOS Safari was not tested.

> AGENT GENERATED
…tunnel backpressure (get-bb#5096)

The gate now handles its /api/connect/* endpoints only on server and machine
hosts; on <label>--<port> share hosts they are forwarded to the shared app.

The gate sends the resolved server or machine id with each forwarded request,
and the tunnel object answers offline when the connected tunnel was dialed by
a different one.

/api/connect/redeem accepts server-pair codes only.

The tunnel client pauses reading an origin response while more than 1 MiB is
buffered on the tunnel socket; the host daemon's ws typings declare the
send-buffer size it reads.

Co-Authored-By: Claude Code <[email protected]>
## Human comments

## What was wrong

Option number shortcuts focus the pending question form so Enter can
advance or submit. The container inherited the global 2px outline with
no padding, placing the outline against the question text and Submit
button on desktop and phones.

## What changed

Give the shared question form a rounded 1px inset focus-visible ring
using bb's existing ring token. Add 4px padding with matching negative
margins to separate the ring from content while preserving content
layout. Regenerate the plugin registry entry from that component so
vendored plugin forms receive the same style. Keyboard selection, Tab
navigation, and Enter behavior remain intact.

## How you verified

- Reviewed before/after screenshots of the existing pending-question
Ladle story at 390×640 and 1280×600 with real number-key input.
Temporary story setup was restored before committing.
- Confirmed visible keyboard focus, the padded inset ring, no horizontal
overflow, option switching, Tab focus, and Enter's selected-answer
request, intercepted locally without submitting to a server.
- `pnpm exec turbo run typecheck lint --filter=@bb/shared-ui
--filter=@bb/app` passed; app lint reported existing warnings and no
errors.
- `pnpm exec turbo run lint --filter=@bb/shared-ui` and `pnpm exec turbo
run lint --filter=@bb/shared-ui --filter=@bb/thread-view` exited 0.
These packages have no lint scripts, so those two commands executed zero
tasks. Direct Oxlint on the touched file exited 0 with an existing
warning.
- `pnpm exec turbo run typecheck lint test --filter=@bb/plugin-registry
--filter=@bb/shared-ui` passed, including registry freshness and the
all-items plugin build test. These packages have no lint scripts.
- `git diff --check` passed. Browser verification used Chromium; iOS
Safari was not tested.

> AGENT GENERATED

---------

Co-authored-by: qa <qa@x>
## Human comments

## What was wrong

Claude Code emits a command start before asking for permission. The timeline kept that timestamp after the user approved, so an instant command could show minutes spent waiting for Allow once as execution time.

## What changed

Use successful command approval resolution as the execution start, clear the waiting state, and carry the updated timestamp through running and completed rows. Preserve the original row and sequence when another tool appears during approval. Completed executions that reuse a call ID remain separate.

Add a regression for Allow once and session approval, including an interleaved command and the displayed duration label. Update the server API test to expect the waiting state to clear after successful approval. No wire or public API changes.

## How you verified

- The regression failed before the fix with the pre-approval start time and waiting state.
- `pnpm exec turbo run test typecheck lint --filter=@bb/thread-view`: 450 tests and typecheck passed. The package has no lint task.
- `pnpm exec turbo run typecheck lint --filter=@bb/thread-view --filter=@bb/app`: passed; app lint reports existing warnings and no errors.
- Direct Oxlint passes for all changed files. A full thread-view scan reports four pre-existing comment-rule violations in `user-message-parsing.ts`, confirmed against HEAD.
- Reviewed before/after screenshots of real timeline projection and components in a temporary Ladle story at 1280×800 and 390×844. The inflated 2m 24s label disappears for a 100ms execution. Screenshots and the fixture are saved in thread storage. iOS Safari was not tested.
- `pnpm exec turbo run test --filter=@bb/server -- test/public/public-thread-interactions.test.ts`: all 25 tests passed. Server typecheck passed through Turbo, and direct Oxlint passed for the changed test file.
- `git diff --check`: passed.

> AGENT GENERATED
## Human comments

## What was wrong

Update step captions used `text-xs`, making “Checking origin/main”, “Ready to restart”, and “Restarting” larger than the source checkout and version labels in Settings > Updates.

The CI npm version guard also built SDK runtime files without declarations. On fresh checkouts it packed no declarations and falsely reported drift from the published package.

## What changed

Use `text-2xs` for the shared row state caption to match the row metadata. This is a one-line styling change in `UpdatesSettingsSection.tsx`. Add the missing `build:types` task to the SDK npm guard before packing, fixing the CI failure without changing the SDK version or API.

## How you verified

- Reviewed before/after screenshots of the Ladle `settings/Updates > Row variations` story at 390px and 1280px widths, covering all three source checkout update steps. Phone captures stack the story description above the component without changing component styles.
- Confirmed the captions changed from 12px to 10px, matching row metadata.
- `pnpm exec turbo run typecheck lint --filter=@bb/app` passed; lint reported 250 warnings and no errors.
- The SDK npm guard passed after removing the local generated declaration directory, confirming it rebuilds declarations before comparing the package with npm.
- `pnpm exec turbo run typecheck lint --filter=@get-bb/plugin-sdk` passed.
- `git diff --check` passed.

> AGENT GENERATED
## Human comments

## What was wrong

At phone widths, the editor split button and Commit action stayed in the
thread header, squeezing the title. Responsive action overflow only applied
to narrow split panes.

The SDK npm guard also packed missing declarations in filtered CI builds: its
Turbo command built runtime files without explicitly generating bundled types.

## What changed

Use the existing overflow menu for workspace and Git actions at compact
viewport widths (up to 767px), preserving visible buttons on desktop and
existing narrow split pane behavior. Phone users gain title space at the
cost of one extra tap to reach these actions.

Make the SDK guard explicitly run build:types alongside build so filtered CI
compares a complete package against npm. No SDK API or published content changes.

## How you verified

- Captured and reviewed before/after real header components in a temporary
  Ladle story at 390px with touch sizing and 1280px desktop width.
- Confirmed the fixture title fits in full on phones and desktop rendering
  is unchanged. Clicked both overflow actions and confirmed their callbacks.
- Saved screenshots and the verification fixture in thread storage.
- pnpm exec turbo run typecheck lint --filter=@bb/app passed; lint reported
  250 existing warnings and no errors.
- SDK typecheck passed through Turbo. The npm version guard reproduced the
  missing-declaration failure before the fix and passed afterward, confirming
  the packed files and manifest match published SDK 0.6.26.
- git diff --check passed. Native iOS Safari was not tested.

> AGENT GENERATED
## What was wrong

MarketplacesSettingsSection rendered its Official Badge, a div, inside a
paragraph. Opening Plugin marketplaces logged React invalid-nesting and
hydration errors.

## What changed

Replace the marketplace title paragraph with a div, preserving all classes
and children so its flex layout and appearance stay unchanged.

## How you verified

- Captured and reviewed before/after Settings Ladle screenshots at 390x844
  and 1280x900 with temporary official and community marketplace fixtures.
- Confirmed two React console errors before and zero errors after at both
  widths, with no remaining p/div nesting.
- Marketplace element rectangles match exactly at both widths; desktop
  screenshots are byte-identical and phone layout is visually unchanged.
- Restored temporary fixtures; only the title container tags are changed.
- pnpm exec turbo run typecheck lint --filter=@bb/app passed. Lint reported
  250 existing warnings and zero errors.
- git diff --check passed.

> AGENT GENERATED
## Human comments

## What was wrong

The example and capability card grids used viewport breakpoints. A narrow
content area on a desktop viewport still received three columns, truncating
titles and wrapping descriptions into one or two words per line.

## What changed

Size both grids from their available width with the existing plugin catalog
card grid pattern. Cards have an 18rem minimum capped at the available width,
so narrow areas use one column and the full desktop story keeps three.

## How you verified

- Located the cards in Plugins > Browse > New plugin and inspected the primary
  server read-only at 390px. That layout already used one column.
- Reproduced three 112px columns in the 352px Ladle Narrow story at a 1440px
  viewport before changing code.
- Captured and reviewed before/after Ladle screenshots at 390px and 1440px,
  plus the full desktop Grid story.
- Verified the fixed Narrow story at 320px, 390px, 640px, and 1440px: one
  column, no truncated titles, and no horizontal overflow. The full desktop
  Grid story retains three columns.
- pnpm exec turbo run typecheck lint --filter=@bb/app passed. Lint reported
  250 existing warnings and zero errors.
- git diff --check passed.

> AGENT GENERATED
## Human comments

## What was wrong

Single-thread and environment-group archive success toasts used "Thread
Archived" and "Threads Archived", unlike the sentence case used by other
toast titles.

## What changed

Use "Thread archived" and "Threads archived" in ThreadActionsProvider.
Update the Toasts > Catalog examples and existing test expectations and
fixtures. Reviewed other catalog titles and app toast call sites; found no
other title-case inconsistencies beyond the plural archive title.

## How you verified

- Captured and reviewed before/after Ladle catalog screenshots at 390 x 844
  and 1280 x 900. Phone captures scroll horizontally to the toast previews
  because the existing catalog uses a fixed label column.
- pnpm exec turbo run typecheck lint --filter=@bb/app passed; lint reported
  250 warnings and no errors.
- Focused Turbo tests for ThreadActionsProvider, AppToaster, and app-toast
  passed: 3 files, 28 tests.
- git diff --check passed.

> AGENT GENERATED
## Human comments

## What was wrong

The mobile actions story forced Copy visible on desktop while leaving the
adjacent overflow control transparent, creating an apparent empty slot under
the latest user bubble. Its agent message also claimed Fork was inline.

Selective PR CI also exposed a missing prerequisite in the SDK npm guard:
it built runtime files without generating declarations, then reported the
absent declaration files as published-package drift.

## What changed

Remove the stale story CSS and describe Copy inline with Fork in the overflow
menu. The story follows the production component's responsive behavior. The
real app was correct at a 390px touch viewport, so production UI is unchanged.

Request both build and build:types through Turbo before the npm guard packs
the SDK. No SDK version or public API changes.

## How you verified

- Inspected real threads read-only on the primary server at 390px with touch.
- Reviewed before/after Ladle screenshots at 390px touch and 1280px desktop.
- Opened the agent overflow menu and confirmed Fork; hovered the latest user
  row on desktop and confirmed Copy and the overflow control appear.
- App typecheck and lint passed, including after rebasing onto current main.
- Reproduced the SDK guard failure with declarations absent, then verified
  it passes after generating declarations. The guard now requests that task.
- SDK typecheck and lint passed.
- git diff --check passed. iOS Safari was not tested.

> AGENT GENERATED
…et-bb#5104)

## Human comments

## What was wrong

The real settings component hid its automatic GH_TOKEN row whenever the
variables response was absent, even though the switch's setting comes from
system config. A failed request left an empty card with the error below an
unused gap. The Ladle failed-load fixture correctly reproduced this behavior;
its hint described the intended row visibility.

## What changed

Render the automatic row when the variables request fails as well as when
variables are available. Keep variable editing gated on a loaded response
and preserve the loading state.

## How you verified

- Served apps/app Ladle with pnpm exec turbo run storybook --filter=@bb/app -- --port 6193.
- Reviewed before/after screenshots of Settings / Machine environment >
  Section (could not load) at 390px and 1280px. Isolated the story row and
  adapted only Ladle's surrounding layout to fit each viewport.
- Confirmed the failed state displays GH_TOKEN, the config-backed switch,
  and the error, without editing buttons or horizontal overflow. Checked
  the loading state and successful story sections retain their behavior.
- pnpm exec turbo run typecheck lint --filter=@bb/app passed; lint reported
  250 existing warnings and no errors.
- git diff --check passed.

- Rebased onto current main, including the SDK guard fix that builds declarations
  before packing, and repeated app typecheck/lint successfully.
- All 18 selected PR checks passed. Full CI on the preceding rebase also
  passed all 44 jobs.

> AGENT GENERATED
## Human comments

## What was wrong

The shared markdown renderer reserved 20px for outside ordered-list markers.
Two-digit markers exceeded the gutter and were clipped in collapsed user
bubbles. The earlier fixed 28px fix in 9e102e0 (get-bb#1759) was explicitly
reverted to 20px by 16ceb3a (get-bb#1765), without a regression test. A fixed
wider gutter also shifts single-digit lists unnecessarily.

## What changed

Count direct items in each ordered list and calculate its widest marker from
its start and final number. Expose the digit count as a CSS variable and
add one ch per extra digit to the existing 20px padding-inline-start.
Single-digit lists keep their geometry; nested lists compute independently.
User and assistant markdown use the shared renderer. Unordered lists are
unchanged. Queued previews flatten lists into inline spans without markers.

Add focused Ladle story cases for both message roles: 1–9, 10–12,
98–101, and nested 7–11. These expose the geometry for the story smoke
and visual checks.

## How you verified

- A temporary Chromium geometry check failed with the original gutter: "1280px user:
  marker 10. needs 20.56px, but the computed gutter is 20px".
- With the fix, the geometry check passed for both user and assistant
  messages at 1280px and 390px: single-digit gutters remain 20px, larger
  gutters grow only by the extra digits, start values are preserved, and
  all markers fit, including independently measured nested lists.
- Reviewed before/after Ladle screenshots at 1280px and 390px. Capture-only
  browser changes stack story labels above messages and hide unrelated
  rows; production message styles are unchanged.
- pnpm exec turbo run typecheck lint --filter=@bb/app passed; lint reported
  250 existing warnings and no errors.
- The focused existing ordered-list start test passed through Turbo.
- git diff --check passed.

> AGENT GENERATED
…#5112)

## Human comments

## What was wrong

Performance diagnostics stopped and restarted V8's CPU profiler every 30
seconds. Restarting rebuilt its code map, causing recurring event-loop
stalls in a large process. Stall detection logged the delay, but
profiler operations were not instrumented, so the longest measured work
could misleadingly name an unrelated heartbeat that took only 1 ms
during a two-second stall.

## What changed

Start the next named capture before ending the current one so V8 keeps
its profiler active across bounded windows. Only two diagnostic captures
briefly overlap; sampling, file limits, retention, and the final partial
save remain. Initial activation and final teardown still run on the
server thread.

Measure profiler start, completion, and serialization through the
server's synchronous work tracker. Stall logs now explicitly report
`unattributed` when the longest measured operation cannot explain the
delay, allowing one sampling interval of tolerance. Otherwise they name
a `candidate`, which still requires confirmation from profile stacks.
The debugging guide documents the handoff and attribution fields. No
server/daemon wire, SDK, or CLI contracts change.

## How you verified

- The continuous-window regression covers two rotations, unrelated named
captures, and idempotent shutdown. Attribution regressions cover a
two-second stall with only 1 ms of measured work and slow profiler
start/completion/serialization through real capture and server wiring.
The added attribution assertions fail before the fix and pass afterward.
- `pnpm exec turbo run test --filter=@bb/server --
test/system/event-loop-stall-monitor.test.ts
test/system/performance-diagnostics.test.ts`: 16 tests pass.
- `pnpm exec turbo run test --filter=@bb/process-utils --
test/performance-diagnostics.test.ts`: 4 tests pass.
- `pnpm exec turbo run typecheck lint --filter=@bb/server
--filter=@bb/process-utils`, targeted server lint, and `git diff
--check` pass.
- Started `pnpm start:worktree --perf-diagnostics` and enabled the
experiment in isolated dev data. Actual captures arrive every 30 seconds
with approximately 0.08–0.13 ms handoff overlap. A 378 ms activation
stall names `cpu-profile:start`; a separate 102 ms stall with only 7.2
ms of measured work reports `unattributed`. Verified the app and
experiment toggle in a browser.
- The integrated main/change benchmark measured median rotation overrun
of 419.56 → 35.63 ms and maximum heartbeat delay of 417.04 → 37.53 ms.
These are three rotations in a synthetic sized process on Node 22.23.1,
not a reproduction of the production audit's 4.5-second maximum.
Benchmark scripts and reports are retained outside the checkout.

> AGENT GENERATED
…b#5117)

## Human comments

## What was wrong

Cmd/Ctrl-clicking a thread pill in the timeline opened a new browser tab
(or, in Desktop, navigated the current pane) instead of opening the
thread in a split. Pills render through `RouteAnchor`, whose click
handler treated every modified click as browser-default and never called
`preventDefault()`. The Cmd-click-to-split logic existed only in
`useRouteAnchorDelegate`, which is mounted only around plugin slots. A
second gap surfaced during manual QA: personal-project threads route as
`/threads/:threadId`, but `paneContentForPathname` only recognized
`/projects/:projectId/threads/:threadId`, so even a split-aware click on
a personal-thread link found no pane content and fell through to a new
tab.

## What changed

- `apps/app/src/components/ui/app-route-anchor.tsx`: `RouteAnchor` now
routes primary-button Cmd/Ctrl clicks through `navigation.openInSplit`
(the same path the sidebar rows and the plugin link delegate use),
preventing default only when a split was opened. Shift, Alt, non-primary
clicks, and explicit `target`s still go to the browser. On compact
viewports `openPaneContentInSplit` already falls back to plain
navigation.
- `apps/app/src/views/thread-detail/splitThreadNavigation.ts`:
`paneContentForPathname` maps `/threads/:threadId` to thread pane
content under `PERSONAL_PROJECT_ID`, matching what `paneContentRoute`
produces for personal threads.

This applies to every `RouteAnchor`: in-app markdown links, timeline
title links, `PluginUrlLink`, and `ExperimentalFileLink` now also open
in a split on Cmd/Ctrl-click instead of a new browser tab.

## How you verified

- New tests in `app-route-anchor.test.tsx`: Cmd- and Ctrl-click on a
project thread link and Cmd-click on a personal thread link open a split
without navigating the current pane; Shift-click is left to the browser.
The modifier tests fail on the old `RouteAnchor`, and the
personal-thread case fails without the `splitThreadNavigation` change.
- `pnpm exec turbo run typecheck lint --filter=@bb/app` (0 errors) and
`turbo run test --filter=@bb/app` over `src/components/ui`,
`src/views/thread-detail`, `src/components/thread/timeline`,
`src/components/plugin`: all pass.
- Manual: `pnpm start:worktree` with a seeded thread whose user message
and assistant markdown contain thread pills; Cmd-clicking a pill in
headless Chrome kept the hub thread on the left and opened the target in
a split on the right.

> AGENT GENERATED

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: qa <qa@x>
Co-authored-by: Claude Opus 5.5 <[email protected]>
## Human comments

## What was wrong

Hot entity lookups and event-pruning support reads rebuilt Drizzle SQL
and prepared the same SQLite statements on every call, spending server
CPU on repeated compilation.

## What changed

Reuse explicit parameterized Drizzle prepared queries for host, thread,
project and environment lookups and five pruning support queries. A
connection-owned registry shares these queries with transaction handles
and clears them on close. Reads continue to observe writes and
rollbacks. Uses the existing prepared-query API without a general SQLite
statement wrapper or automatic statement LRU.

## How you verified

- `pnpm exec turbo run test --filter=@bb/db --
test/prepared-queries.test.ts test/query-plans.test.ts
test/data/thread-pruning.test.ts test/connection.test.ts`: 84 tests
passed.
- `pnpm exec turbo run typecheck --filter=@bb/db`: passed.
- Regression guards verify warm lookup SQL is compiled once, transaction
reuse, connection independence, write visibility and rollback. Existing
query-plan tests verify indexed, bounded pruning support probes.
- Seven-sample snapshot benchmarks: entity lookup CPU fell 86–91%;
pruning sweep CPU fell from 2,904 to 1,721 ms (41%), and live pruning
from 128 to 112 ms (13%). Lookup results and pruning membership hashes,
removal counts and advance counts matched. Scripts and raw results are
retained outside the checkout.
- Started the optimized worktree server; server and daemon health
passed, the host connected, and repeated project reads observed a rename
after warming the query.

> AGENT GENERATED
… drop diagnostics (get-bb#5113)

## Human comments

## What was wrong

The bb connect gate's 30 s response-head timer only started once a
request had been handed to the tunnel's Durable Object. A request that
stalled earlier, while the gate checked access or handed the request
off, was never answered. On 2026-10-06, two app submissions through
`ymichael.getbb.app` hung this way until the browser reloaded
(Cloudflare logged 499), and the composer kept spinning. On the same day
the server's tunnel dropped about 40 times while heartbeats were
current, and two reconnects used up their full 10 s handshake. The logs
couldn't tell a network problem from a slow gate, and Workers Logs keeps
only about 1% of gate requests.

## What changed

- `apps/connect/src/gate-deadline.ts`, `worker.ts`, `relay.ts`: the
Worker races each request against the same response-head deadline (30 s,
90 s for voice transcription), counted from when the request arrives. A
request that misses it gets a 504 naming the stuck stage: `routing`,
`tunnel-object`, `request-body`, `response-head`, or `finishing`. If the
real response arrives later, its body is cancelled. A late WebSocket
upgrade is accepted and closed, so the tunnel object doesn't keep a
socket nobody holds. The deadline covers only the response head, so
streamed bodies are unaffected.
- A tunnel dial (`/__tunnel`) still unanswered after 3 s writes a `slow`
event with its stage and how many tunnel-object attempts it has made.
Stalls and slow dials go to the new Analytics Engine dataset
`bb_connect_gate_events` (`bb_connect_gate_events_staging` on staging),
bound as `GATE_EVENTS` in `wrangler.jsonc`.
- `plugins/connect/src/tunnel.ts`: the plugin times each dial's DNS
lookup, TCP connect, TLS handshake and upgrade response, and reads the
Cloudflare colo and ray from `cf-ray`. These fields appear on `tunnel
connected` and `handshake timed out`. To get the timings, a TLS
`createConnection` replaces `ws`'s default and keeps its server-name
(SNI) handling.
- `packages/tunnel-client/src/session.ts`: `TunnelSession.snapshot()`
reports open streams, bytes each way, how long each direction has been
quiet, and bytes still buffered. `tunnel closed` now includes this as
`traffic`, along with `colo` and `ray`.
- `docs/debugging-and-qa.md` documents the new log fields, the 504
stages, the dataset's columns, and an example query.

No tunnel protocol or daemon wire change, so
`HOST_DAEMON_PROTOCOL_VERSION` is unchanged. No CLI or guide changes.

## How you verified

Tests added:

- `apps/connect/src/worker.test.ts`: a request stuck at each stage gets
the 504 for that stage at the deadline, including stalls before the
tunnel object answers; voice transcription gets 90 s; late HTTP bodies
are cancelled and late WebSocket upgrades are accepted and closed; a
slow tunnel dial writes one `slow` event with its attempt count, and a
fast one writes nothing. The late-WebSocket test failed before its fix.
- `packages/tunnel-client/test/traffic-snapshot.test.ts`: byte counts,
quiet times and buffered bytes in the snapshot.

Commands: `pnpm exec turbo run typecheck test lint
--filter='...[origin/main]'`, all passing. On the first run two
`@bb/server` builtin-plugin build tests timed out at a load average of
23; `test/services/plugins/builtin-plugins.test.ts` passes 28/28 on
rerun.

Staging (gate deployed to `bb-connect-staging`; a source bb from this
branch signed in with `pnpm dev --staging`; traffic driven through the
gate with a minted session cookie):

- App `/` and `/api/v1/threads` through the server host return 200; a
shared port returns 200, and 401 without a cookie.
- A shared-port origin that waits 35 s returns 504 `bb connect: timed
out waiting for the tunnel client (stage: response-head)` at 30.9 s.
- A 45 s streamed response finishes with every chunk, unaffected by the
30 s head deadline.
- Both stalls appear in `bb_connect_gate_events_staging` within seconds
(`stall`, `response-head`, host, path, 30000 ms, 1 attempt).
- Every dial connected through the custom TLS connection and logged its
timings, e.g.
`{"lookupMs":8,"connectMs":90,"tlsMs":199,"upgradeMs":1558,"colo":"MIA"}`.
- A forced drop (a second dial with the same credential) logged `tunnel
closed` with `colo`, `ray` and `traffic`.

Not exercised on staging: a `slow` dial event, because no dial took over
3 s inside the Worker, and a late WebSocket upgrade, because the tunnel
object answers visitor upgrades with 101 before the origin does. Both
are covered by unit tests. Seen during staging testing and not caused by
this change: a gate deploy can drop connected tunnels with 1006, and the
first reconnect goes through the tunnel object's restart-and-retry path.

> AGENT GENERATED

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
Co-authored-by: qa <qa@x>
iipanda and others added 28 commits October 8, 2026 12:45
## Human comments

## What was wrong

When the main agent sends a follow-up to a Codex sub-agent that has
finished, the Codex translator reopened the sub-agent's original
delegation item: the same id, in the turn that first spawned it. The
timeline projection only merges a start event into an existing row while
that call is still running, so each reopen added another row with the
same id (`onExecBegin` in `tool-activity-projection.ts`). Children
attach to a delegation by call id, so every copy rendered the
sub-agent's entire history. When a sub-agent also followed up its own
sub-agents, the copies multiplied at every level. That is the
exponential growth in get-bb#5210 that exhausted the server heap. Even without
nesting, threads showed one delegation many times; one local thread
rendered a sub-agent 14 times, with 2,609 timeline rows instead of 982.

## What changed

- **`plugins/provider-codex/src/translator.ts`:** a follow-up to a
finished sub-agent starts a new delegation. Its id is the follow-up
interaction's own id, it is placed in the parent turn that sent the
follow-up, and it uses the same path as a newly spawned sub-agent. Each
round now appears in the turn where it happened and contains only that
round's work. Follow-ups queued while the sub-agent is still running
stay in the current round. Nested follow-ups attach to the parent's
current round.
- **`packages/thread-view/src/tool-activity-projection.ts`:** a start
event for a finished delegation reopens its existing row instead of
adding a copy. This fixes threads already stored with reused ids: they
show one row per sub-agent, holding every round. Commands keep get-bb#5108's
behaviour, where a reused call id gets its own row.
- **`packages/thread-view/src/normalize-event-projection.ts`** (from the
original version of this PR): each delegation keeps one child per
message id. This is a backstop against exponential growth if duplicate
ids arrive from another source.
- **Dropped from the original version:** the incremental byte budget in
`timeline-pagination.ts`. The oversized tree is fully built before
pagination serializes it, so that change didn't address the crash.
- No wire, schema, CLI, or plugin API changes.

## How you verified

- New `delegation-item-projection` test: a delegation reopened by a
follow-up, with a nested sub-agent that is also reopened, renders one
row per delegation with all child messages. It runs in two variants, the
last round completing or still running. It fails on `main` and passes
with the projection change alone.
- Codex translator tests: a follow-up from a later parent turn opens a
new delegation in that turn, and the sub-agent's next turn links to it.
A new nested test checks that a sub-agent's follow-up to its own
sub-agent attaches to the parent's current round. Six tests fail on the
old translator.
- Replayed a stored Codex thread's 6,124 events through the projection:
the reopened delegations went from 14 and 6 copies to 1 each; timeline
rows fell from 2,609 to 982 and JSON from 14.6 MB to 3.9 MB.
- Ran real Codex end to end in a worktree dev instance: spawning a
sub-agent in turn 1 and following it up in turn 3 produced separate
`/root/counter` rows in turns 1 and 3, containing only "ONE" and only
"TWO".
- `pnpm exec turbo run test typecheck lint --filter='...[origin/main]'`:
38 tasks passed.

Fixes get-bb#5210

> AGENT GENERATED

---------

Co-authored-by: qa <qa@x>
Co-authored-by: Claude Opus 5.5 <[email protected]>
## Human comments

## What was wrong

The home screen still showed the zero-project welcome page (the glossy
bb logo with four actions) in place of the composer. Since the first-run
setup guide landed in get-bb#5146, that page duplicates it: "Automatically
import my projects" is the guide's projects step, "New project" is
already in the composer's project picker, and "New thread" only revealed
the composer the page was hiding.

## What changed

- `apps/app/src/views/RootComposeEmptyWelcome.tsx` is deleted.
`RootComposeView.tsx` always renders the composer, so a zero-project
home shows the existing "Finish setting up bb" / "No agent is ready"
banner above it.
- The `startedComposing` state existed only to hide the welcome page and
is removed. Prompt deep links (`?prompt=`) relied on it for focus, so
that effect now focuses the composer directly.
- `SetupChecklistCard`, `SetupChecklist`, and `NoAgentNotice` (the card
rendered under the logo) are removed along with
`SetupChecklistViews.tsx`. The banner is the only checklist surface
left.
- The onboarding story's mock home shows the banner instead of the logo
and card, and gains a state for the "Finish setting up bb" banner.
- Theme Preview's "New thread" view was a mock of the welcome page. It
now shows the empty composer, and the fixture-anatomy anchors point at
the real composer-only screen.
- `docs/api_to_audit.md` no longer lists welcome states as page-level
behavior.

Behavior lost with the page: the "Learn what bb can do" and
"Automatically import my projects" prompt shortcuts.

## How you verified

- `pnpm exec turbo run typecheck lint --filter=@bb/app
--filter=bb-plugin-theme-preview --continue` passes.
- `pnpm exec turbo run test --filter=@bb/app
--filter=bb-plugin-theme-preview -- src/views/RootCompose
src/components/onboarding
src/components/plugin/theme-preview-fixture-anatomy.test.ts
src/components/plugin/PluginNewThreadComposer.test.tsx
src/hooks/useCreateThreadInEnvironment.test.ts app.test.tsx` passes (13
files / 235 tests in the app, 33 tests in Theme Preview).
- Rendered the onboarding and banner stories in Ladle and checked the
setup guide steps and both home banners.
- Not checked: the zero-project home screen in a running app.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

> AGENT GENERATED

Co-authored-by: Claude Code <[email protected]>
Name each large paste after the attachments already in the draft and the
uploads still in flight, so a second paste becomes "Pasted text 2.txt".

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Attachments for every turn stage into one flat Attachments/ directory, so a
later turn's file with the same name replaced the earlier one and the agent
read the wrong contents when it went back to an earlier message. Staging now
creates files exclusively: an existing file with identical bytes is reused,
and a differing one gets the next -N suffix. Failure cleanup only removes
files the failed attempt created, so it can no longer delete a file an
earlier turn still references.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
)" (get-bb#5231)

## Human comments

## What was wrong

get-bb#5022 made the timeline wait to insert a fetched older page until
scrolling had been idle for 200 ms, with no touch in progress. The wait
applies on every platform. Desktop wheel and trackpad scrolling
(including macOS momentum) keeps firing `scroll` events, so the
prefetched page stays uncommitted for as long as the reader keeps
scrolling. `isLoadingOlderTimelineRows` stays true until the commit, so
readers scrolling up now reach the "Loading older messages…" indicator
and stall there. Before get-bb#5022, rows were inserted as soon as the
response arrived, so the 600 px prefetch margin usually hid the load.
Only one load can be pending at a time, so the next page also can't
prefetch while the reader keeps scrolling.

## What changed

Reverts get-bb#5022 (9cb923a) in full. One conflict in
`useThreadTimelineController.ts` was resolved by keeping get-bb#5068's removal
of the `useRef` import. This brings back the behaviour get-bb#5022 fixed: the
iOS momentum-scroll jumps and the stale scroll-anchor yank reported in
get-bb#4793.

## How you verified

- `pnpm exec turbo run typecheck lint --filter=@bb/app` passes: 0
errors, 250 existing warnings.
- Timeline, bottom-anchored scroll body, pending-interaction and
user-question suites in `apps/app`: 447 tests in 48 files pass.
- Not manually scroll-tested in the app.

> AGENT GENERATED

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: qa <qa@x>
## Human comments

## What was wrong

The mobile platform-support docs still described the native app replaced
by the WebView shell, excluding plugin frontends and reporting outdated
distribution and Android push support.

## What changed

Correct the shell/PWA ownership, plugin support, distribution and
Android push descriptions. Keep the README update to external-link
handling and removal of obsolete milestone labels, and add a brief
review reminder to update mobile docs with architecture changes.

## How you verified

Checked the descriptions against the shell, bridge and release
configuration, confirmed the Android testing release, and validated
changed local links and anchors. `git diff --check origin/main...HEAD`
passed. Documentation only; no runtime tests required.

Fixes get-bb#3525

> AGENT GENERATED

---------

Co-authored-by: qa <qa@x>
…ar navigation plugin API (get-bb#5229)

## Human comments

## What was wrong

The navigation rail shipped as the default-off `navigationRail`
experiment and only on wide windows, so bb carried two sidebar layouts:
the rail, and the older navigation rows at the top of the sidebar with a
plugin API for replacing them. The rail is becoming the default, which
leaves the rows, their replacement slots, and the settings that pick
between providers with nothing to render.

## What changed

**The rail is the only sidebar layout, on every screen size.**

- `AppLayoutSidebar` has one path. On narrow windows and phones the rail
sits inside the drawer: Home, Plugins, Skills, and Settings swap the
list beside it and leave the drawer open, and a plugin page closes it.
Customize rail opens as a sheet from More.
- The `navigationRail` experiment key is removed from `@bb/domain`,
Settings → Experiments, and the docs. A stored row for it is ignored.
- The "Back to app" rows, the section titles above the
Settings/Plugins/Skills lists, and the footer's built-in Settings action
are gone; the rail's Home and Settings replace them.

**Removed plugin API (`@get-bb/plugin-sdk`, bumped to 0.6.33).**

- `app.slots.experimental_sidebarNavigation`
- `experimental_useSidebarNavigation`,
`experimental_useSidebarNavigationSplit`,
`experimental_SidebarNavigationIcon`
- `app.slots.experimental_sidebarHeader`. It only mounted without the
rail, where New thread now always takes the header.
- Every `ExperimentalSidebarNavigation*` and
`ExperimentalSidebarHeader*` type, and the testing-harness support for
them.

Plugins that call these stop working. `docs/api_to_audit.md` named
Compact Nav 0.1.x as a released consumer of the navigation slot.

**Removed with it.**

- The built-in Navigation plugin (`plugins/navigation`) and the
`examples/plugins/sidebar-navigation` example, with their registry,
turbo, lockfile, demo-server, and marketplace entries. The server drops
an installed copy of the built-in at startup.
- UI preferences `sidebar.navigationProvider` and
`sidebar.headerProvider`, and the Appearance → Navigation and Header
pickers. Stored rows under those keys are ignored; a server test pins
that.
- The app's navigation model keeps `sidebar.pluginPanelOrder` and
`sidebar.visiblePluginPanels`, which now order and show or hide rail
destinations. Its types moved from the SDK into the app.

**Left in place, now unused.**
`PluginNavPanelRegistration.experimental_sidebarAccessory` is still
accepted by the SDK, but no host surface mounts it because the rail is
icon-only. The docs say so. Removing it, or drawing it on the rail, is a
follow-up decision.

**Behavior that goes away.** The navigation rows showed a mini-map when
a panel was open in a split; the rail does not. Theme Preview's mock
sidebar still does not draw a rail; only its "Back to app" row and
"Settings" label were removed so its anchors match the app.

**Docs.** `docs/configuration.md`, `docs/api_to_audit.md`, the bb guide
(`app-settings.md`, `bb-guide-customization.md`, `bb-guide-plugins.md`,
the plugin-authoring references), and the Plugin Guide surfaces and
wireframes describe the rail as the standard layout and no longer list
the removed API. No wire change between server and host daemon.

## How you verified

- `pnpm exec turbo run typecheck lint test --continue` across the repo:
all tasks pass. After the last rebase onto main, which touched only the
app, Theme Preview, and docs, I re-ran those two packages. Two tests
timed out under the full parallel run on my machine and pass on their
own (`ToolsView.plugin-detail.test.tsx`,
`plugin-native-server-loading.test.ts`); neither touches the sidebar.
- `pnpm exec turbo run smoke:tarball smoke:boot --filter=bb-app`: both
pass, expected built-ins running.
- `packages/plugin-sdk/scripts/check-npm-version-guard.mjs` and
`.github/workflows/check-plugin-sdk-version.mjs` pass at 0.6.33.
- Tests added or rewritten: the rail inside the compact drawer and body
swaps with the drawer open (`AppLayoutSidebar.test.tsx`); Customize from
More on a compact viewport, which destinations dismiss the drawer,
nested plugin routes, the Automations destination, and remembered panels
before and after plugins settle (`AppNavRail.test.tsx`); retired
preference keys (`public-ui-preferences.test.ts`). The compact Customize
test fails without the fix.
- Real dev app in headless Chromium at 1280×800 and at iPhone 14 size,
on a data dir that had the old built-in plugin and a stored experiment
value: the rail shows by default, the old rows and "Back to app" are
gone, Appearance has no Navigation or Header picker, Experiments has no
Navigation rail entry, the list swaps with the drawer open, a plugin
page closes the drawer, long-press and More both open Customize, and
there are no page errors.
- Not verified: the macOS desktop framed title bar on a real Mac (unit
tests only), the hosted demo, and iOS Safari or the native mobile shell.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

> AGENT GENERATED

Co-authored-by: Claude Code <[email protected]>
Paste, drop, the + button, and removing a pill now record a history step, so
Cmd+Z removes or restores the attachment and Cmd+Shift+Z replays it without
uploading again. A removed attachment returns to its original position, and
one undone while still uploading stays out of the draft until redo.

A large text paste records two steps: undo first turns the attachment back
into the pasted text, then removes the paste. The text step is applied to
editor state without rendering, so the paste only appears inline on undo.

Attach handlers now return the attachments they added, and composers pass an
onUpdate attachment updater instead of onRemove. History steps only act in
the draft that recorded them.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Pending uploads all rendered in the image row, so a non-image file appeared
as a chip in a new row and then jumped to the file row once uploaded,
resizing the composer twice. Uploading files now render as a pill in the
file row with the same box as the finished pill, spinner in the remove
slot, so finishing an upload no longer moves the composer.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…bb#5237)

## Human comments

## What was wrong

The framed macOS desktop layout drew its title bar across the top but
ran the content card flush to the right and bottom window edges, so the
card had one rounded corner and no frame around the rest of it.

## What changed

- `apps/app/src/components/ui/sidebar.tsx`: the framed wrapper now pads
its right and bottom edges by a new `--bb-window-frame-lip` (4px), and
the fixed sidebar panel subtracts it from its height. The sidebar card
rounds its bottom-left corner, the main card rounds its top-right and
bottom-right corners, and both gain the seam border on the newly exposed
edges. With the sidebar collapsed, the main card rounds all four
corners.
- `apps/app/src/app.css`: `--bb-window-frame-lip` defaults to `0px`, so
unframed layouts (web, Windows, Linux, compact viewports) are unchanged.
- `apps/app/src/views/RootComposeView.tsx`: the home screen's pinned
right-panel toggle is offset by the lip so it keeps its distance from
the card edge.

No wire, CLI, or plugin API changes.

## How you verified

- `pnpm exec turbo run test --filter=@bb/app --
src/components/ui/sidebar.test.tsx src/components/layout
src/lib/bb-desktop.test.ts src/components/ui/theme.test.ts` (189
passed), including a new test for the lip padding, panel height, and
card corners.
- `pnpm exec turbo run typecheck lint --filter=@bb/app` and `oxfmt
--check` on the changed files.
- Rendered the dev app in headless Chromium with the macOS desktop shell
stubbed, in light and dark themes, with the sidebar open and collapsed
and the right panel open.

Not yet checked: a native Browser tab is a square view, so its
bottom-right corner may show past the card's rounded corner.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

> AGENT GENERATED

Co-authored-by: Claude Code <[email protected]>
## Human comments

## What was wrong

Opening a thread or scrolling back through its history downloaded the
full content of every settled row inline, including command and tool
output, file-change diffs, reasoning text, and every delegation's child
rows. Most of that content stays collapsed and is never looked at, but
it set the size of each timeline and `turn-summary-details` response.
The table of contents also fetched every assistant message preview
whenever it became visible, even when only the user-message tab was
open.

## What changed

- **Server: `deferContent=true`** on `GET /threads/:id/timeline` and
`/timeline/turn-summary-details` (`timeline-deferred-content.ts`).
Settled rows whose content is over 1,000 characters omit it and carry
`contentDeferred: true`:
- commands: empty output, and the command text is cut to its first 300
characters
  - tools: empty output
  - file changes: null diff, stdout, and stderr; `diffStats` is kept
  - reasoning: null detail

Settled delegations return `childRows: null`. Pending rows stay inline,
so streaming and auto-expand on the live frontier behave as before.
Without the flag, responses are unchanged, so `bb thread log` and
existing SDK callers see no difference.
- **Server: `itemId` on `turn-summary-details`** returns just one item's
rows with full content. The range is widened to the item's own lifecycle
events through the new `getStoredItemLifecycleSequenceRange` in
`@bb/db`. An item outside the range returns 400 `invalid_request`.
- **Server: `role=user|assistant` on `conversation-outline`** filters
the cached outline by role.
- **Contract/SDK:** `childRows` is now nullable. The new query fields
are exposed through `sdk.threads.timeline`,
`timelineTurnSummaryDetails`, and `conversationOutline`.
- **App:** every timeline and detail request sends `deferContent=true`.
Expanding a deferred row loads its content by `itemId`
(`resolveDeferredTimelineContent` in `@bb/client-core`) and shows a
retry action if that fails. The table of contents fetches user items
while it's visible, and assistant items only while the Agent messages
tab is open.
- **Docs:** `docs/timeline-pagination.md` covers deferred content,
`itemId`, and the outline `role` filter.

No daemon wire change; `HOST_DAEMON_PROTOCOL_VERSION` is untouched. The
plugin SDK surface is unchanged (`check-plugin-sdk-version.mjs` passes).

## How you verified

- `pnpm exec turbo run typecheck lint --filter='...[origin/main]'`:
116/116 pass.
- `turbo run test` for `@bb/thread-view`, `@bb/client-core`,
`@bb/server-contract`, `@bb/db`, `@bb/sdk`, `@bb/server`, `@bb/app`: all
pass except one app test, `PluginIcon.test.tsx`. It fails on a stale,
untracked `plugins/navigation/` build-output folder in this worktree,
left over from a plugin removed on main, and is unrelated to this
change.
- New and updated tests:
- `ThreadTimelineRows.deferred-details.test.tsx`: expanding a deferred
row loads and renders its content, with retry on error
- server public tests for deferred work rows, output previews, and
`itemId` detail pages
- `timeline-cache`, in-turn window, and parented pagination tests for
nullable `childRows`
  - TOC tests for role-scoped outline fetching

> AGENT GENERATED

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: qa <qa@x>
Co-authored-by: Claude Opus 5.5 <[email protected]>
Clicking an uploaded file pill in the composer or in sent-message history now
opens it in a right-panel tab (or the drawer on compact layouts) instead of a
raw browser tab. A new attachment-file-preview tab kind carries the project,
stored path, and display name; it persists through local tab state and the
thread-tabs contract, loads through loadFilePreview against the attachment
content endpoint, and renders HTML attachments as source rather than in the
preview iframe. Surfaces without a panel keep the new-tab link.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Typing @ in a composer now lists the draft's non-image attachments in an
Attachments group, including on a bare @, and picking one inserts an
attachment mention pill (`@<name>`). Codex and Pi now name attached files
the way Claude Code and ACP already do, so agents match the mention to the
file by name. Images are not offered because most providers deliver them
without a name.

Every attachment added through the composer gets a name unique within the
draft ("notes 2.txt"), replacing the paste-only numbering, so mentions are
unambiguous. Mentions of attachments removed before sending are sent as
plain text. Attachment mention pills in history and in the editor open the
file in the attachment viewer.

The new mention kind is part of the prompt input contract the host daemon
validates, so HOST_DAEMON_PROTOCOL_VERSION moves to 231 (origin/main is
already at 230). ComposerMention gains the attachment variant; the plugin
SDK version bump is left for the rebase onto main.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
## Human comments

## What was wrong

Resolving a plugin input card during a running turn and then steering
that turn can produce a “Worked for …” group containing only
thread-scoped interaction lifecycle events. The shared timeline
projection assigns these events to the running turn, but the server's
details endpoint required an explicitly turn-scoped event in the range.
Expanding the group therefore returned 400 “range X-Y does not include
turn T”.

## What changed

Use the shared thread-view projection's turn bounds to validate detail
ranges, removing the server's separate scope-only check. Load turn start
and completion context so the projection assigns interactions to the
correct running turn and rejects ranges belonging to another turn.
Unmatched ranges return an invalid-request response.

## How you verified

Added a public API regression that obtains the interaction-only summary
range from the timeline response and expands it through the details
endpoint. It failed with 400 before the fix and passes after. Added
rejection cases for another turn's work, a standalone thread event, and
an interaction during another turn; the interaction case also exposed
missing lifecycle context before that repair.

Passed:
- `pnpm exec turbo run test --filter=@bb/server --
test/public/public-thread-timeline-turn-details.test.ts
test/public/public-thread-data.test.ts
test/public/public-thread-timeline-completed-turn-display.test.ts
test/public/public-thread-timeline-output-preview.test.ts` — 91 tests.
- `pnpm exec turbo run test --filter=@bb/thread-view` — 464 tests.
- `pnpm exec turbo run typecheck --filter=@bb/server
--filter=@bb/thread-view`.
- Oxlint and Oxfmt on all changed files, plus `git diff --check`.

> AGENT GENERATED

Co-authored-by: qa <qa@x>
## Human comments

This just adds the "View > Reload" button to the quick palette, I run
this all the time in VSCode

## What was wrong

The desktop app can reload its window from View > Reload and Cmd+R, but
the quick palette had no command for it, so there was no
keyboard-searchable way to reload the window.

## What changed

- `packages/domain`: new `window.reload` app command ID.
- `apps/server`: desktop-only, unassigned default keybinding for
`window.reload` (`mainSurface`, not `modalOpen`). No default shortcut,
so it does not compete with Cmd+R, which already means "reload the
embedded browser tab" when the browser has focus.
- `apps/app`: palette metadata ("Reload window" in "Window and layout")
and a `useWindowReloadCommand` hook registered in `AppLayout`. The
command is only available when the desktop bridge exposes
`reloadWindow`, so it is hidden on web and mobile.
- `packages/desktop-contract` / `apps/desktop`: new optional
`BbDesktopApi.reloadWindow()` sent over a `bb-desktop:reload-window` IPC
channel. Main only accepts it from an application window's main frame,
then calls `reloadApplicationWindow()`. That function is extracted from
the existing menu and Cmd+R handlers, which now use it too, so all three
reload paths hide embedded browser views via `prepareWindowReload`
before reloading.

No server/daemon wire changes.

## How you verified

- `pnpm exec turbo run typecheck --filter=@bb/app --filter=@bb/desktop
--filter=@bb/server` passes.
- Vitest: app keybindings, command palette,
`SettingsView.palette-preview` and `useServerDaemonLogsCommand` tests in
`@bb/app`; `menu`, `preload-browser-api`, `preload-build` and
`desktop-reload-shortcut` in `@bb/desktop`; `system/app-keybindings` in
`@bb/server`; `plugin-app-commands` in the plugin SDK. All pass.
- Not yet exercised manually in the running desktop app.
- `.bb/skills/verify-bb/scripts/inventory.py` already fails on `main`
(unmapped `browser` CLI family), so the inventory was not regenerated
for the new app action.

> AGENT GENERATED

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 5.5 <[email protected]>
🚨 **SLOP COP** 🚨 · `new-issue-autopilot`

## Human comments

## What was wrong

The Personal-project child policy replaced personal workspace requests
with the parent's environment before checking the selected machine. A
different existing host or a new-machine selection was silently
discarded. The [verified reproduction
report](https://get-bb.github.io/reports/issues/5204.html) records
failures on trusted main in two clean checkouts.

## What changed

- Reuse the parent's personal environment only when machine selection is
omitted or selects the parent's existing host.
- Preserve different-host and new-machine requests for the existing
environment placement implementation.
- Extend the existing policy test table with a real stored parent
environment and matching-host, different-host, omitted-machine, and
new-machine cases.
- Two files in the existing server thread-policy subsystem; 95 changed
text lines (87 additions, 8 deletions). No dependencies, generated
files, data changes, public contracts, wire fields, or CLI flags change.

## How you verified

- On unchanged production code at
`f135a001e72942cee9118d2693208ec0725e2f18`, the test-only regression
fails in both clean checkouts: **3 failed, 40 passed**, for the two
different-host forms and the new-machine form.
- After the fix: **137 tests pass across five relevant suites** with
`pnpm exec turbo run test --filter=@bb/server --
test/threads/thread-default-policy.test.ts
test/threads/environment-providers.test.ts
test/threads/thread-create-seed-without-run.test.ts
test/threads/thread-create-shared-workspace-path.test.ts
test/public/machine-environment.test.ts`.
- `pnpm exec turbo run typecheck --filter=@bb/server` passes.
- The configured formatter check and `git diff --check` pass; `git diff
--numstat origin/main` confirms the line count and no binary changes.

Fixes get-bb#5204

> AGENT GENERATED

<!-- slopcop:rule=new-issue-autopilot run=run_oi1twbtgmuzilb2k
sha=issue-5204 kind=summary -->

Co-authored-by: SawyerHood <[email protected]>
…#5226)

🚨 **SLOP COP** 🚨 · `new-issue-autopilot`

## Human comments

## What was wrong

The Account Pooler hub computes the earliest known account availability
for `Retry-After`, but discards that timestamp when constructing the
human-readable 429 error. This reproduces for both Claude and Codex at
the proxy HTTP boundary. [Reproduction and root-cause
report](https://get-bb.github.io/reports/issues/5224.html).

## What changed

Reuse the computed timestamp and rounded delay in the error message when
availability is known. Preserve the existing fallback when no reset is
known. Extend the existing provider-parameterized exhaustion regression
rather than introducing another fixture or private test seam. No
routing, status, header, JSON-shape, authentication, stored-data,
dependency, CLI, or wire-contract change.

Changed-line count against the trusted main base: **10 total text
lines** (8 additions + 2 deletions), across two files in the existing
Account Pooler subsystem. No binary changes.

## How you verified

- The locally authored HTTP-boundary regression fails for both providers
on trusted main `94935ac454f26883d079bde8e38fbde9eeb48de0`; a second
clean checkout repeats the same failure. Both runs are by the same
agent.
- Refreshing the branch to the then-latest trusted main
`fe215d53234752a9cbdf31b1587b2309b6b39b2d` still fails before the
production fix.
- `pnpm exec turbo run test --filter=bb-plugin-account-pool --
src/server.test.ts -t 'quota exhaustion and reset with session
affinity'` passes both cases after the fix, including the earliest
timestamp, matching delay, failover, and reset recovery.
- `pnpm exec turbo run test typecheck lint
--filter=bb-plugin-account-pool`: all 349 tests pass; typecheck passes;
lint has zero errors and two pre-existing warnings in unchanged UI code.
- Frozen install and full trusted-base Turbo build succeed. Formatting
and `git diff --check` pass.

Fixes get-bb#5224

> AGENT GENERATED

<!-- slopcop:rule=new-issue-autopilot run=run_07l18lu9muzxb1q9
sha=issue-5224 kind=summary -->

Co-authored-by: SawyerHood <[email protected]>
🚨 **SLOP COP** 🚨 · `new-issue-autopilot`

## Human comments

## What was wrong

The Claude provider's closed system-subtype allow-list reduces seven
plugin-UI notification kinds to `unknown`. The existing translator
consequently emits `provider/unhandled` events, which become diagnostic
timeline rows. The provider-boundary failure reproduces on trusted main
in two clean checkouts:
https://get-bb.github.io/reports/issues/5252.html.

## What changed

Explicitly recognize the seven tested notification kinds and classify
them as noise in the existing provider visibility path. Preserve
unknown-event diagnostics rather than applying a blanket prefix rule.
Add a translator/assembler-boundary regression with unknown-system
controls. No public protocol, schema, permission, CLI/configuration,
dependency, packaging, or stored-data change.

Changed-line count: **78 additions + 0 deletions = 78 total text lines
across 2 files**, measured with `git diff --numstat origin/main`.

## How you verified

- Trusted base: `9a47d42c78ca9689af0b78da9b3155a8c0b36251`; frozen
installs and the full base Turbo build succeed.
- Before production changes, `pnpm exec turbo run test
--filter=bb-plugin-provider-claude-code -- src/system-ui.test.ts` fails
identically in two clean checkouts: 7 failing UI cases, 3 passing
unknown-system controls.
- After the fix, the same focused command passes all 10 tests.
- `pnpm exec turbo run test typecheck lint
--filter=bb-plugin-provider-claude-code` passes typecheck and lint. Its
five bridge-test failures under UID 0 reproduce against unchanged
production code; all five are existing non-root expectations.
- Running the full provider suite as UID 1000 with an isolated
home/cache via `unshare --user --map-user=1000 --map-group=1000 ... pnpm
exec turbo run test --filter=bb-plugin-provider-claude-code
--cache=local:r` passes **26 files / 385 tests**, without changing
unrelated code or tests.
- Formatting and `git diff --check` pass; no binary changes.
- Live upstream notification emission, CLI introduction version, macOS
rendering, and notification frequency were not exercised; the report
documents these limits.

Fixes get-bb#5252

> AGENT GENERATED

<!-- slopcop:rule=new-issue-autopilot run=run_secn8gv8mv0resnd
sha=issue-5252 kind=summary -->

Co-authored-by: SawyerHood <[email protected]>
🚨 **SLOP COP** 🚨 · `new-issue-autopilot`

## Human comments

## What was wrong

The secondary panel renders only the active file surface. Activating a
browser surface removes the file's scroll container, and returning
recreates it at offset zero. Switching to a shorter document can also
clamp the shared wrapper. No scroll state outlives the ready Markdown
body, even though its tab remains open. See the [verified reproduction
report](https://get-bb.github.io/reports/issues/5181.html).

## What changed

- Cache ephemeral positions by open panel tab ID and prune closed-tab
entries.
- Save native scroll events while the ready Markdown body is mounted;
restore in its layout effect, not against a loading skeleton.
- Remove listeners without saving during outgoing cleanup, avoiding
layout-clamped offsets.
- Add focused panel regressions for tab and hyperlink returns, separate
document positions, delayed loading, and close/reopen cleanup.

The patch stays in the existing secondary-panel subsystem: **4 files,
284 additions + 6 deletions = 290 changed text lines**. No dependency,
stored-data, public API, CLI, protocol, or schema change is required.

## How you verified

- Authored the regression before the production fix. On trusted main,
four reading-position tests fail with `expected +0 to be 780`; the
close/reopen control passes. Repeated in a second clean checkout, then
refreshed onto `178fd3c2c4aeef162dea517d850ead11f3b034df` and reproduced
again.
- After the fix, **67 tests pass** across the new regression and the
existing file preview, panel collapse, and Markdown image-routing
suites.
- Native Chrome source-UI reproduction: **4 failures / 1 control pass
before; all 5 scenarios pass after**, including a real long-to-short
layout clamp and restoration after loading.
- `pnpm exec turbo run test --filter=@bb/app --
src/components/secondary-panel/ThreadSecondaryPanel.markdown-scroll.test.tsx
src/components/secondary-panel/ThreadSecondaryPanel.collapseControl.test.tsx
src/components/secondary-panel/FilePreview.test.tsx
src/components/secondary-panel/ThreadSecondaryPanelTabContent.markdown-images.test.tsx`
- `pnpm exec turbo run typecheck lint --filter=@bb/app` passes; lint
retains existing warnings.
- `git diff --check` passes; the fix has no binary changes.

The browser harness uses real source components with deterministic file
retrieval and a local browser-surface activation callback. Installed
desktop and Safari verification are not claimed.

Fixes get-bb#5181

> AGENT GENERATED

<!-- slopcop:rule=new-issue-autopilot run=run_8qse0btjmuz02ygv
sha=issue-5181 kind=summary -->

Co-authored-by: SawyerHood <[email protected]>
…ackground (get-bb#5258)

## Human comments

## What was wrong

Every send to a thread on a non-server host assembles that host's
environment, which forwards the server's `gh` login (`GH_TOKEN`, git
author/committer identity). Those credentials were memoized for 60 s (5
s when empty) and then refreshed inline, so the first send after expiry
blocked on `gh auth token` and `gh api user` — 350–820 ms of
network-bound latency on the send path.

## What changed

- `apps/server/src/services/lib/async-ttl-memo.ts`: new opt-in
`staleWhileRevalidate` option. Once a key has loaded, an expired value
is returned immediately while a single background lookup replaces it; a
failed background lookup leaves the stale value in place and the next
call retries. Lookup start/settle logic is extracted into a shared
`start()` helper. Expired entries are not pruned when the option is on
(they are what gets served). Other memo callers are unaffected.
- `apps/server/src/services/machines/git-credentials.ts`: the credential
cache enables `staleWhileRevalidate`. `resolveGitCredentials` (send
path) serves cached credentials instantly; `machineGitHealth` (Settings
health check) still forces a blocking refresh.

Trade-off: after a token rotation or `gh auth login`/`logout`, the first
send after expiry still sees the previous result; the next one sees the
refreshed value.

No wire changes.

## How you verified

- New `async-ttl-memo` test: expired value is served, only one
background lookup runs, a rejected lookup keeps the stale value and is
retried, success replaces it, and a forced refresh blocks and is shared
with concurrent callers.
- Updated `git-credentials` tests for the serve-stale-then-refresh
behavior.
- `pnpm exec turbo run typecheck lint --filter=@bb/server` and the two
test files pass.

> AGENT GENERATED

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: qa <qa@x>
Co-authored-by: Claude Opus 5.5 <[email protected]>
…example (get-bb#5259)

## Human comments

## What was wrong

`Icon` from `@bb/shared-ui/icon` renders its `Zap` fallback for any name
that is not in the shared-ui icon registry. `MachineIcon` built its
stand-in presentation for an ephemeral machine whose provider plugin is
not loaded with the icon name `"Server"`, which is not registered, so
those machines rendered a Zap. The composer-customization example plugin
had the same problem with `"ListChecks"`.

## What changed

- `apps/app/src/components/machines/MachineLabel.tsx`: the
unloaded-provider stand-in uses the registered `ComputerCloud` icon,
checked with `satisfies BuiltinIconName` so an unregistered name fails
typecheck.
- `apps/app/src/components/machines/MachineLabel.test.tsx`: covers an
ephemeral machine with an unloaded provider and asserts `ComputerCloud`
renders instead of `Zap`.
- `examples/plugins/composer-customization/app.tsx`: the "Append review
checklist" plus-menu item uses the registered `ListTodo` icon.

No wire, CLI, or public API changes.

## How you verified

- `pnpm exec turbo run test --filter=@bb/app --
src/components/machines/MachineLabel.test.tsx`: 2 passed (new test
renders Zap without the fix).
- `pnpm exec turbo run typecheck lint --filter=@bb/app`: clean (0 lint
errors).
- `pnpm exec turbo run typecheck build
--filter=bb-plugin-composer-customization`: clean.

> AGENT GENERATED

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: qa <qa@x>
Co-authored-by: Claude Opus 5.5 <[email protected]>
## Human comments

## What was wrong

Outside plan mode Codex asks questions with `request_user_input_async`.
Codex emits an `agentMessage` with `delivery: "async"` and structured
questions, then tells the model the question was accepted. The Codex
adapter kept only the message text, so the thread showed plain bullets
and nothing could answer the question. Even with a card in place, the
server allowed only one open interaction per thread. While an async
question card was open, every provider approval or question on that
thread was rejected with "already awaiting user interaction". Codex's
escalated commands failed for up to an hour.

## What changed

- **Codex async questions** (`plugins/provider-codex`): the adapter
records each async question as Codex extension state. The plugin server
watches thread events and opens a `bb.ui.requestInput` form rendered
with the shared `QuestionForm`, the same mechanism Ask User Question
uses. Submitting sends the answer to the thread as a message, which
steers an active turn or starts a new one. The card stays open after the
turn ends, can be dismissed (which sends nothing), expires after an
hour, and can be answered with `bb thread interactions respond`. A
cancelled question row no longer reads as answered. The plugin overview
and the `codex-provider` skill document the behavior and the CLI path.
- **Several open interaction cards per thread** (`apps/server`,
`packages/db`): the one-active-interaction guards are gone. "Holds the
turn" now checks for any open card that has a turn (new
`hasTurnBoundActivePendingInteractionForThread`), not just the newest
one. Change notifications read `hasPendingInteraction` from the database
instead of reporting `false` whenever one card settles. Ask User
Question no longer tells the model that only one prompt can be open.
- **App**: `ThreadPendingInteractionBanners` renders every open card
oldest first. The oldest starts expanded and the rest start collapsed.
When the cards above a collapsed card settle, it becomes the oldest and
expands (`PendingInteractionShell` takes `expandedByDefault`).
- **Rebase onto get-bb#4915 (approvals open by default)**: get-bb#4915 removed the
shell's expand prop so every card always opens. This branch needs the
prop back to collapse every card except the oldest. I resolved this by
applying one rule to every kind: the oldest card opens, approvals
included, and later cards start collapsed. With one pending card, the
behavior is identical to get-bb#4915.

No `HOST_DAEMON_PROTOCOL_VERSION` change: async questions travel as
Codex extension state over the existing extension event, and
`hasPendingInteraction` is a field that already exists on the
server-to-app notification.

## How you verified

- `pnpm exec turbo run typecheck lint test --filter=@bb/app
--filter=@bb/server --filter=@bb/db --filter=bb-plugin-provider-codex
--filter=bb-plugin-ask-user-question` after rebasing onto current main:
20 of 21 tasks passed. The one failure was `PluginIcon.test.tsx` reading
a stale, ignored `plugins/navigation/` build-output directory in this
worktree. After deleting that directory the file passes (8/8).
- New tests: `async-questions.test.ts` (asks once and sends the answer
as a message; opens every question without waiting for earlier answers;
dismissal sends nothing; ignores other providers),
`delta-translation.test.ts` (async question recorded as Codex extension
state; none for a synchronous `agentMessage`),
`pending-interactions.test.ts` (a provider approval keeps blocking
alongside open plugin cards), and
`ThreadPendingInteractionBanner.test.tsx` (the next card expands once
the cards above it are answered).

Fixes get-bb#4990

> AGENT GENERATED

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: qa <qa@x>
Co-authored-by: Claude Opus 5.5 <[email protected]>
…thread menu actions (get-bb#5243)

## Human comments

## What was wrong

Core's thread header menu
(`apps/app/src/components/thread/ThreadActionsMenu.tsx`) and the
thread-list plugin's row menus
(`plugins/thread-list/app/rows/ThreadActionsMenu.tsx`) each hardcoded
the same eight actions, so the two drifted and no plugin could add an
entry. Earlier registry attempts paid for it per sidebar row: hooks per
row (about 40 observers per row on a 100-row sidebar) or a server-side
resolve with round trips and stale labels. This is step 1 of the thread
action registry plan: a registry whose cost scales with the number of
registered actions, never with rows. It supersedes get-bb#5145.

## What changed

**API (`@get-bb/plugin-sdk/app`, SDK 0.6.34, all experimental and listed
in `docs/api_to_audit.md`)**

- `app.slots.experimental_threadAction({ id, title, icon, group, order?,
useData?, item })`. `useData` is a hook the host runs once for the whole
app, in one collector per registration under `ThreadActionsProvider`.
`item({ thread, data, sdk, navigate })` is pure and returns the action
for one thread, or null. Placement (`group`, `order`) is static. The
host keeps registrations sorted by group string, then order, then
registration order, and menus put a separator between groups. bb's
groups are `experimental_THREAD_ACTION_GROUPS` (`1_open`, `2_organize`,
`3_settings`, `4_lifecycle`).
- An action is `{ label, icon, variant?, disabled?, choices?, run({
value, requestRename }) }`. `choices` is data: a submenu on desktop, a
drawer step at compact width, a popover from a row quick-action button.
- `experimental_useThreadActions(thread, { keys?, requestRename? })`
returns entries whose `run(value?)` is already bound to the caller's
rename editor, never throws, and resolves when the action settles.
`experimental_useThreadActionRegistrations()` lists every registration's
static title and icon in menu order.
- `experimental_ThreadActionsMenu` and
`experimental_ThreadActionsContextMenu` are bb's menus. The context menu
opens on right-click, and on long-press at compact width. Both take
`inline` items (`{ key, group, action }`) and `requestRename`. `trigger`
is a render function that must spread `PluginThreadActionsTriggerProps`
(props, ref, className) onto its button. The host logs a trigger that
drops them, and the SDK test fake throws.
- `useBbNavigate().toThread(id, { split })` and `toCompose({ projectId,
placement, environmentId, hostId, … })`.
`experimental_useArchiveEnvironmentThreads()` returns core's own
environment-archive flow.
- The bound SDK gains optimistic `threads.markRead` / `markUnread`.
- `experimental_useSidebarThreadActions`, `PluginSidebarThreadActions`,
and the testing harness's `SidebarActionCall` /
`inspection.sidebarActionCalls` are tagged `@internal`, like
`useComposerView`: they are gone from the published declarations, so
upgrading plugins get type errors, while the runtime keeps exporting the
hook, so installed plugins and host builds of plugins that still import
it keep working. Nothing in the repo calls it.
- Archive, Delete, and bb's rename dialog fetch a thread bb has not
cached (a plugin rendering the menu for a thread it fetched itself)
instead of doing nothing. A registration's `navigate.openThreadPanel`
opens in the focused thread view, as plugin commands do.

**Core.** bb's eight actions (Open in split, New thread in environment,
Copy thread link, Mark read/unread, Pin/Unpin, Rename,
Archive/Unarchive, Delete) are registrations of the public shape under
the reserved `bb--core` owner (`apps/app/src/lib/thread-actions/`). The
header menu, mobile recents, both sidebar row menus, and the archive
keyboard command all go through the registry. The header edits its title
inline from the menu and from the rename command. Core's
`ThreadSectionMoveProvider`, `useMoveThreadToSection`, and
`useUnpinAndMoveThread` are deleted.

**Thread list.** It registers Move to section (`thread-list/move`) from
its own section-order and organization preferences. Rows render the host
menus with a "Customize row actions" inline item and the row's inline
rename. Hover quick actions come from `experimental_useThreadActions`
with `keys`, and the picker lists registrations. `rowActions` stores
`<owner>/<id>` keys; bare legacy ids and `core/<id>` migrate on read and
write. The row-action model, the section-move provider, and the plugin's
menu fork are deleted.

**Also fixed:** a pre-existing race when archiving an environment while
one of its threads was in a split beside an unrelated thread. The split
area's stale-pane watcher could prune the archived pane before the
provider ran, and the provider then navigated away from a stale route,
closing the unrelated pane (7/7 on main). The environment archive now
runs as an `archive_thread` mutation like thread archive, so the watcher
waits and the provider closes panes deterministically.

No server or daemon wire changes. Docs: `docs/api_to_audit.md`,
`docs/configuration.md`, the thread-list skill, the plugin-authoring
references, and the Plugin Guide surface.

**Accepted deviations from main** (all accepted by Michael):

1. The header menu's Rename edits inline on desktop, as does the rename
keyboard command (the dialog remains at compact width).
2. Open in split is hidden for the thread in view and reads "Focus
split" for a thread open in another split pane, on every surface.
3. The row-actions picker lists every registration, which adds Delete
and New thread in environment.
4. Mobile recents long-press gains New thread in environment.
5. Row quick-action buttons are labelled with the action label
(`Archive`, `Unarchive`), not `Archive thread` / `Unarchive thread`.
6. A failed sidebar inline rename shows its error in the editor, without
the extra toast.
7. A failed drag-to-pin toasts the drop's failure message instead of
"Failed to pin thread.".
8. Phone thread-menu drawers are announced as "Thread actions" instead
of "Menu".

## How you verified

- One contract test table
(`apps/app/src/components/thread/ThreadActionsMenu.test.tsx`) runs four
surfaces against the same registrations: desktop dropdown, desktop
context menu, compact drawer, and compact long press. It checks items
and order per thread state (top-level, archived, pinned, unread child,
already in view, compact), each action's effect, the surface rename
editor versus bb's dialog, a throwing registration, a trigger that drops
its ref or classes, and registration order.
- Thread-list tests cover quick actions, Customize, inline rename from
both menus, Move destinations and the unpin-then-move writes, and the
`rowActions` migration. SDK harness tests cover the fake menu's trigger
contract.
- `SplitThreadArea.environment-archive.test.tsx` resolves the archive at
the moment a pane is pruned. It failed 3/3 before the fix and passes
after.
- `pnpm exec turbo run typecheck lint test --filter=@bb/app
--filter=@get-bb/plugin-sdk --filter=./plugins/thread-list
--filter=./plugins/plugin-api-docs --filter=@bb/server` passes (lint: 0
errors). In the gate run, three `install-machine-script` server tests
failed while a `pnpm install` ran alongside; the server suite passes
alone (3398). `turbo run typecheck --filter='...[2511116]'` (89
packages) and all plugin test suites (46 tasks) pass.
- Manual verification in two rounds on a dev instance against main:
thr_c6z735wvsd and thr_paxegndau4. The second round passed:
  - Row "..." on desktop and on archived rows, items identical to main.
  - Keyboard open, focus, and Escape.
  - Trigger accessibility attributes match main.
  - Narrow-width drawer with the Move step.
  - Picker order with Move between Pin and Rename.
  - Environment-group archive with Undo.
- Legacy `rowActions` values restored, and UI and CLI writes persist the
new keys.
  
Its findings (the trigger's lost `select-none` and the split race) are
fixed here.

Sidebar benchmark (`BB_SIDEBAR_BENCH=1`, 3,000 threads, 81 rendered
rows; median of 8 alternating runs). The branch's bench mounts core's
collectors and the thread-list Move registration as the app does:

| metric | main 2511116 | this branch |
|---|---|---|
| mountMs | 481 | 467.5 |
| statusPatchMs | 145 | 139.5 |
| membershipRefetchMs | 118 | 97.5 |
| pinMs | 152.5 | 148 |
| React Query observers | 1146 | 821 |
| observers per rendered row | 14.15 | 10.14 |

🤖 Generated with [Claude Code](https://claude.com/claude-code)

> AGENT GENERATED

---------

Co-authored-by: Claude Fable 5.1 <[email protected]>
Co-authored-by: qa <qa@x>
…get-bb#5257)

## Human comments

## What was wrong

Every send on a warm thread repeated workspace-context RPCs, skill-file
reads and hashing, and skill-store cleanup before the provider could
start. This added avoidable latency, especially when the execution host
was remote.

## What changed

- Add optional turn traces across server preparation, daemon submission,
and first-output delivery, gated by the existing performance-diagnostics
startup permission and experiment. Document the trace fields and
limitations in the debugging guide.
- Add `host.read_workspace_agent_context { rootPath, sharedSkillRoots }`
to gather workspace instructions, project skill files, and shared skill
discovery in one daemon round trip. The server retains instruction
assembly and skill-selection policy. This reduces requests, not
file-content payloads: workspace instructions and project SKILL.md
contents still return to the server every turn.
- Memoize immutable, content-addressed skill trees and file hashes in
the daemon. Mutable host-local trees are freshly read each turn: file
metadata alone cannot reliably detect rapid edits on Linux. The bounded,
process-local cache is shared across threads. Schedule skill-store
garbage collection without awaiting it on the turn path and coalesce
pending cleanup requests.
- Advance `HOST_DAEMON_PROTOCOL_VERSION` from 230 to 232 for the trace
fields and new RPC. Bump the plugin SDK package to 0.6.34 because its
generated declarations include the updated daemon contract. No database
or thread/session lifecycle changes.

Workspace context remains freshly read each turn. Watcher-based caching
was dropped because delayed change events could let a queued follow-up
miss a file edit. Resume-context deduplication was also dropped because
measurements showed little benefit. Oversized project SKILL.md files
above the old 25 MiB transport cap now receive the same skip-and-warn
treatment as other files over the 10 MiB project skill limit, instead of
failing the send.

## How you verified

- `pnpm exec turbo run typecheck --filter=@bb/server
--filter=@bb/host-daemon --filter=@bb/host-daemon-contract` passed
(Turbo cache hits).
- `pnpm exec turbo run test --filter=@bb/server --filter=@bb/host-daemon
--filter=@bb/host-daemon-contract -- <changed test paths>` passed: 149
server tests, 112 daemon tests (2 skipped), and 49 contract tests across
18 files. Coverage includes trace gating/joining, workspace discovery,
skill reuse, in-place edits with unchanged size and mtime, dispatch, and
runtime configuration.
- CI follow-up: the existing in-place-edit test exposed stale
metadata-cache reuse on Linux. Removed that unsafe cache without
weakening the test. Focused skill staging/install tests passed locally:
27 passed, 2 skipped. The npm publication guard passes with SDK 0.6.34.
- `git diff --check origin/main...HEAD` passed.

Recorded implementation benchmarks used an instant echo provider, six
project skills, workspace instructions, and 20 warm follow-ups per host.
The remote daemon ran on an Intel Mac over a tailnet SSH reverse tunnel.
These measure BB overhead; network jitter affects remote comparisons.
Benchmarks were recorded during implementation and were not rerun while
preparing this PR. These figures predate the CI correction that removed
metadata-based caching for mutable host files, so they do not establish
performance for the final revision. New-thread startup was not measured.

| Median measurement | Before | After |
| --- | ---: | ---: |
| Pre-submit RPC count | 8 | 1 |
| Local skill staging | 19.5 ms | 0.9 ms |
| Remote skill staging | 53.2 ms | 5.3 ms |
| Local send to first output notified | 42.7 ms | 22.6 ms |
| Remote send to first output notified | 231.2 ms | 107.7 ms |

> AGENT GENERATED

---------

Co-authored-by: qa <qa@x>
Co-authored-by: Claude Opus 5.5 <[email protected]>
The plugin SDK's runtime draft schema did not list the attachment mention
kind, so composer.replace threw "Invalid composer draft" whenever the draft
held an attachment mention. That broke plugins writing back a draft they had
read, including Prompt Library restoring a saved prompt into an empty
composer.

Clicking an attachment mention in the composer opened the file from the
current project, while the attachment pill uses the attachment's source
project. A draft attachment recalled from another project therefore failed
to preview. The prompt box now resolves attachment mentions against the
draft's own attachments, through the same opener and project rule as the
pill. Sent-message history keeps resolving through the thread view, and the
root compose view's now-unreachable attachment branch is removed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
## Human comments

## What was wrong

On wide Android windows (tablets, an unfolded Galaxy Fold), Chromium
opens a native `<select>` as a dropdown anchored to a child view it adds
to the WebView (`dropdown_popup_window`). React Native drops layout
requests from views it did not create, so that anchor never leaves
`0,0`. The option list then opens at the top-left of the WebView, under
the status bar, instead of next to the field. Phones use the centered
picker dialog, which needs no anchor. This is
[react-native-webview#3424](react-native-webview/react-native-webview#3424),
still unfixed upstream as of v16.0.0.

## What changed

`patches/[email protected]`: `RNCWebView` overrides
`requestLayout()`. When a child asks for layout, it posts one pass that
measures and lays out the WebView at its current size. That lets the
WebView place its own children, so the anchor lands on the field. The
override checks for its field because the WebView constructor calls
`requestLayout()` before field initializers run. `pnpm-lock.yaml` only
updates the patch hash.

No other behavior changes. The pass keeps the WebView's React Native
size: it measures with its current width and height and lays out at its
current bounds.

## How you verified

- Built `apps/mobile` (`pnpm build:android:dev`) at `main` and at this
branch. Ran both on an Android 16 emulator (WebView 133) against `pnpm
start:worktree` on a clean data dir, with a minimal plugin page that has
a native `<select>` (repro in get-bb#5249).
- Unfolded-Fold-sized window (`wm size 1856x2160`, `wm density 420`):
- Before: list at the top of the screen. `dumpsys activity top` shows
the anchor at `0,0-0,0` with a pending layout.
- After: list anchored to the field. The anchor is at
`63,1183-1407,1285`. Picking an option updates the field.
- Phone-sized window: the centered picker dialog is unchanged.
- Checked that the fix is in the build under test: the
`measureAndLayoutChildren` symbol is in the after build's dex and not in
the before build's.
- Not run: the JS test suites, because this change is Java only. Not
tested on a physical device yet.

![Before and after on an unfolded-Fold-sized
window](https://raw.githubusercontent.com/Willhong/bb/refs/heads/assets/android-select-dropdown/compare-fold.png)

Fixes get-bb#5249

> AGENT GENERATED
# Conflicts:
#	apps/app/src/views/RootComposeView.tsx
#	packages/host-daemon-contract/src/protocol.ts
#	packages/host-daemon-contract/test/contract.test.ts
ComposerMention gained the attachment variant, so plugins that read or write
attachment mentions need a host at 0.6.35 or later.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
ymichael pushed a commit to get-bb/bb that referenced this pull request Oct 9, 2026
## Human comments



## What was wrong

Large clipboard text stayed inline in the composer, so users had to save
it to a file and attach it by hand to keep their request and history
readable ([#4910](#4910) proposes
converting it automatically, as Codex Desktop does). Working on this
also exposed related attachment problems:

- Every turn staged attachments into one flat `Attachments/` directory,
so a later file with the same name overwrote an earlier turn's file. An
agent going back to an earlier message read the wrong contents.
- Attachments were not part of editor undo history.
- Uploading non-image files jumped between pill rows.
- File attachments opened as raw browser tabs.

## What changed

The first version of this PR built a dedicated pasted-text pipeline: an
upload manager, IndexedDB recovery, a retry/insert card, draft
`pastedText` state, and provider prompt changes. It has been
**replaced** by a much smaller design on top of the existing attachment
path (about 2,200 lines removed).

- **Large paste becomes an attachment.** Plain text of 5,000+ characters
becomes a `Pasted text.txt` file handed to the existing `attachFiles`
path. A clipboard that also carries files keeps main's behavior, so
large text beside an image is no longer dropped.
- **Unique names within a draft.** Every attachment gets a name unique
within its draft (`notes 2.txt`, `Pasted text 2.txt`).
- **Original names in history.** `localFileDetails` (path, name,
nullable size) is now a required timeline field, so history and the
just-sent optimistic row show the original name instead of the stored
path.
- **Staging no longer overwrites earlier turns**
(`apps/host-daemon/src/command-handlers/prompt-attachments.ts`).
- Files are created exclusively. Identical bytes reuse the existing
file; different bytes get the next `-N` suffix.
  - Cleanup after a failure only removes files that attempt created.
- **Undo/redo.** Paste, drop, the + button, and removing a pill record
an editor history step. Redo does not upload again, and a removed pill
returns to its original position. Undoing a large paste first turns the
pill back into the inline text, then removes the paste.
- **Upload pills stay put.** Uploading non-image files render in the
file row with the finished pill's size, so the composer no longer jumps
when an upload finishes.
- **Attachment viewer.** Clicking a file pill in the composer or in
history opens a new `attachment-file-preview` panel tab (or the drawer
on compact layouts). The tab persists through local tab state and the
thread-tabs contract. HTML attachments render as source. Surfaces
without a panel keep the new-tab link.
- **@-mention attachments.** A bare `@` lists the draft's non-image
attachments. Picking one inserts an attachment mention pill that opens
the file from the attachment's own project.
- Codex and Pi now name attached files, as Claude Code and ACP already
do, so agents can match a mention to its file.
- A mention whose attachment was removed before sending is sent as plain
text.
- The plugin SDK's runtime draft schema accepts the new mention kind, so
`composer.replace` (for example Prompt Library restoring a saved prompt)
no longer throws.
- **Wire and SDK changes.**
- `HOST_DAEMON_PROTOCOL_VERSION` 232 → **233**, because the daemon
validates the new `attachment` prompt mention kind.
- `@get-bb/plugin-sdk` 0.6.34 → **0.6.35** for the `ComposerMention`
attachment variant, recorded in `docs/api_to_audit.md`.
- Merged `origin/main` at `d933fc2757`.

## How you verified

On the merged tree:

- `pnpm exec turbo run typecheck lint --filter='...[origin/main]'`:
133/133 tasks pass. Two plugin typechecks needed `pnpm install` for
dependencies added on main.
- `pnpm exec turbo run test` for every changed package (`@bb/app`,
`@bb/client-core`, `@bb/demo-server`, `@bb/domain`, `@bb/host-daemon`,
`@bb/host-daemon-contract`, `@bb/server`, `@bb/server-contract`,
`@bb/thread-view`, `@get-bb/plugin-sdk`, prompt-library, provider-codex,
provider-pi): 25/25 tasks pass, including 5,617 `@bb/app` tests.
- One local `PluginIcon` failure came from untracked build output of the
removed navigation plugin left in the worktree. It passes once that is
moved aside.
- `node .github/workflows/check-plugin-sdk-version.mjs` passes.
- Tests that fail before the fix and pass after:
- `plugin-composer-handle.test.ts` exercises attachment mentions through
restore and quote for both core and plugin callers. Without the schema
fix, 4 tests fail with "Invalid composer draft".
- `PromptBoxInternal.test.tsx` opens a mention of an attachment from
another project from that project. It fails against the old resolver.
- `apps/host-daemon/test/command/thread-dispatch.test.ts` covers
same-name staging across turns, reuse of identical bytes, and failure
cleanup.
- Manual check on a worktree build: in a seeded thread, two turns each
attached a different `notes.txt`, and the agent re-read the first turn's
file correctly. On the same machine, uploads already have unique stored
paths, so the daemon collision path is covered by the unit test rather
than this run.
- Not verified: a full turn on a remote enrolled host, native mobile
clipboard events, and live non-Codex providers.

**Feature approval:** Sawyer approved opening this upstream PR in the
Discord `#contributors` thread on 2026-10-07. `aotd1` is in the approved
contributor list. The original prototype and review history are in
[aotd1#3](aotd1#3).

Fixes #4910

> AGENT GENERATED

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Alexey Ashurok <[email protected]>
Co-authored-by: qa <qa@x>
Co-authored-by: Claude Opus 5.5 <[email protected]>
aotd1 pushed a commit that referenced this pull request Nov 2, 2026
## Human comments

## What was wrong

Several cache owners wrote a server reply or the thread-detail bootstrap
straight into the React Query cache with `setQueryData` while a fetch of
the same key could still be in flight. React Query writes fetch results
without checking whether they're older than what's cached (query-core
`query.ts`), so the older fetch landed last and put stale data back.
Effects included: an environment or host status that stayed stale after
opening a thread, a plugin settings form resetting its draft to the old
value, a cancelled plugin install flipping back to running, new plugin
update jobs dropping out of the list, an `idle` app update phase
switching off the progress poll, and the AI service selection flickering
back. These are items #2–get-bb#10 from the direct cache write audit
(@thread:thr_fjr5x8dzaz). #1 (thread tabs) is fixed separately in get-bb#6611.

## What changed

Two fixes, depending on whether the data has a version field:

- **Environment and Host keep the newer copy by `updatedAt`** (#2, #3,
get-bb#10). The bootstrap ingest (`thread-detail-cache-owner.ts`), the rename
reply (`applyEnvironmentUpdateResult`), and the
`useEnvironment`/`useHosts` fetches all compare `updatedAt`. The
fetch-side check is what catches a fetch that started before the write
and lands after it. To make it testable, those fetches now live in
`environmentQueryOptions` and `hostsQueryOptions`. Host `status` comes
from live daemon sessions and a disconnect doesn't change `updatedAt`,
so on a tie the cached copy wins over the bootstrap. The bootstrap only
fills an empty cache or replaces strictly older data. Rename replies and
fetch results still win ties.
- **`setQueryDataOverInFlightFetch`** (`cache-effect-utils.ts`) for data
with no version (get-bb#4–get-bb#9): it writes the value, and if a fetch of the key
is in flight it cancels that fetch (the cache keeps the written value)
and refetches. With nothing in flight it's a plain write. Used by
`applyPluginSettingsView`, `applyPluginInstallJob`,
`applyPluginUpdateJob`, `hydrateAppUpdateStatus`,
`hydrateSystemVersionCache` and `writeCachedAiServices`, so every caller
gets the fix. Where the audit suggested an unconditional
cancel-write-invalidate (get-bb#7) or a cancel before the write (get-bb#8, get-bb#9), this
helper refetches only when a fetch was actually in flight. That avoids
an extra request on every write. Forced version and app-update checks
update the server's cache, so the trailing unforced refetch returns the
forced result.

No wire, CLI or plugin API changes.

Not covered here: audit items get-bb#11 (plugin safe mode) and get-bb#12 (prompt
history), both low risk. Also not covered: a lint rule restricting
direct `setQueryData` calls to the helper, which would stop new call
sites from bringing the race back.

## How you verified

- New tests use real `QueryClient`/`QueryObserver` instances: start a
fetch that resolves late with older data, do the write, let the fetch
land, then check that the newer value survives (and, for the helper,
that the trailing refetch runs).
- `thread-detail-cache-owner.test.ts` (new): late environment and
host-list fetches after a bootstrap, an older bootstrap over a newer
cache, and the equal-`updatedAt` host status case.
- `environment-workspace-cache-owner.test.ts`: a late environment fetch
after a rename, and an older rename reply over a newer cache.
- `in-flight-fetch-writes.test.ts` (new): one row per cache-owner write
for get-bb#4–get-bb#9, plus helper tests for the no-fetch case (no extra request)
and a fetch of an unobserved query.
- With each source change reverted, every race test failed on the stale
data and passed once the fix was restored.
- `pnpm exec turbo run typecheck lint test --filter=@bb/app`: passed
(647 files, 6515 tests; 0 lint errors, no new warnings). After rebasing
onto `0472409243` I re-ran the three changed test files (21 tests
passed).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

> AGENT GENERATED

---------

Co-authored-by: Claude Opus 5.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.