Repository navigation
Conversation
The "Show all events" toggle for manager threads had no visible effect because the default view only excluded 3 noise event types. Now the default view shows only user messages, message_user output, and lifecycle operations (provisioning). Internal events (assistant text, tool calls, delegations) are hidden until the toggle is enabled. Also fixes the manager welcome message showing as a user message by correcting its initiator from "user" to "system", matching all other system-initiated manager messages. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
…read state The timeline auto-expand logic only considered threadStatus === "active", so during provisioning (threadStatus === "provisioning") the last row was never auto-expanded. This caused the provisioning row to start collapsed, then briefly expand when the thread transitioned to active, then collapse again when the first assistant message arrived — a jarring oscillation. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Thread storage: - Add threadStoragePath to thread.start command so daemon creates the per-thread storage directory before the manager agent starts - Add thread.deleted command so daemon removes the directory when a thread is hard-deleted via finalizeStoppedThread - Return empty results from host.list_files for missing paths instead of throwing ENOENT - Path traversal protection via requireConfinedPath guard on both creation and deletion paths Thread deletion linearization: - All thread deletion now follows a single canonical path: tombstone via markThreadDeleted, request stop if needed, then finalize via finalizeStoppedThread (which is the sole hard-delete point) - Remove duplicated hard-delete sequences from DELETE route, reconciliation, project deletion, and provision result handler - Extract requestThreadStopIfNeeded to shared lifecycle module - deleteThread (lifecycle) and queueThreadDeletedCommand now have exactly one call site each (finalizeStoppedThread) Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
SawyerHood
added a commit
that referenced
this pull request
Aug 19, 2026
## What was wrong
The host daemon is supposed to keep the native `@parcel/watcher` addon
out of the parent process (parcel runs in a forked child). The
in-process fallback in
`packages/host-watcher/src/parcel-watcher-backend.ts` reached the addon
through `await import("./real-parcel-watcher.js")`. esbuild inlines a
dynamic import of an internal module and hoists that module's static
`import parcelWatcher from "@parcel/watcher"` to the top level of
`dist/daemon-bundle.mjs`. The daemon therefore loaded `watcher.node`
(built with `NAPI_DISABLE_CPP_EXCEPTIONS`) before `pty.node`
(`NAPI_CPP_EXCEPTIONS`) at startup. On macOS, dyld coalesces the
identical weak `Napi::details::CallbackData<...>::Wrapper` symbol across
images to watcher.node's try/catch-less copy. When `PtyFork` throws
`Napi::Error` on a failed spawn, nothing catches it, `std::terminate`
runs, and the app dies with SIGABRT.
Issue: #1873. Investigation report:
https://get-bb.github.io/reports/issues/1873.html
## What changed
- `packages/host-watcher/src/parcel-watcher-backend.ts`: the in-process
fallback now does `const { default: parcelWatcher } = await
import("@parcel/watcher")`. A dynamic import of the external package
stays a real `import("@parcel/watcher")` in the esbuild ESM bundle, so
`watcher.node` loads only when a watcher is needed in-process.
- `packages/host-watcher/src/real-parcel-watcher.ts`: kept for the
forked watcher child entry; its comment now explains why daemon-bundle
code must not dynamically import it.
- `apps/host-daemon/test/parcel-watcher-not-loaded-in-parent.test.ts`
(new): bundles `@bb/host-watcher` with the daemon bundle's esbuild
settings, then asserts (1) the output has no static top-level
`@parcel/watcher` import and still has a dynamic
`import("@parcel/watcher")`, and (2) importing that bundle in a child
`node` with a `process.dlopen` hook loads no `@parcel/watcher` addon.
No wire shapes changed, so `HOST_DAEMON_PROTOCOL_VERSION` was not
bumped. No CLI/guide/doc surfaces are affected.
## How you verified
**The new test fails before the fix** (both assertions, for the right
reason):
```
❯ @bb/host-daemon test/parcel-watcher-not-loaded-in-parent.test.ts (2 tests | 2 failed) 175ms
× does not hoist a static import of @parcel/watcher 36ms
× does not dlopen a @parcel/watcher addon when the bundle is imported 137ms
AssertionError: static top-level import(s) of @parcel/watcher found in the bundle; watcher.node would load at daemon startup:
import parcelWatcher from "@parcel/watcher";: expected [ Array(1) ] to be null
AssertionError: @parcel/watcher addon loaded on import:
[dlopen] <repo>/node_modules/.pnpm/@parcel[email protected]/node_modules/@parcel/watcher-linux-x64-glibc/watcher.node: expected [ Array(1) ] to deeply equal []
```
**After the fix:**
```
Test Files 1 passed (1)
Tests 2 passed (2)
```
**Real daemon bundle, rebuilt with the fix** (`pnpm exec turbo run build
--filter=@bb/host-daemon`), then run with the report's `process.dlopen`
logger and `NODE_PATH` unset:
```
$ grep -c 'from"@parcel/watcher"' dist/daemon-bundle.mjs
0
$ node --require log-dlopen.cjs dist/daemon-bundle.mjs --definitely-not-a-flag
[dlopen #1] <repo>/node_modules/.pnpm/[email protected]/node_modules/node-pty/build/Release/pty.node
[exit] code=1 addons loaded=1
```
Before the fix the same bundle contained `import VYr
from"@parcel/watcher"` and the report's
`daemon-bundle-addon-load-order.log` shows `watcher.node` as dlopen #1
and `pty.node` as #2.
**Package suites and typecheck:** `pnpm exec turbo run test typecheck
--filter=@bb/host-daemon --filter=@bb/host-watcher --force` → 5/5 tasks
successful; `@bb/host-watcher` 45 tests passed, `@bb/host-daemon` 585
tests passed.
**macOS was not re-run.** This was verified on Linux only. On Linux the
symptom differs (the report shows the same symbol coalescing produces a
SIGSEGV analog under `RTLD_GLOBAL`, and Node's default `RTLD_LOCAL`
dlopen avoids it), so the macOS SIGABRT itself was not reproduced here.
The fix is still correct because the crash requires `watcher.node` to be
resident in the daemon process before `pty.node` loads, and the root
cause of that is the static import in the bundle. The test and the
dlopen log above show that with this change the daemon process loads no
`@parcel/watcher` addon at startup, so dyld has no watcher.node copy of
the `Wrapper` symbol to coalesce with when node-pty's image loads;
node-pty then uses its own exception-aware copy, which catches the
`Napi::Error` as intended. The forked watcher child
(`bb-parcel-watcher-child.mjs`) still loads `watcher.node`, which is the
intended isolation.
Fixes #1873
> AGENT GENERATED: by Claude Opus 5
---------
Co-authored-by: Claude <[email protected]>
SawyerHood
added a commit
that referenced
this pull request
Sep 30, 2026
## Human comments ## What was wrong bb cloud (the `bb-ai` plugin, #4254) only served thread titles and commit messages. Voice input had no hosted option, so a bb without a Codex login had no microphone. The plan left voice as phase 2 (`plans/bb-account-and-hosted-generation.md`, Part 8). The bb side already had everything voice needs: the plugin SDK's `transcribe` hook, the Voice input row in Settings → AI services, the server's transcribe route, `bb voice transcribe`, and the mic's readiness check. The missing pieces were a hosted endpoint and bb-ai implementing `transcribe`. ## What changed - **bb-ai-gateway** (`apps/ai-gateway`): new `POST /api/ai/v1/transcribe`. - Takes `{audio, format, hint}` with base64 audio, capped at 10 MB, and forwards it to OpenRouter's `POST /api/v1/audio/transcriptions` with `provider: {zdr: true, data_collection: "deny"}`. - Metering is shared with `/complete` through one `handleMetered` path: the same auth, rate limit, daily budget and request log. Transcription reserves 2¢ per call and settles to the reported cost. - `AI_TRANSCRIBE_MODELS` (new, required var, set in `wrangler.jsonc` for production and staging) lists the models in order. OpenRouter's transcription endpoint has no `models` fallback, so the gateway moves to the next model when one answers with an HTTP error, all within an 8 s deadline. It never retries after a timeout. - The vocabulary `hint` goes to `provider.options.groq.prompt`, the only hint option OpenRouter documents. - Default models: `microsoft/mai-transcribe-2`, then `openai/whisper-large-v3-turbo`. Both have ZDR endpoints. - **bb-account**: `bb-account.v1.fetch` accepts request bodies up to 16 MB instead of 1 MB, since base64 recordings didn't fit. Responses stay capped at 1 MB. - **bb-ai**: registers `transcribe`. - It sends the recording through `bb-account.v1.fetch` with a 10 s timeout. - It maps the MIME type or file extension to an OpenRouter format, so Chrome's `audio/webm;codecs=opus` becomes `webm` and Safari's `audio/mp4` becomes `m4a`. - It refuses recordings over 10 MB or in unknown formats without contacting getbb.app. - The opt-in, sign-in and used-up-budget checks are shared with `complete`. - bb cloud now appears for Voice input, and Automatic tries Codex, then bb cloud. - **Copy and docs**: `bb ai` help, the plugin README, overview and skill, `docs/configuration.md`, and the verify-bb feature map now cover voice input and say recordings are never stored. (Merged with #4522, which made bb cloud on by default and removed its settings page and disclosure, and #4525, which deleted the plan doc. The model comparison that was going into the plan is below.) **Model choice** (OpenRouter transcription models with ZDR endpoints, 2026-09-29): `microsoft/mai-transcribe-2` (Azure, about $0.0017/min at a launch price that ends 2026-12-31, #1 on FLEURS and #2 on Artificial Analysis's word-error-rate board), `openai/whisper-large-v3-turbo` (Groq/DeepInfra, $0.0002–0.0007/min, takes a vocabulary prompt on Groq), and Voxtral Mini Transcribe, Deepgram Nova-3 and AssemblyAI Universal-3.5 Pro. `openai/gpt-transcribe`, `google/gemini-3.5-transcribe` and `x-ai/grok-stt-1.0` have no ZDR endpoint. - **Stale docs from #4522**: the `bb-cloud-ai` skill, plugin overview, README, `docs/configuration.md` and the verify-bb feature map still described the removed opt-in and settings page. They now say bb cloud is on by default once you sign in, `bb ai off` turns it off, and disabling the plugin also stops it. The skill also covers voice input: accepted formats, the 10 MB limit, the 10 s timeout, and `bb voice transcribe`. No server, daemon or SDK changes. No `HOST_DAEMON_PROTOCOL_VERSION` bump. **Known issue, not addressed here:** through OpenRouter, MAI-Transcribe 2 answers 400 for WebM and MP4 audio but accepts the same speech as Ogg or MP3. Chrome and Safari recordings therefore get transcribed by Whisper after one refused MAI call. The follow-up is either to put Whisper first in `AI_TRANSCRIBE_MODELS` (config only) or to convert recordings to Ogg before upload. ## How you verified - `pnpm exec turbo run typecheck test lint --filter=@bb/ai-gateway --filter=bb-plugin-bb-ai --filter=bb-plugin-bb-account`: pass (gateway 32 tests, bb-ai 28, bb-account 59). - New gateway tests cover: - the exact OpenRouter request, including ZDR and the Groq hint, and the metering and request log, which never contains audio or text; - falling back on an HTTP error but not on a timeout; - charging nothing when every model refuses; - input validation (base64, the 10 MB cap, format, hint size); - the 2¢ reserve, so a nearly spent budget still allows a title but not a recording; - 401 without a credential; - a Miniflare test that sends a 4 MB body through the real Workers runtime and D1. - New bb-ai tests cover the fetch payload and timeout, refusals that send nothing (off, too large, unknown format), budget exhaustion from a transcription answer, and MIME/extension mapping. - Local end to end against real OpenRouter (`pnpm cloud:dev` with a key, plus `pnpm dev` signed in to a local account, `bb ai on`, and `bb settings ai-services set voice bb`): - `bb voice transcribe` on WebM, MP3 and M4A clips returned correct transcripts in 1.0–1.6 s. The gateway log showed MAI answering MP3 and Whisper answering WebM and M4A. - `bb ai usage` counted the requests. - After merging `main`: typecheck, test and lint pass again (bb-ai 24 tests, gateway 32, bb-account 59). - Recording with the mic in the app worked. ## Rollout Deploy the gateway (**Deploy AI Gateway**) before releasing bb-ai. A released bb-ai against an old gateway would show the mic and fail every recording with a 404. > AGENT GENERATED 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
brsbl
added a commit
that referenced
this pull request
Oct 5, 2026
## Human comments
## What was wrong
The Plugin Guide only existed inside bb as the `plugin-api-docs` plugin,
so the upcoming plugins blog post had no public page to link to and
couldn't embed it.
## What changed
- **`/plugin-guide` on getbb.app**
(`apps/web/src/routes/plugin-guide.tsx`): renders the Guide's
`ProductMap` straight from `plugins/plugin-api-docs/src`. The current
slide syncs to `?slide=` (replace navigation, so reload and shared links
open the same map). Plugin names in "Used by" link to that plugin's
source on GitHub (`github.com/get-bb/bb/tree/main/plugins/<dir>`), which
exists for every built-in. Their icons come from
`first-party-plugins.json`, or from the plugin's own SVG logo, read
through its manifest's `bb.branding.icon`, for the five built-ins that
ship one. "Copy for agent" copies a self-contained prompt: what to
build, the surface's SDK symbols, the bb-plugin-authoring skill, and a
link back to the slide. The in-app button copies a mention that only
resolves inside bb. The Guide is client-only and lazy-loaded
(`ClientOnly` + `React.lazy`), because its mobile/desktop layout reads
`matchMedia` on first render and would otherwise mismatch on hydration.
- **The plugin stays forkable.** The Guide's three `@/` imports resolve
through the web's existing `@/` alias to modules the web owns. This is
the same contract a fork uses: `@/` means "the host's registry items".
- `apps/web/src/components/ui/icon.tsx` and `switch.tsx` are one-line
re-exports from `@bb/shared-ui` (new workspace dependency of `@bb/web`).
- `@/lib/utils` already exists in the web; its `cn` is identical to
shared-ui's (`twMerge(clsx(inputs))`).
- No new alias or shim. A future `@/` import the web lacks fails the web
build rather than resolving to the wrong module.
- `resolveJsonModule` is on for the Guide's JSON fixtures.
- **Theme** (`apps/web/src/components/ui/theme.css`): adds the tokens
the Guide uses, copied from the app theme for light and dark: `muted`,
`timeline-accent`/`file-accent`, `border-hairline`, `border-seam`,
`surface-recessed-solid`, `surface-raised(-solid)`, `sidebar`,
`sidebar-foreground`, `sidebar-accent`, `radius-sm`,
`shadow-xs/md/lift`, `text-2xs`. It also adds `@source` lines for the
Guide and shared-ui's icon/switch. The Guide's stylesheet
(`plugin-guide/plugin-guide.css`) loads only on `/plugin-guide` and on
posts that embed it.
- **Landing CSS can coexist with Tailwind**: `landing.css`'s
`*`/`a`/`code` reset moves into `@layer landing-reset`. Unlayered, it
beat every Tailwind utility (e.g. all `p-*`/`m-*`) on pages that load
both. Pages that load only `landing.css` behave the same.
- **Blog directive** (`apps/web/src/blog/parse-post.ts`,
`post-body.tsx`): a line `component:plugin-guide` or
`component:plugin-guide:<slide-id>` becomes a `{kind:"component",
name:"plugin-guide", slide?}` block. It renders the full carousel
(opening on the app-window "anatomy" slide by default) with an "Open the
full Guide" link. `.post-body` `h2/h3/p/ul/li/li::before/strong/code`
rules now skip `.post-embed` descendants through
`:where(:not(.post-embed *))`. They don't leak into the embed, and their
specificity is unchanged, so existing overrides (lede, ordered lists,
quotes, tweet text) still win.
- **Top-nav Plugins menu** (`apps/web/src/landing/site-chrome.tsx`,
`landing.css`): "Plugins" becomes a dropdown with Marketplace and Plugin
Guide. It uses the same `<details>`/`<summary>` disclosure as the
marketplace category picker. Escape closes it and returns focus;
clicking or tabbing outside closes it. The page you are on is marked
with `aria-current`, and "Plugins" is highlighted on both pages.
- **Discoverability**: a "Plugin Guide" link in the shared site footer,
which appears on the home page, blog, changelog, privacy page,
marketplace and the Guide itself. Also a sitemap entry and a canonical
URL (`https://getbb.app/plugin-guide`, so `?slide=` links count as one
page) for `/plugin-guide`, plus links from `PLUGIN_OVERVIEW.md` and the
`bb-plugin-authoring` skill.
- **Rebuild triggers**: `@bb/web#build`/`#typecheck` inputs and the
`deploy-web.yml` paths now include `plugins/plugin-api-docs/src/**` and
`packages/shared-ui/src/**`.
- **Guide fixture fixes** (`wireframes.tsx`, `product-map.tsx`; also
shown in the in-app Guide):
- Every mobile fixture uses one phone-shaped frame (9:19, same gutter,
390px column), so the slides no longer vary between 362 and 766px tall.
- The + menu, @ typeahead and inline-action popup open from their own
controls, above both the control and its number badge, so neither is
covered.
- On mobile the command palette is a bottom sheet with a drag handle,
matching the app's responsive drawer.
- New-thread actions and the sidebar "Your panel" highlight line up with
their sibling rows.
- The side-panel file tab truncates instead of running into the + and
panel icons.
- On getbb.app, phone-width viewers see only the mobile layout, and the
desktop toggle stays visible but disabled and the slide title and blurb
above the tabs are dropped to save space
(`mobileOnlyOnCompactViewport`). The in-app Guide keeps both its desktop
toggle and its slide header on phones.
- **SDK coverage:**
- Six `*Area.member` names that aren't public exports now use their
importable `PluginBbSdk.*` paths.
- 37 uncovered public exports were added to their cards (for example
`experimental_defineHostEntry`, `defineRpcContract`, `useSettings`,
`BbNavigate.openThreadPanel`, and the testing loaders).
- A new **Provider bridges** backend card covers the `./provider-bridge`
entry points.
- **bb mark in slide titles:** "The bb app window" shows the vector bb
mark (`assets/bb-logo.svg`, inverted in dark mode like the app's
`BbLogo`) instead of italic text. `ProductMap` takes an optional
`brandMark`; without it, the in-app Guide keeps the italic text.
- **Card copy and Used by refresh**
(`plugins/plugin-api-docs/src/surfaces.ts`, `first-party-plugins.json`).
This also changes the in-app Guide.
- **Leads:** every card leads with one of five verbs: **Add** (your UI
inside bb), **Replace** (a bb region or renderer), **Run** (code with no
UI), **Provide** (agents, environments, machines, server access, AI
services) or **Use** (platform building blocks).
- **Length:** each card has 2–4 short bullets that say what a plugin
gets. SDK names and edge-case rules moved out of the visible copy. The
agent reference still carries every symbol. Total copy went from about
6,500 to about 2,000 words.
- **Template test:** `surfaces.test.ts` now enforces the shape: lead
verb, at most 4 bullets, at most 100 characters each, no SDK
identifiers.
- **Used by:** every row was rebuilt from built-in plugin source, and
six missing plugins were added to `first-party-plugins.json`: Agent
Annotations, bb account, BB guide, PDF preview, Theme Preview, Thread
list. Seven surfaces have no built-in user yet, so their row is hidden.
### Screenshots (after; new page)
Card with "Used by" and "Copy for agent" (copied state):

Agent providers card with built-in brand logos:

Top nav, before and after (`/blog`, 1440 wide):
**Before**

**After**

Plugins menu open on `/plugin-guide`:

Mobile (390 wide), before and after:
**Before**

**After**

Dark, on the marketplace:

Slide title with the bb mark, light and dark:


Mobile fixtures, one phone frame each (390 wide):




Desktop app window with "Your panel" hovered (#2) and the truncated file
tab (#14):

The + menu opening from the + button, and the @ typeahead with its badge
above it:


Site footer with the Plugin Guide link:

Plugin backend with a refreshed card:

Desktop, light (1440×900 @2x):

Desktop, dark, with a surface card open showing "Used by" links:

Mobile (390×844 @2x):

Blog post with `component:plugin-guide` (local draft, not committed):

In-app Guide on this branch (dev app), phone width: slide title and
blurb kept, desktop toggle enabled:

In-app Guide on this branch, desktop:

## How you verified
- `pnpm exec turbo run build --filter=@bb/web` passes. The client build
emits the Guide chunks, and the Guide CSS contains the new token
utilities (`bg-sidebar`, `text-2xs`, `border-border-hairline`,
`shadow-lift`, …).
- `bb plugin build plugins/plugin-api-docs` passes, and its `app.js`
still uses the host runtime `experimental_Icon`.
- Branch web app (`vite dev`) driven through `bb browser-automation`,
headless Chrome for Testing, 2× device scale:
- `/plugin-guide` at 1440×900: Guide content renders (7 slides, 68
annotation chips). Clicking a slide tab updates `?slide=composer`,
ArrowRight moves to `?slide=home`, and loading `?slide=settings` opens
"Plugin settings page". A chip opens its card, and "Used by" links point
to each plugin's GitHub source with icons. "Copy for agent" shows
"Copied", and the clipboard receives the self-contained prompt; checked
by stubbing `navigator.clipboard.writeText`. Brand logos render, masked
to the text color, on the Agent providers card.
- Dark scheme via `prefers-color-scheme`: tokens resolve correctly.
- 390×844: mobile slides ("Sidebar" → next → `?slide=app-shell-thread`),
no horizontal overflow.
- Draft post with `component:plugin-guide` and
`component:plugin-guide:composer`: two embeds at the 680px column width,
opening on "The bb app window" and "The composer". Links go to
`/plugin-guide` and `/plugin-guide?slide=composer`. Computed styles show
no `.post-body` leak (Guide `li::before` is `none`, Guide `p` is 13px),
while the post's own list keeps its markers and spacing.
- No console errors or page errors in any of these runs.
- Plugins menu, in Chrome for Testing at 2×: click opens it; outside
click closes it; Enter opens it; Tab reaches Marketplace then Plugin
Guide; Escape closes it and refocuses "Plugins"; tabbing past the last
item closes it. The current page is marked on `/plugin-guide` and
`/marketplace`. Checked at 390 px (panel stays on screen) and in dark
mode. No console errors. On `/`, the open panel paints above the hero's
"New" callout: hit-testing both rows lands on the links, and clicking
Plugin Guide navigates. The header is lifted with `position: relative;
z-index: 10` because its entrance animation fill can trap the panel's
z-index in Safari and Firefox.
- Real Safari 26.5.2 on macOS (safaridriver): home Plugins menu,
`/plugin-guide` desktop (slides, `?slide=`, all three composer menus,
brand icons, Copy for agent), and 390 and 360 widths. Dark mode wasn't
driven in Safari.
- Existing pages are unchanged. On `/`, `/blog`, both posts,
`/changelog`, `/privacy` and `/marketplace`, every element's computed
margin, padding, color, font, line height, decoration, size and
`::before` were captured, then `landing.css`/`blog.css` were swapped in
place for their `origin/main` form (reset unlayered, no embed
exclusion): 0 differences on every page. The same check flagged the lede
and `<ol>` markers on `/privacy` against an earlier revision of this PR,
which the review caught.
- Parser tests in `parse-post.test.ts` (directive with and without
slide; near-misses stay paragraphs) and the sitemap test run in CI.
- In-app Guide, branch dev app (`pnpm dev`, `plugin-api-docs` enabled),
Chrome for Testing at 2×: at 1440×900 the slide header (italic *bb*,
blurb) and toggle are unchanged; at 390×844 the slide title and blurb
still show, the desktop toggle stays enabled, the phone mock fits at
scale 1 and scrolls fully into view, and nothing overflows sideways. The
web keeps the compact header (title `sr-only`) and serves `<link
rel="canonical" href="https://getbb.app/plugin-guide">` in the SSR HTML.
## Follow-ups (P2, not in this PR)
- Close the Plugins menu on Escape after a mouse open. Safari doesn't
focus the summary on click, so the details-scoped key handler doesn't
fire. Use a document keydown listener. (Nav review, 4fa7844)
- Drop Agent Annotations from "Draft prompt highlighting". It only uses
`replace` and `onSubmitted`, never highlighting. (Card review,
1f09afd)
- Reword the app-wide scripts bullet "Clean up automatically when the
window reloads". bb runs the returned disposer on unmount, which also
happens on plugin reload and disable. (Card review)
- Read `.bb` from the default JSON import in the web brand-icon glob, so
a future plugin manifest without `bb` can't break the web build. (Card
review)
- #4936 (draft, stacked on #4608) switches "Used by" links to the
built-in marketplace pages, falling back to GitHub for built-ins #4608
leaves unlisted.
- Validate `component:plugin-guide:<slide>` ids at parse time. Right now
a typo opens the first slide and the "Open the full Guide" link carries
the bad id (Codex review).
- Add `packages/shared-ui/package.json`, `plugins/*/package.json`,
`plugins/*/icons/*.svg` and `plugins/*/*.svg` to the
`@bb/web#build`/`#typecheck` inputs, and the same plus
`assets/bb-logo.svg` and `pnpm-lock.yaml` to the deploy-web paths. The
brand-icon glob reads every plugin manifest and SVG, so a manifest or
icon change alone neither rebuilds nor redeploys the site. (Slop Cop
architecture, code quality)
- Scan shared-ui's `motion.ts` with Tailwind `@source`. The switch's
transition classes currently survive only because the web's `motion.ts`
has the same string.
- Document, or test, the `@/` modules the web supplies to the Guide
(icon, switch, lib/utils). Today a new `@/` import in the Guide fails
the web build with an error that points at web paths.
- Stop the Guide stylesheet from overriding landing tokens on
`/plugin-guide` and posts that embed it: `theme.css` loads after
`landing.css` and replaces `--font-sans` (drops the size-matched Inter
fallback), `--font-mono` (Fira Code, never loaded on the web),
`--border`, `--state-hover` and `--surface-recessed`. Scope the app
values to the Guide or re-assert landing's after the import. (Slop Cop
architecture, code quality)
- Size the web `PhoneFixture` against
`document.documentElement.clientHeight` instead of `window.innerHeight`,
so collapsing mobile browser toolbars don't rescale the phone mock and
shift the page while scrolling. (Slop Cop performance)
- Build the web "Copy for agent" context from
`pluginSurfaceAgentContext` instead of copied lines, with a web test.
(Slop Cop architecture)
- Test that every theme token the Guide uses is defined in the web
`theme.css`, and that every "Used by" display name resolves to exactly
one plugin manifest. (Slop Cop architecture, code quality)
- Add `resolve.dedupe: ["react", "react-dom"]` to the web Vite config,
and move the Guide's `@source` lines from the shared `theme.css` into
`plugin-guide.css`. (Slop Cop architecture)
BB-Thread: [Public Plugin Guide on
getbb.app](https://brsbl.getbb.app/projects/proj_khiw2za95v/threads/thr_ptdzpsxqum)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
> AGENT GENERATED
---------
Co-authored-by: Claude Opus 5.5 <[email protected]>
ymichael
added a commit
that referenced
this pull request
Oct 30, 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–#10 from the direct cache write audit (@thread:thr_fjr5x8dzaz). #1 (thread tabs) is fixed separately in #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, #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 (#4–#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 (#7) or a cancel before the write (#8, #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 #11 (plugin safe mode) and #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 #4–#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]>
ymichael
added a commit
that referenced
this pull request
Nov 9, 2026
## Human comments ## What was wrong When the timeline picked rows for a window, it ran a loop: fetch the rows of the turns it had found so far, then call `ensureTimelineWindowParentedRows` to pull in the children of every delegating tool call. Each call started with an empty "already fetched" set. So every pass of the loop queried the children of every tool call in the window again, even though most of those children belong to the same turn and the turn query had already loaded them. The function then dropped the duplicates. On thr_u738kqjs29 the latest window read 19,463 rows to end up with 7,665 distinct rows. The child query took about 68 ms of a 210 ms cold build. On top of that, Drizzle mapped every row of the big turn and child queries one at a time, and the inline-output truncation column ran `length(data)` on every row. `length()` counts UTF-8 characters, so it scans the whole payload. Found in the Nov 7 timeline performance audit (REPORT #2), slice S1. ## What changed - `apps/server/src/services/threads/timeline.ts`: `ensureTimelineWindowParentedRows` now takes a `lookups` object that the group-context loop creates once per selection. It records which tool calls have already had their children fetched and which missing parents have already been looked up, so no pass fetches them again. Turn details pass fresh lookups, so their behaviour doesn't change. - `packages/db` `listStoredEventRowsByParentToolCallIds` has a new optional `excludedTurnIds` argument (`turn_id IS NULL OR turn_id NOT IN (...)`). The selection passes in the turns it has already loaded, and those turns' children aren't read a second time. The memo's trimmed row source applies the same filter. - `listStoredTimelineTurnEventRows` and `listStoredEventRowsByParentToolCallIds` still build their SQL with Drizzle, but now select aliased columns and return the better-sqlite3 rows directly, skipping Drizzle's per-row mapping. They already selected raw `sql<T>` fields, so the values are the same. - Both hot queries now split their IDs with `queryInSqliteVariableBatches`, taking the fixed-variable count from the statement built with an empty batch. Before, the child query bound every parent ID plus the excluded turns in one statement, and the turn query assumed 32 fixed variables even though the truncation column binds more than that. Both raised `too many SQL variables` at around 32k IDs. - `truncatedEventDataColumn` now checks `octet_length(data) <= max` before `length(data) <= max`. A string's byte length is never smaller than its character count, so the output doesn't change. Most rows now skip the character count. No wire, CLI or plugin changes. ## How you verified Measured with the audit harness on an APFS clone of the Nov 7 production snapshot. Each number is the median of 3 alternating A/B runs (main 55135d1, then this branch), each run itself a median of 3. Load average was 11–40 because other slices were benchmarking on the same machine. The first A run (load 40) was the noisiest, so the ranges are shown. | case (cold, app latest window) | before ms | after ms | Δ | SQL rows read (distinct) | |---|---|---|---|---| | u738kqjs29 | 222.8 (212–436) | 149.2 (136–156) | −33% | 19,463 → 7,857 (7,665) | | kdrbtee92b | 36.1 (35–52) | 27.7 (26–31) | −23% | 2,264 → 1,332 (1,299) | | avim9t7kpe | 129.2 (115–359) | 104.2 (104–109) | −19% | 5,897 → 5,897 (5,890) | | wg5iwwrezi | 60.3 (60–139) | 53.3 (50–72) | −12% | 3,358 → 2,653 (2,628) | | d5ej4e2gtv | 49.3 (37–92) | 35.2 (35–36) | −29%* | 662 → 662 | | u738kqjs29 older-page walk (5 pages) | 1,012 | 678 | −33% | | | kdrbtee92b walk | 236 | 193 | −18% | | \* d5ej's baseline is noisy. Its cleanest A run was 36.7 ms, so treat it as roughly unchanged. Every other harness thread is 3–16% faster on cold builds and walks. avim gains less because it has no duplicate reads; its saving comes from skipping row mapping and the character count, and most of its remaining time is JSON decode and projection. Parity: - Replayed main and this branch over 159 snapshot threads: the 12 harness threads plus 147 sampled from the 947 threads with at least 1,000 events. Each thread ran the app latest window at segment limits 20 and 8, the CLI log, includeNestedRows, summaryOnly, up to 6 older app pages, up to 3 CLI pages and 2 turn-details pages. All 1,648 response SHA-256 hashes match: 0 diffs. - Memo path: on a separate clone, appended 4 events to each of the 12 harness threads (alternating plain items and children of a delegating call) and compared each memo-served latest window with a fresh build. 48 of 48 match. Tests: - New `apps/server/test/services/threads/timeline-parented-row-reads.test.ts`: a delegated call with children in its own turn and in a child turn. The child query runs once and returns only the child-turn rows, and both outputs render. It fails on main. - `packages/db/test/data/events.test.ts`: `excludedTurnIds` keeps null-turn and other-turn children and drops the excluded turn's children. The unmapped turn and child rows equal the Drizzle-mapped `listStoredEventRows` rows. Multibyte payloads that are over the cap in bytes but not in characters come back untouched, and overflows are cut by characters. - `packages/db/test/data/events.test.ts`: 40,000 parent IDs with 500 excluded turns, and 33,002 turn IDs, both read correctly. Both raised `too many SQL variables` before the batching commit. - `packages/db/test/query-plans.test.ts`: the child read with 300 excluded turns and the truncation column still runs `SEARCH events USING INDEX events_parent_tool_call_thread_parent_sequence_idx (thread_id=? AND parent_tool_call_id=? AND sequence>? AND sequence<?)` with no `SCAN events`. - After the batching commit, a parity replay of the 12 harness threads matches main on all 156 responses. - `pnpm exec turbo run typecheck test --filter=@bb/db --filter=@bb/server`: db 666 passed; server 3,940 passed, 1 skipped. The one failure was a timeout in `test/app/install-machine-script.test.ts` at load average 64–70, which passed in the earlier run and in CI. Not covered: the remaining small duplicates (tens of rows per thread, from the context-type and background-task-state queries, plus children of a child turn that the turn query later reads again), and the SQL-side truncation work on rows that really are over the cap. > AGENT GENERATED 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
ymichael
added a commit
that referenced
this pull request
Nov 24, 2026
## Human comments ## What was wrong Opening the slash-command menu, listing skills, and opening one skill each cost several serial host round trips. Before every native-root scan the server made a separate `plugin.host.call resolveNativeRoots`, cached for 10 s, and only then sent `host.list_commands` / `host.list_skills`. The skills index also sent one `host.list_skills` per visible provider plus one for shared roots. Opening a skill rebuilt that whole index twice, once for content and once for files, just to map a skill id to a path. On a Connect-tunnelled host each serial wave costs ~200 ms (audit findings #2 and #3, `thr_ejgucea7p3/report.md`). Finding #4, frontmatter-only project skill reads, is handled in a separate thread. ## What changed - **Daemon wire change, `HOST_DAEMON_PROTOCOL_VERSION` 281 → 282.** - `host.list_commands` now takes `{ cwd, provider: { providerId, declaredRoots, resolver }, resolution: { contributedEnv, timeoutMs } }`. - `host.list_skills` takes `{ cwd, providers: [...], sharedRoots, resolution }` and returns `{ workspaceSkills, sharedSkills, providers: [{ providerId, skills }] }`. - `resolver` is `{ pluginId, generation, artifact }` or null. The daemon calls the plugin's `resolveNativeRoots` in-process through its `PluginHostManager`, inside the same request as the scan. It cancels that call if the listing is cancelled. A failed, malformed, or unavailable answer falls back to the declared roots with a warning, as the server did before. - **Server policy stays on the server** (`services/providers/native-roots.ts`): which providers are scanned, which plugin resolves, the host env, and a 10 s resolver cap that leaves the scan time inside the first retry attempt. The server-side resolved-roots cache (`ProviderNativeRootsCache`) is deleted because resolving is no longer a separate round trip. - **Skills index** (`services/skills/skill-listing.ts`): - One batched `host.list_skills` replaces the per-provider calls and the separate shared-roots call. - `.bb/skills` is scanned once instead of once per provider. It is now also listed when no provider has native roots. - Server-owned skills load in parallel with the host call. - A per-(host, cwd) index memo (`@bb/async-cache`, 5 min) is refreshed by every listing. Content and file reads resolve the id from it and rebuild once only for an id the last listing didn't have. Writes and deletes always rebuild first. Plugin settings changes clear it. - **Docs:** `docs/api_to_audit.md` and the `experimental_nativeRootsHostContract` JSDoc now say the daemon resolves per listing, uncached. Plugin SDK bumped to 0.6.197 for the JSDoc change. ## How you verified Measured on two real servers, main at merge base `af25b0b5a60` vs this branch, each with a fresh data dir (no `~/.bb`). Each server had a second enrolled daemon behind a TCP latency proxy adding 100 ms each way (~200 ms RTT). The proxy strips `permessage-deflate` from the daemon's upgrade, reads server→daemon frames, and counts `host-rpc.request`s. Input was the same bb checkout (9 `.bb/skills`, real `~/.claude` etc.) and `provider=claude-code`, with 8 samples per action after warm-up. Remote host (~200 ms RTT): median wall time / host RPCs per action | action | main | branch | |---|---|---| | slash menu, cold (>10 s since last) | 437 ms / 3 (resolver → `list_commands`, ‖ `read_workspace_agent_context`) | 233 ms / 2 | | slash menu, warm | 222 ms / 2 | 233 ms / 2 | | skills list, cold (>10 s since last) | ~527 ms / 13 (6 resolvers → 7 `list_skills`) | ~310 ms / 1 | | skills list, warm (resolver cache hit on main) | 364 ms / 7 | 404 ms / 1 (steady-state resample: ~300–320 ms on both) | | open one skill (content + files in parallel) | 584 ms / 16–22 (two index rebuilds + read + list) | 219 ms / 2 (`read_file` ‖ `list_files`) | Local host (primary daemon, no proxy), median: | action | main | branch | |---|---|---| | slash menu, cold / warm | 22 / 19 ms | 21 / 19 ms | | skills list | 119 ms | 115 ms | | open one skill | 167 ms | 17 ms | The warm slash menu still makes 2 RPCs in one parallel wave: `host.list_commands` and `host.read_workspace_agent_context`. Folding the second one in overlaps finding #4's change to that command, so it is left for that thread. Every action is now a single wave. The remaining ~100 ms over RTT on the skills list is server-side index work (`listServerSkills` hashing), not host traffic. Tests: - `apps/server/test/public/public-project-skills.test.ts` adds "opens a listed skill with one host read…". It asserts that a listing is one `host.list_skills`, that content + files after it are exactly `host.read_file` + `host.list_files`, and that an unknown id re-lists once. It fails on main, where every open re-lists. - `apps/host-daemon/src/command-handlers/list-skills.test.ts` covers the batched handler with a fake plugin host: the `.bb/skills` root is listed once, shared roots and resolved roots are scanned, a throwing / malformed / missing runtime falls back to declared roots with a warning, and cancelling the listing cancels the resolver call. - `native-roots.test.ts`, the commands, workspace-routing and contract tests are updated to the new wire shape. - `pnpm exec turbo run typecheck lint --filter=@bb/server --filter=@bb/host-daemon --filter=@bb/host-daemon-contract --filter=@get-bb/plugin-sdk --filter=@bb/integration-tests` passes. So do the targeted vitest runs above, plus `tests/integration` `native-roots-golden`. CI runs the full suites. > AGENT GENERATED 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 5.5 <[email protected]>
This was referenced Nov 25, 2026
ymichael
pushed a commit
that referenced
this pull request
Nov 25, 2026
…lability read (#8187) ## Human comments ## What was wrong A nested bb whose Account Pooler proxies to a parent pool decides per turn whether it can route through the parent, using `ParentAvailability` in `plugins/account-pool/src/parent-pool.ts`. `load()` gives the parent's `/availability` 2 s, and on any error or non-OK status returns `UNAVAILABLE_POOL`. `get()` caches that result for the full 30 s TTL, the same as a good answer. So one slow read from a busy parent takes the child off the pool for 30 s, and every turn that starts in that window runs with no pool credentials. On a child with no Claude login of its own, Claude Code answers `Not logged in · Please run /login` and Provider Retry skips the turn as not retryable. On one child this happened three times in a day, each time the parent's host was under heavy load. ## What changed - `plugins/account-pool/src/parent-pool.ts`: `ParentAvailability` remembers the last good availability. - A failed read keeps serving it, and the next read is tried after 5 s instead of 30 s. - Once reads have failed for 60 s in a row, the parent is reported unavailable and that answer is cached for the normal TTL, as before. A parent that has never answered is reported unavailable, and the read is retried after 5 s. - The read timeout goes from 2 s to 5 s. - `plugins/account-pool/src/parent-pool.test.ts`: three cases, all of which fail on `main`: - one failed read keeps the last good value and retries after 5 s; - a parent that stays down is reported unavailable after 60 s, then cached for the TTL; - a failed first read is retried after 5 s. - No wire, CLI or doc changes. ## How you verified - New tests on `main`'s `parent-pool.ts`: the 3 new tests fail with `expected { claude: false, codex: false } to deeply equal { claude: true, codex: false }`, and the other 13 pass. With the change: 16/16. - After the final commit: `pnpm exec turbo run typecheck lint test --filter=bb-plugin-account-pool --force` passed 10/10 tasks, with 14 test files and 402 tests passing. Lint reported 3 warnings, all in `app.tsx`, which this PR does not touch. `pnpm exec turbo run lint:type-aware --filter=bb-plugin-account-pool --force` passed 7/7 tasks with 0 warnings. `pnpm exec turbo run prepare:bundled --filter=bb-plugin-account-pool` passed 7/7 tasks. `oxfmt --check` passes on both files. - Standalone reproduction with real HTTP and the real clock. `ParentAvailability` uses the real `fetch` and the shipped TTL and timeouts against a local HTTP parent, and one `get()` per second stands in for a turn start. `main` and this branch ran side by side. One slow answer (request #2 answers in 8 s, then normal), on `main`: ``` [ 0.0s] parent: request #1 -> 200 {claude:true} [ 0.1s] child: turn start -> ROUTED (claude via parent pool) [ 30.2s] parent: request #2 answering in 8s [ 32.2s] child: warn could not read parent availability: The operation was aborted due to timeout [ 32.2s] child: turn start -> NOT ROUTED (turn runs with no login) after waiting 2003ms [ 62.3s] parent: request #3 -> 200 {claude:true} [ 62.3s] child: turn start -> ROUTED (claude via parent pool) summary: 43 turn starts routed, 30 not routed, 3 parent requests ``` With the change: ``` [ 0.0s] parent: request #1 -> 200 {claude:true} [ 0.1s] child: turn start -> ROUTED (claude via parent pool) [ 30.2s] parent: request #2 answering in 8s [ 35.2s] child: warn could not read parent availability: The operation was aborted due to timeout [ 35.2s] child: turn start -> ROUTED (claude via parent pool) after waiting 5003ms [ 40.2s] parent: request #3 -> 200 {claude:true} [ 70.4s] parent: request #4 -> 200 {claude:true} summary: 70 turn starts routed, 0 not routed, 4 parent requests ``` A parent that stays down (503 from 25 s on), on `main`: ``` [ 0.0s] parent: request #1 -> 200 {claude:true} [ 0.1s] child: turn start -> ROUTED (claude via parent pool) [ 30.2s] parent: request #2 -> 503 (down) [ 30.2s] child: warn could not read parent availability: parent availability returned HTTP 503 [ 30.2s] child: turn start -> NOT ROUTED (turn runs with no login) [ 60.4s] parent: request #3 -> 503 (down) [ 60.4s] child: warn could not read parent availability: parent availability returned HTTP 503 [ 90.5s] parent: request #4 -> 503 (down) [ 90.5s] child: warn could not read parent availability: parent availability returned HTTP 503 [120.7s] parent: request #5 -> 503 (down) [120.7s] child: warn could not read parent availability: parent availability returned HTTP 503 summary: 30 turn starts routed, 100 not routed, 5 parent requests ``` With the change, the child keeps routing for 60 s after the first failure, then reports the parent unavailable and goes back to reading every 30 s: ``` [ 0.0s] parent: request #1 -> 200 {claude:true} [ 0.1s] child: turn start -> ROUTED (claude via parent pool) [ 30.2s] parent: request #2 -> 503 (down) [ 30.2s] child: warn could not read parent availability: parent availability returned HTTP 503 [ 35.2s] parent: request #3 -> 503 (down) [ 35.2s] child: warn could not read parent availability: parent availability returned HTTP 503 [ 40.2s] parent: request #4 -> 503 (down) [ 40.2s] child: warn could not read parent availability: parent availability returned HTTP 503 [ 45.3s] parent: request #5 -> 503 (down) [ 45.3s] child: warn could not read parent availability: parent availability returned HTTP 503 [ 50.3s] parent: request #6 -> 503 (down) [ 50.3s] child: warn could not read parent availability: parent availability returned HTTP 503 [ 55.3s] parent: request #7 -> 503 (down) [ 55.3s] child: warn could not read parent availability: parent availability returned HTTP 503 [ 60.3s] parent: request #8 -> 503 (down) [ 60.3s] child: warn could not read parent availability: parent availability returned HTTP 503 [ 65.3s] parent: request #9 -> 503 (down) [ 65.3s] child: warn could not read parent availability: parent availability returned HTTP 503 [ 70.3s] parent: request #10 -> 503 (down) [ 70.3s] child: warn could not read parent availability: parent availability returned HTTP 503 [ 75.3s] parent: request #11 -> 503 (down) [ 75.3s] child: warn could not read parent availability: parent availability returned HTTP 503 [ 80.3s] parent: request #12 -> 503 (down) [ 80.3s] child: warn could not read parent availability: parent availability returned HTTP 503 [ 85.4s] parent: request #13 -> 503 (down) [ 85.4s] child: warn could not read parent availability: parent availability returned HTTP 503 [ 90.4s] parent: request #14 -> 503 (down) [ 90.4s] child: warn could not read parent availability: parent availability returned HTTP 503 [ 90.4s] child: turn start -> NOT ROUTED (turn runs with no login) [120.5s] parent: request #15 -> 503 (down) [120.5s] child: warn could not read parent availability: parent availability returned HTTP 503 summary: 90 turn starts routed, 40 not routed, 15 parent requests ``` <details><summary>repro.mts (run from the repo root as <code>node_modules/.bin/tsx repro.mts $PWD/plugins/account-pool/src/parent-pool.ts slow-once|down</code>)</summary> ```ts import { createServer } from "node:http"; import type { AddressInfo } from "node:net"; const [modulePath, scenario] = process.argv.slice(2) as [string, "slow-once" | "down"]; const { ParentAvailability } = await import(modulePath); const TOKEN = "vqMIj4xUiI3PyvKS2SllSKHsOfxLF_sAZwzNAAvV9TQ"; const started = Date.now(); const t = () => ((Date.now() - started) / 1000).toFixed(1).padStart(5); let request = 0; const server = createServer((req, res) => { request += 1; const n = request; const elapsed = (Date.now() - started) / 1000; if (req.headers["x-bb-account-pool-token"] !== TOKEN) { res.writeHead(401).end(); return; } const answer = () => { res.writeHead(200, { "content-type": "application/json" }); res.end(JSON.stringify({ claude: true, codex: false })); }; if (scenario === "slow-once" && n === 2) { console.log(`[${t()}s] parent: request #${n} answering in 8s`); setTimeout(() => { if (!res.destroyed) answer(); }, 8_000); return; } if (scenario === "down" && elapsed > 25) { console.log(`[${t()}s] parent: request #${n} -> 503 (down)`); res.writeHead(503).end(); return; } console.log(`[${t()}s] parent: request #${n} -> 200 {claude:true}`); answer(); }); await new Promise<void>((resolve) => server.listen(0, "127.0.0.1", resolve)); const { port } = server.address() as AddressInfo; const availability = new ParentAvailability({ parent: { baseUrl: `http://127.0.0.1:${port}/api/v1/plugins/account-pool/http`, token: TOKEN }, fetch, now: Date.now, onError: (error: unknown) => console.log(`[${t()}s] child: warn could not read parent availability: ${error instanceof Error ? error.message : String(error)}`), }); const durationS = scenario === "slow-once" ? 75 : 130; let last: string | null = null; let routed = 0; let unrouted = 0; while ((Date.now() - started) / 1000 < durationS) { const before = Date.now(); const value = await availability.get(); const waited = Date.now() - before; if (value.claude) routed += 1; else unrouted += 1; const state = value.claude ? "ROUTED (claude via parent pool)" : "NOT ROUTED (turn runs with no login)"; if (state !== last || waited > 500) { console.log(`[${t()}s] child: turn start -> ${state}${waited > 500 ? ` after waiting ${waited}ms` : ""}`); last = state; } await new Promise((r) => setTimeout(r, 1_000)); } console.log(`summary: ${routed} turn starts routed, ${unrouted} not routed, ${request} parent requests`); server.close(); process.exit(0); ``` </details> - **Not checked:** an isolated nested bb against a slow parent bb end to end. The reproduction drives the same class the server constructs, with the same options except `onError`. Fixes #8188 > AGENT GENERATED 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 5.5 <[email protected]>
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
mainTesting