Skip to content

Provider plugins: one API for Codex, Claude Code, pi, and ACP agents - #2325

Merged
SawyerHood merged 6 commits into
mainfrom
provider-plugins
Aug 24, 2026
Merged

SawyerHood merged 6 commits into
mainfrom
provider-plugins

Conversation

@SawyerHood

@SawyerHood SawyerHood commented Aug 24, 2026 •

Copy link
Copy Markdown
Collaborator

What was wrong

Providers (Codex, Claude Code, pi, and every ACP agent) were wired into core with per-provider carve-outs: a provider table and provider-specific skill/command scanning in the daemon, provider-specific recovery regexes and session branches in the runtime, provider-id branches in the server and clients, and a narrower ACP-only path for third-party agents. Adding or changing a provider meant touching core in many places.

What changed

Providers are plugins behind one API with zero first-party privilege: the built-in providers use the same bb.providers.register declaration, bridge protocol, and SDK a third party uses.

  • Bridge protocol v3: items carry a declarative presentation (label, glyph, tint, detail); web renders from it, plugins may add React renderers for their own kinds, mobile renders the declarative base.
  • bb.providers.register declares strings, icon, models, reasoning levels, service tiers, permission modes, native skill/command roots, maintenance, and AI services; one ProviderInfo shape everywhere.
  • Interactions: closed approvals with toolUse, open plugin-defined requests, one lifecycle event; the server stays the policy owner.
  • Runtime and daemon: typed recovery hints replace regexes; one bridge process per provider artifact with per-thread lanes; the daemon scans declared roots only and resolves host-only roots through resolveNativeRoots; the ACP tier is deleted and the ACP plugin owns its agents through a published ACP bridge kit.
  • pi moves from a built-in runtime to a plugin over pi --mode rpc with an install gate.
  • Plugin icons: bb.branding.experimental_icons (name → SVG), namespaced glyphs, strict SVG validation, nosniff + CSP; bb plugin build checks logos for script vectors.
  • Stabilization: experimental_ dropped where audited; provider-literal ratchet 209 → 18 allowlisted references; cross-plugin duplicates folded into experimental_ SDK helpers; eleven published provider-bridge exports kept under "Scheduled removals".
  • Wire: HOST_DAEMON_PROTOCOL_VERSION 153 → 164; @get-bb/plugin-sdk 0.4.16; bb plugin build inlines SDK subpaths so packaged installs load provider plugins.
  • Older mobile builds are not supported (the app ships with the server): the timeline wire serves grammar v3 only — no capability header, no activityIntents on tool rows, no ProviderInfo maintenance aliases.
  • Docs: docs/provider-plugin-api.md, docs/api_to_audit.md, the plugin-authoring skill, the bb guide, CLI surfaces.

Built as reviewed layers and squashed into one commit, then adversarially reviewed (51 findings; every confirmed one fixed with a failing-first test and an independent re-check — the commit message lists them).

How you verified

  • Typecheck 76/76; full test sweep; CI build + lint; smoke:tarball; SDK version guards.
  • Parity harness: 39 recorded bridge cells replayed through the pre-migration main and this branch, zero diffs outside the named allowlist.
  • Provider corpus: 340 real threads / 94,365 rows, every changed row in a named class, 0 unclassified.
  • Permission matrix 134 cells identical; native-roots goldens 22/22; every bridge's conformance kit green; real-provider integration suite (Codex, Claude Code, pi, ACP agents) 64 tests.
  • Live QA: Codex, Claude Code, Cursor and grok (ACP), the echo example plugin, and pi each ran a tool turn.

AGENT GENERATED: by Claude Opus 5

What was wrong

Providers (Codex, Claude Code, pi, and every ACP agent) were wired into core with per-provider carve-outs: the host daemon carried a provider table and provider-specific skill/command scanning, the agent runtime carried provider-specific recovery regexes and session branches, the server and clients branched on provider ids, and third-party agents could only arrive through the ACP tier with a narrower API than first-party providers had. Adding or changing a provider meant touching core in many places, and the "plugin API" did not describe what the built-in providers actually used.

What changed

Providers are plugins behind one API, with zero first-party privilege: the built-in providers use the same `bb.providers.register` declaration, bridge protocol, and SDK surface a third party uses.

- **Bridge protocol v3 + presentation**: items carry a declarative `presentation` (label, glyph, tint, detail); web renders rows from it and plugins may add React renderers for their own kinds; mobile renders the declarative base with no plugin JavaScript.
- **Registry**: `bb.providers.register` declares strings, icon, models, reasoning levels, service tiers, permission modes, native skill/command roots, maintenance (health, usage, installation), and AI services; one `ProviderInfo` shape everywhere.
- **Interactions**: closed approvals with `toolUse`, open plugin-defined requests (`<pluginId>/<name>` + `request_answer`), one lifecycle event; the server stays the policy owner.
- **Runtime and daemon**: typed recovery hints replace regexes; one bridge process per provider artifact with per-thread lanes; the daemon scans declared roots only, and every plugin — pi included — resolves host-only roots through `resolveNativeRoots` (the `absolute` side is gone); a bridge must return `providerThreadId` on `thread/start`, `thread/resume`, and `thread/fork` (the conformance kit pins the error); the ACP tier is deleted and the ACP plugin owns its agents through a published ACP bridge kit.
- **pi** moves from a built-in runtime to a plugin over `pi --mode rpc` with an install gate.
- **Plugin icons**: a plugin declares `bb.branding.experimental_icons` (name → SVG it ships); rows and provider branding reference `"<pluginId>/<name>"`; ingest rejects undeclared names; an uninstalled plugin falls back to the host glyph; declared-icon SVGs pass a strict validator and are served under `nosniff` + CSP. The pre-existing branding/logo routes now send the same headers; installed plugins' logos keep loading exactly as before, and `bb plugin build` checks logos for script vectors (script/handler/listener elements, `on*` attributes, `javascript:` hrefs) so authors see it when they build.
- **Stabilization**: `experimental_` dropped where audited (old keys rejected with messages naming the new ones; one-release aliases for app-runtime members); provider-literal ratchet 209 → 18 references, all allowlisted with reason/owner/dies-at.
- **Simplification (S7)**: dead adapter branches, a duplicate maintenance cache, duplicate validators/tests/fixtures removed; cross-plugin duplicates folded into `experimental_` SDK helpers (vendor plugin roots, presentation builders, the maintenance toolkit, bounded line reader, public-SDK-only scan), each with an `api_to_audit.md` entry; eleven already-published `provider-bridge` exports kept and listed under "Scheduled removals (next major)".
- **Wire**: `HOST_DAEMON_PROTOCOL_VERSION` 153 → 164 (entries 154–164 in the header). `@get-bb/plugin-sdk` → 0.4.16 (main ships 0.4.15), bumped inside the first layer that changes the published surface so that layer passes the per-PR SDK guard on its own.
- **Packaging**: `bb plugin build` now inlines the SDK subpaths a plugin server imports (`@get-bb/plugin-sdk/host`, `/provider-bridge/acp`) and leaves only the bare specifier external; before this, a packaged install loaded none of the provider plugins (the packed server aliases only the bare specifier). `smoke:tarball` is green with pi absent from PATH.
- **Kept on purpose**: `experimental_setThreadRowStatus` and its status store stay (main's collapsed-section plugin-status rollup consumes them); the audit doc names the consumer.
- **Docs**: `docs/provider-plugin-api.md` (design), `docs/api_to_audit.md` (experimental surface, windows, scheduled removals, deleted members), the plugin-authoring skill, the bb guide, CLI surfaces.

Base: the current `main` (the private mirror was brought level with the public tip first). The branch is strictly linear and rebased; every conflict with main's recent changes (shared vitest workers, parallel SDK d.ts bundling, the collapsed-section status rollup, the mobile e2e flow) was resolved three-way and re-verified. The work was built as 151 reviewed layers and squashed into this commit; the layered history is kept on the private repository.

How it was verified

- Typecheck 76/76 packages; full test sweep green on the rebased tip; CI's build + lint, the package smoke (`smoke:tarball`), the plugin-SDK version guard against the merge-base, the npm version guard, and the version-lockstep check.
- Parity harness: 39 recorded bridge cells (codex 16, claude-code 13, acp-cursor 10) replayed through the pre-migration main and the chain with zero diffs outside recordings/parity-allowlist.json (each entry named and reasoned); pi via re-recorded cells and the recorded-conformance kit.
- Provider corpus: 340 real threads (307 production codex/claude-code threads + 32 pi threads captured on a dev instance of main, baselines main-minted), 94,365 rows, every changed row in a named, reviewed class, 0 unclassified — re-run at every stack.
- Permission matrix: 134 pinned cells identical; native-roots goldens 22/22 (two new pi variants); every bridge's conformance kit green; the real-provider integration suite (live Codex, Claude Code, pi 0.84, ACP agents) 9 files / 64 tests.
- Adversarial refutation passes per layer and on every stacked result (independent read-only reviewers probing behaviour, coverage, security, and public-push readiness); every removal in the simplification series was independently refuted before it was stacked.
- Live QA in the dev app: Codex, Claude Code, Cursor and grok (ACP), the echo example plugin, and pi each ran a tool turn.

Adversarial review of the squashed change: 27 confirmed findings fixed (29 reports with two duplicate pairs folded; one of them was the parity wording corrected above), plus three cheap hardenings the review recommended. Clients: a new client keeps exploration titles for the tool rows a pre-161 server serves; an embedded thread chat scopes plugin renderers to its own provider; a deferred provider plugin's bundle loads for its forms and its panel route; a tint React Native cannot paint falls back instead of painting black, a blank extension detail stays title-only, and images in a presentation detail render as alt text on every surface. Runtime: the retry ladder and the post-unarchive retry act on the typed recovery hint of every attempt (no other kind can become a `rate_limited` error), and a `restartRecommended` restart is scoped to the threads and the process it may touch. Bridges: the ACP kit types `authRequired` only from the agent's own auth error, settles the turn when an interrupt times out, reaps a session released during construction, and defers updates that arrive before the identity announcement; a codex turn whose rebuild hits an archived rollout stays resumable. Server and contracts: the presentation-glyph ingest check runs on every item-bearing event, the delegation and backgroundTask snapshots included; the 0.4.15 provider-bridge exports whose definitions moved are restored as aliases under "Scheduled removals", every removed or renamed 0.4.15 export is named in the audit doc, a pi child's scratch files go with the child, and the presentation-less tool-row window is documented as pi uses it. Tests and oracles: the conformance kit pins the resume and fork identities, the fake plugin host refuses the registrations the server refuses, the public-SDK scan reports relative escapes and dynamic specifiers, the corpus row-class gate judges idle classes per entry, lets a reshaped class name its fields and no longer claims a turn status change under container-bounds, and the native-roots goldens keep skill descriptions. Stacking the fixes surfaced one more, fixed here as well: the web search-reveal timers outlived the timeline rows they targeted, which surfaced as an unhandled error in the web test suite.

A second pass took the remaining items: extension kinds are accepted only from their owning plugin's threads, so an extension item or state record whose kind belongs to another plugin is refused at ingest and surfaces as the same visible unhandled row a schema miss does. A childless delegation call in persisted history (an `Agent`, `Task`, or `spawnAgent` call whose subagent never produced a child event) classifies as a delegation row keyed by its call id, the row it had before, instead of a plain tool row; new events keep classifying structurally, the bridge's `delegation` item naming the call id as its `childRef`. A plugin whose host artifact fails to build keeps its provider listed as unavailable, with the build error as the reason, even when the same plugin also registers an AI service (before, such a plugin vanished from the provider list). The server alone authors interaction lifecycle records: the daemon-posted ones are dropped at the internal event-append route instead of being kept for known interaction ids, and the host-daemon protocol moves to 164 to record the narrowed acceptance.

Older mobile builds are not supported: the app is on TestFlight and ships with the server, so the timeline wire serves grammar v3 only — no client capability header, no legacy projection, and no `activityIntents` key on tool rows; the readers that existed for those rows are gone with it; the `ProviderInfo` maintenance aliases (`experimental_providerHealth`/`experimental_providerUsage`/`experimental_providerInstallation`) kept for clients built before protocol 161 are gone as well — read `maintenance`.

Co-Authored-By: Claude <[email protected]>
SawyerHood and others added 5 commits August 24, 2026 03:48
… yet

The tarball smoke polls `bb plugin list` until every expected builtin is
running, but threw on the first plugin whose status was "error". The
server reports an enabled plugin that `loadAll` has not reached yet with
exactly that status and the detail "not loaded" (it has no runtime status
at all), and plugins load one at a time after the HTTP server starts
listening. On a cold CI runner the poll landed mid-load and the six
builtins still queued behind provider-acp failed the smoke.

The smoke now treats that explicit no-status-yet detail as pending and
fails only on a plugin whose load actually failed.

Verified: smoke:tarball on Node 22 and Node 24 with pi and opencode2
absent from PATH.

Co-Authored-By: Claude <[email protected]>
replayRecording gated each runtime request on the events the recording had
before it, but gave up after orderTimeoutMs of bridge silence and sent the
request anyway. With a plan from the current lane that shortfall can only
be latency, since the same bridge wrote the lane; on a starved CI runner
the bridge went quiet with provider lines still unread, the steer then
arrived on the bridge's stdin while those lines were pending, and the
bridge drained the two streams in an order the recording never had (in
codex/steer every row from the fourth command on shifted).

An exact plan now waits for its events up to timeoutMs and reports a stall
if they never come. The quiet fallback stays for plans from the recorded
lane, where a divergent bridge legitimately emits fewer events.

Verified: @bb/provider-parity 56/56 twice; codex/steer no slower.

Co-Authored-By: Claude <[email protected]>
…light

An unsolicited restartRecommended hint that arrived while one of the
thread's operations was in flight was kept but not scheduled until the
thread's next turn. One read can carry the turn/start response, the turn's
terminal delta and the hint together: the response settles the turn
operation on a microtask that runs only after the whole batch, so the hint
found the operation in flight, and a thread that was idle a moment later
restarted only at its next turn. The recovery test that expects the
sibling-busy deferral to be logged right after the turn failed one run in
three under load.

The runtime now retries such a hint as soon as the thread's operations
drain. A hint carried by a rejected request keeps restarting before the
next turn, as before. The scripted echo bridge gains
turnStartResponseDelayMs so a test can raise the hint before the turn/start
answer; the new test fails without the fix and passes with it.

Verified: @bb/agent-runtime 316/316 solo and three times under CPU and
suite load; typecheck across packages.

Co-Authored-By: Claude <[email protected]>
The test that pins the 256-root cap wrote 300 plugins one after another
(two filesystem writes each) and then resolved them; on a slow CI runner
that ran past the 5 s default test timeout. 260 plugins exceed the cap by
the same mechanism and prove the same cut-off and warning, and the fixture
writes are now issued together instead of one at a time: the file runs in
about 150 ms.

Co-Authored-By: Claude <[email protected]>
Four pi bridge tests failed on a starved CI runner for three reasons, none
of them the bridge misbehaving.

The test harness called a request unanswered after 20 s, while the bridge
was still inside its own budget: a construction it retries spawns up to
eight node children through the transient-auth window, several seconds
each on a loaded runner, against a readiness budget of a minute per
attempt. The harness now waits 60 s, and the lifecycle and round2 tests
that drive such constructions get 90 s each.

The test that pins "a child whose extension never reports ready" shortens
the readiness budget to 1.5 s, but that budget also capped the child's
first get_state, so a slow spawn produced "did not answer get_state in
time" instead. The first command now waits on the channel budget like any
other and the readiness budget starts once pi has answered, so it bounds
the extension's report alone; the default budgets are unchanged.

The child-exit check waited 10 s for a close that escalates through a 4 s
SIGTERM grace and a 4 s SIGKILL grace before the exit reaches the process
log; it now waits 30 s.

Verified: bb-plugin-provider-pi 104/104 solo and three times under CPU
and suite load (the lifecycle file took up to 48 s there); typecheck.

Co-Authored-By: Claude <[email protected]>
@SawyerHood
SawyerHood merged commit e42a4ef into main Aug 24, 2026
15 checks passed
@SawyerHood
SawyerHood deleted the provider-plugins branch August 24, 2026 04:34
SawyerHood added a commit that referenced this pull request Aug 24, 2026
A provider plugin's app bundle is deferred until a thread of one of its
providers opens (#2325), so a settingsSection it registers — the Pi model
editor — never appeared on a fresh Settings visit: its page rendered an
empty Configuration heading and the sidebar listed no Pi row, because both
only count sections that are already mounted.

The settings navigation now asks for every enabled provider plugin's bundle
while Settings is open, and a plugin's settings detail asks for its own, so
the sections arrive the way they do after opening a thread. The plugin list
item carries providerIds (the server has answered it since 0.39) so the nav
can tell a provider plugin from the rest.
SawyerHood added a commit that referenced this pull request Aug 24, 2026
The squash merge re-added the provider-maintenance and provider-declaration
target-state entries that #2325 stabilized (the names they describe are the
plain ones now).
bradhallett added a commit to bradhallett/bb that referenced this pull request Aug 24, 2026
The regression test from the original commit passed bare Errors and
leaned on the ACP_AUTH_REQUIRED_PATTERN message regex, which e42a4ef
(get-bb#2325) deleted: on main the router sees a typed
AgentRuntimeRecoveryError carrying code "auth_required". Rebuild the
test on that shape at both layers — the classifier unit and the router
path (typed errorCode still returned, debug accounting kept, no warn) —
with a contrast case proving unclassified failures still warn. Also
correct the allow-list comment: the probe execs the agent's list-models
CLI with no ACP handshake, and the entry covers every online RPC that
can surface the code.
ymichael added a commit that referenced this pull request Aug 24, 2026
## What was wrong

PR #2084 removed avoidable TypeScript fixture transforms from this test,
but the unified provider-harness work in #2325 later moved it back onto
the TypeScript scripted-echo bridge while preserving three serial
real-process launches. The packages shard makes each tsx-backed startup
compete with many other workers; the redundant third launch pushed the
test over its unchanged 15-second cap. Under controlled contention, the
request log reached the third process's initialize request but timed out
before its thread/start request, confirming cumulative process startup
as the cause rather than a polling deadline. No bridge process remained
after the timed-out worker exited.

## What changed

Successive capability-declaration fingerprints at one artifact hash now
have deterministic coverage in bridge-launch-process-key.test.ts. The
end-to-end lifecycle test retains the minimum real-process boundary: two
equal declarations share one initialized bridge, then one changed
declaration initializes a distinct second bridge. This keeps assertions
for hangs, process reuse, and process distinction while removing the
third serial launch. The 15-second timeout is unchanged. This is
test-only; there is no production, wire, CLI, guide, or protocol-version
change.

I rejected a timeout increase because scheduler contention is only the
reproduction condition. I also kept two real bridges instead of
replacing the lifecycle boundary with an injected process factory,
because two processes are the minimum needed to prove end-to-end
distinction.

## How you verified

- Unchanged baseline, unloaded: focused test passed in 596ms.
- Unchanged baseline under 192 and 384 CPU competitors: passed in 7.484s
and 11.895s.
- Unchanged baseline under 576 CPU competitors: reproduced the exact
failure at 15.009s with Test timed out in 15000ms.
- Changed test under the identical 576-competitor condition: passed in
11.052s with the same timeout; no scripted bridge process remained
afterward.
- Changed test, unloaded: 330ms; 10/10 fresh Turbo/Vitest repetitions
passed (about 0.31s when reported).
- pnpm exec turbo run test --filter=@bb/agent-runtime --force
--output-logs=full -- src/bridge-launch-process-key.test.ts (2 passed).
- pnpm exec turbo run test --filter=@bb/agent-runtime --force
--output-logs=full -- --project '@bb/agent-runtime:isolated'
src/runtime.process-lifecycle.test.ts (35 passed).
- pnpm exec turbo run test --filter=@bb/agent-runtime --force
--output-logs=full (21 files, 317 tests passed).
- pnpm exec turbo run typecheck --filter=@bb/agent-runtime --force
--output-logs=full (passed).
- pnpm exec turbo run build --filter=@bb/agent-runtime --force
--output-logs=full (upstream generation passed; this package has no
build task).
- pnpm exec turbo run lint --filter=@bb/agent-runtime --force
--output-logs=full (this package has no lint task), plus targeted
oxlint, oxfmt --check, and git diff --check (passed).

> AGENT GENERATED: by GPT-5.6-Sol
bradhallett added a commit to bradhallett/bb that referenced this pull request Aug 26, 2026
The regression test from the original commit passed bare Errors and
leaned on the ACP_AUTH_REQUIRED_PATTERN message regex, which e42a4ef
(get-bb#2325) deleted: on main the router sees a typed
AgentRuntimeRecoveryError carrying code "auth_required". Rebuild the
test on that shape at both layers — the classifier unit and the router
path (typed errorCode still returned, debug accounting kept, no warn) —
with a contrast case proving unclassified failures still warn. Also
correct the allow-list comment: the probe execs the agent's list-models
CLI with no ACP handshake, and the entry covers every online RPC that
can surface the code.
ymichael added a commit that referenced this pull request Sep 17, 2026
)

## Human comments

## What was wrong

bb had two icon vocabularies that shared one spelling, so
`"<pluginId>/<name>"` meant different things in different fields and
nothing about the name said which.

- **Manifest-declared icons** (`bb.branding.experimental_icons`, added
2026-08-23 in #2325 for provider and tool rows) resolved at five
server-side declaration sites and silently rendered `Zap` everywhere
else.
- **App registrations** (`app.experimental_icons.register()`, added
2026-09-11 in #3513) resolved at app surfaces and nowhere else.

#3204 was filed 2026-09-07, between those two, and was accurate when
written: app icon fields really were limited to BB's built-in names, so
a plugin could not paint its own artwork on a sidebar thread row. #3513
fixed that general problem four days later — in its own words, "Plugin
app icons were effectively limited to BB's built-in names" — but never
referenced #3204, and documented the new registry only as something
`experimental_Icon` renders. So the issue stayed open, the docs still
read as if the stock set were the only option, and the half of the
complaint that was still true (declared icons don't work there) stayed
true.

## What changed

**Behavior.** `Icon` (`packages/shared-ui/src/components/ui/icon.tsx`)
now resolves a registration, then a built-in, then a manifest-declared
glyph. A declared icon works everywhere a BB icon name is accepted —
thread row statuses, sidebar footer items, composer `+` rows, message
actions, nav panels, panel tabs and actions, mention rows — as well as
in the declarations that already took one. One vocabulary, one
resolution order.

Strictly additive: registrations still shadow built-ins and both still
shadow a declared icon, so every name that resolved before resolves to
the same artwork. Only names that previously fell back to `Zap` change.

- `icon-registry.ts` gains a declared-icon store beside the app-icon
store. The two sources keep distinct lifecycles rather than being
merged, because they genuinely differ: declared icons come from the
server inventory and exist even when a plugin ships no frontend bundle
or is stopped; registrations are React components tied to a bundle
generation.
- `plugin-frontend.ts` pushes the declared map in the same pass that
already populates plugin logos. That pass runs before any bundle loads,
so a declared glyph never renders a frame of fallback first.
- The five declaration sites keep their stricter ownership check — a
glyph there must name the registering plugin and a declared icon,
because those references persist in timeline rows and are revalidated at
ingest. App surfaces resolve any declared glyph, matching the app icon
registry, which has always been global across plugins.

**Docs**, now describing one vocabulary rather than a split: a
module-local `BbIconName` alias carries the resolution order once,
replacing ten near-identical comments that each restated it (and were
the reason the contract drifted). It is deliberately unexported —
`app.ts` re-exports app-contract wholesale, so exporting it would make a
doc comment a public SDK member owing an `experimental_` prefix and an
`api_to_audit.md` entry. The guide references say when to register
versus declare, and the quickstart's site list is corrected from three
to five.

No wire change, so no `HOST_DAEMON_PROTOCOL_VERSION` bump. Plugin SDK
bumped to 0.4.100, since JSDoc ships in `bundled-types/*.d.ts`.

## How you verified

A probe plugin in a running dev app declaring one manifest icon and
registering two, driving three sidebar rows through
`experimental_setThreadRowStatus`:

| `icon` passed | Source | Before | After |
| --- | --- | --- | --- |
| `"probe-flat"` | `app.experimental_icons.register()` | plugin artwork
| plugin artwork |
| `"icon-probe/registered"` | `app.experimental_icons.register()` |
plugin artwork | plugin artwork |
| `"icon-probe/declared"` | `bb.branding.experimental_icons` | generic
`Zap` | **plugin's SVG** |

Tests: the declared-glyph tier resolves, a registration of the same name
shadows it, removing the registration restores it, and an undeclared
namespaced glyph still falls back. Plus a `ThreadRow` test that a
registered namespaced name draws the plugin's artwork — mutation-checked
by stubbing the status-icon pass-through, which fails it along with the
four existing plugin-status tests.

- `pnpm exec turbo run typecheck lint --filter='...[origin/main]'` — 101
tasks, clean. The filter earned its keep: editing `icon.tsx` staled the
checked-in `@bb/plugin-registry` mirror, regenerated with
`build-registry.mjs`.
- `@bb/app` 4811 passed, `@get-bb/plugin-sdk` 291 passed, `@bb/server`
2913 passed with one unrelated failure (`project-attachment-accounting`,
a timing bound) that passes in isolation.

Fixes #3204

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

> AGENT GENERATED

---------

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
SawyerHood added a commit that referenced this pull request Sep 25, 2026
## Human comments

## What was wrong

Host and runtime tests covered the same contracts at two layers.
Examples:
- `workspace-dispatch` tests that were exact twins of the `host-files`
handler tests;
- agent-runtime recovery and provider-registry tests left over after
#2325 moved recovery onto typed hints and made the registry id-agnostic;
- `managed-config` tests repeated by the server-move service tests.

Others tested a shared helper instead of their subject: the plugin-host
env test called the `process-utils` sanitizer directly and never touched
`PluginHostManager`. Two could not detect their bug:
- the concurrent skill-staging test lacks a pinned clock, so it catches
a same-millisecond temp-dir collision only by chance;
- the watcher recovery harness is env-gated and asserts constants it
hard-codes.

A few tests kept exports alive only for themselves:
`listPathsRecursively`, `diffCumulativeText`, `sendJsonRpc` and
`toJsonRpcMessage`.

## What changed

Found by a read-only test audit using the repo `test-audit` skill
(#4361).

- **Duplicate tests deleted.** Tests were tightened first where needed;
for example, the relative-path handler test now asserts the error code
and message.
- **`runtime.fake-approvals.test.ts` deleted:** its unique assertions
move into `runtime.interactive-requests.test.ts`, which now asserts the
full command approval payload (reason, cwd, actions).
- **`listPathsRecursively`:** its depth and exclusion cases now run
through `listWorkspacePaths`, and the function is no longer exported.
The dispatch test lists a nested directory.
- **`diffCumulativeText`:** its tests fold into the assembler test, and
it is no longer exported.
- **`sendJsonRpc`:** inlined into `sendJsonRpcRequest`.
`toJsonRpcMessage` is no longer exported.
- **Unchanged:** request bytes, published Plugin SDK output and
host-daemon wire shapes.
- **Not in this PR:** the opt-in root-recovery benchmark (#2666),
pending its author.

Production +4/−15, tests +176/−1080.

## How you verified

- `pnpm exec turbo run test lint typecheck` is green across host-daemon,
agent-runtime, host-watcher, host-workspace, provider-bridge-acp,
provider-bridge-protocol and provider-parity.
- The only failures are the two `command-discovery` tests that fail on
this machine when `/tmp/.agents` exists; they pass with
`TMPDIR=/var/tmp/...`.
- Off-pipeline suites:
  - provider-parity: 59/59.
  - integration `environment-actions`: 5/5.
- agent-runtime `test:integration`: only the two real-Codex tests that
also fail on base.
- An independent verifier used before and after worktrees on 175d5ac
and one mutation per removed test (39 tests).
- Result: 31 OK, 4 with no unique failure mode, 4 partial losses. All 4
are restored here, and each fails under its mutation.
- It also built `@get-bb/plugin-sdk` in both trees: `dist/` and
`bundled-types/` are byte-identical.

> 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 Oct 5, 2026
## Human comments

## What was wrong

Codex permission settings were part of the bridge construction
signature. Permission-only follow-ups rebuilt the app-server despite
Codex supporting per-turn overrides. Initial compaction also left
tracked turn permissions unset, so a later permission-changing steer
could skip the interrupt comparison.

## What changed

Remove approval policy, reviewer, and sandbox from the construction
signature while retaining other rebuild triggers. Seed tracked
permissions during construction, including activated git roots. Preserve
interrupt-and-wait before permission-changing steers start another turn
on the same process. No server/daemon wire, SDK, CLI, or database
changes.

## How you verified

- Actual built BB CLI → isolated pnpm start:worktree server → daemon →
real Codex 0.160.0/gpt-5.5: Accept-edits → Full → Accept-edits
follow-ups and both active sleep-turn steer directions. Native
app-server PID 85274 remained constant; opaque probe outputs and actual
sibling files showed DENIED/WROTE/DENIED/WROTE/DENIED. Both steers sent
turn/interrupt then turn/start; zero session/replaced notifications.
- Turbo plugin test/lint/typecheck: 337 tests passed; final 11
session-signature tests and static checks passed after test cleanup.
Ordinary replacement regressions fail against baseline;
initial-compaction coverage uses a fake app-server.
- Unchanged-permission steer through the same product path sent only
turn/steer and denied the outside write. Changing reasoning low to
medium retained the intentional construction restart: session/replaced
and native PID 50563.
- Final-head hosted CI: 31 checks passed, 3 skipped, none failed or
pending.
- Recorded Codex parity: 15 passed, one skipped, one failed for a stale
#2325 activityIntents allowlist entry (no old/new difference reported).
This remains a verification limitation.
- Product-path compaction attempt: a never-started pending thread
rejects compact with HTTP 409. After session release/resume,
first-operation compaction runs, but BB queues a requested
permission-changing steer as thread-busy; compaction completes normally
before the queued follow-up. Real compaction interruption is therefore
blocked by the existing dispatch path and is not claimed verified.

Correction on enforcement scope: restricted turns in the actual CLI
matrix used workspaceWrite/on-request/user (BB Accept-edits, user
reviewer, escalation ask), with prompts requesting no escalation; they
did not use a never/deny approval policy. Michael’s Approve for me (auto
preset) used workspaceWrite/on-request/auto_review and approved his
explicit outside write. An additional actual-BB user-review control
requested escalation, was denied via BB CLI, and left the target absent.
Sandbox selection alone does not imply every outside write must fail.

Required verification gap: real-provider initial compaction
permission-changing interruption remains harness-covered only. No merge
requested.

> AGENT GENERATED
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant