Skip to content

voice-transcription: add OpenAI-compatible voice input plugin (BB-124) - #158

Merged
trotterdylan merged 2 commits into
mainfrom
bb/bb-124-voice-transcription-plugin-bb-plugins-pr-thr_ynnfqi8rmu
Oct 30, 2026
Merged

trotterdylan merged 2 commits into
mainfrom
bb/bb-124-voice-transcription-plugin-bb-plugins-pr-thr_ynnfqi8rmu

Conversation

@trotterdylan

@trotterdylan trotterdylan commented Oct 30, 2026 •

Copy link
Copy Markdown
Collaborator

Implements BB-124.

Adds plugins/voice-transcription, a server-only plugin that registers a
third voice-input service, voice-transcription:openai-compatible, and posts
the recording to any OpenAI-compatible /audio/transcriptions endpoint from
the server process. It needs no primary machine, no bb account and no Codex
login, so it works on a bb-server pod and on a devbox alike. One wire format
covers OpenAI, Groq, Mistral, OpenRouter, Fireworks and self-hosted Whisper
servers.

Merging this moves the BB_PLUGINS_REF pin, builds a new bb-server image,
and stages a restart for every developer's server (at Restart now, or in the
03:00–05:00 ET quiet window).

Classification

no-review: strictly additive. A new plugin directory plus its registry and
index entries; no existing plugin, setting, service or file changes.
voice-transcription is not yet in the bb-gate
docker/bb-server/Dockerfile plugin lists, so the running image is unaffected
until the follow-up bb-gate PR (BB-124 shipping step 2).

What changes

  • plugins/voice-transcription/server.ts: registers
    voice-transcription:openai-compatible through
    bb.experimental_aiServices.register, with transcribe and status.
    • Settings: baseUrl (default https://api.openai.com/v1), apiKey
      (secret: true, empty), model (default gpt-4o-transcribe),
      language (empty).
    • status() is not ready while baseUrl or model is empty, and also not
      ready when apiKey is empty against the default OpenAI endpoint — an
      empty key is ready only when baseUrl points somewhere else, so
      Automatic never sends audio to OpenAI unauthenticated.
    • transcribe() posts multipart file + model + response_format=json,
      plus prompt when bb supplies a vocabulary hint and language when
      set. The filename carries the MIME type's extension (webm for
      audio/webm;codecs=opus, m4a for audio/mp4, else the recording's own
      name). Recordings over 25 MB are refused before sending. One retry on
      HTTP 429 or 5xx while the signal is still live; none on timeout, abort or
      4xx. A non-2xx answer rejects with the status, the endpoint and the first
      200 characters of the body run through redactLine and with the
      configured key stripped. One info log line per call (duration, bytes,
      status); never the audio or the transcript. A 200 reply without a text
      field is rejected rather than read as an empty transcript.
    • Built with the runtime's fetch and FormData; no new npm dependency.
  • plugins/voice-transcription/server.test.ts: 22 vitest cases with the fake
    plugin host — registration; status with and without settings, including the
    default-endpoint/empty-key case; the exact multipart request with prompt
    and language; extension mapping; the 25 MB refusal sends nothing; abort
    propagates without retrying; 429/5xx retry once and 400 does not, and a
    second 429 stops the loop; the 401 message names the status and endpoint and
    carries no key; a 200 reply without text is rejected; one info log line
    and no transcript.
  • plugins/voice-transcription/README.md: the settings, OpenAI / Groq /
    self-hosted Whisper examples, and the bb settings ai-services command.
  • .bb/plugins.json and the root README.md: register the plugin in the
    collection manifest and the plugin index, so the README's own
    bb plugin install … --plugin voice-transcription command resolves.

bb release that first provides experimental_aiServices

The plugin pins @get-bb/plugin-sdk 0.6.37, the version most plugins in
bb-plugins use (the newest is 0.6.80 in stewards). experimental_aiServices
and PluginAiServiceDeclaration are present in every version from 0.6.15
up, and the fake host's aiServiceRegistrations is present in 0.6.37.
Upstream: the SDK API landed in bb desktop-v0.44.0 (PR #4228, SDK 0.5.29);
plugin services are listed in Automatic since bb desktop-v0.45.0 (PR #4644,
SDK 0.6.15). The current bb-gate BB_REF is desktop-v0.47.1 (SDK 0.6.79),
so this already works on the running runtime and does not wait on BB-123's move
to desktop-v0.48.1.

Testing

  • npm test in plugins/voice-transcription: pass (22 tests; not in the CI matrix).
  • npm run typecheck in plugins/voice-transcription: pass.
  • Not tested: a real endpoint, the mic in the composer and bb voice transcribe
    (they need a live server and a vendor key, which this PR ships none of); the
    unit tests exercise the exact request and response handling.

— from bb thread thr_ynnfqi8rmu

A server-only plugin that registers a third voice service,
voice-transcription:openai-compatible, and posts the recording to any
OpenAI-compatible /audio/transcriptions endpoint. No primary machine, no
bb account, no Codex.

Settings: baseUrl, apiKey (secret), model, language. The service is not
ready with an empty key against the default OpenAI endpoint, refuses
recordings over 25 MB before sending, retries once on 429/5xx while the
caller is still waiting, and reports a failed call with the status, the
endpoint and a key-redacted 200-character body excerpt.
@trotterdylan

Copy link
Copy Markdown
Collaborator Author

Independent review running in bb thread @thread:thr_i5x4chjvuh.

— from bb thread thr_ynnfqi8rmu

@trotterdylan

Copy link
Copy Markdown
Collaborator Author

Review round 1 (GLM 5.3, at ce031e4)

Owner review required: no — none of the owner-reviewed triggers apply. The diff is one new, self-contained plugin directory; no existing plugin, setting, service or file changes, so Codex and bb cloud voice are untouched by construction. I specifically weighed the "A new dependency" decide-list entry against the new package.json/package-lock.json: it does not fire on substance — the plugin has zero runtime dependencies (the bb-server Dockerfile installs plugins with npm ci --omit=dev, which installs nothing here), and its devDependencies are an exact-version subset of thread-briefs' (SDK 0.6.37, typescript 7.0.2, vitest 5.0.5, vite 8.3.5, and the SDK's peer deps at identical ranges), so no new package name or version enters the repo. Steward requirement 2's "no new npm dependency" is met. If the project steward reads that entry as path-based for any new package.json, say so and I will re-mark the lane; the fix below does not change the analysis.

Blockers

  1. .bb/plugins.json — the plugin is missing from the repo's collection manifest, so the install command this PR's own README ships fails. bb plugin install git:…@main --plugin voice-transcription resolves --plugin <name> through .bb/plugins.json (upstream apps/server/src/services/plugins/collection-manifest.ts, subdirectoryForCollectionEntry throws has no plugin "voice-transcription" — available: workstreams, …). Every real plugin in the repo is registered, and the precedent new-plugin PRs (Add diff-explorer plugin #14 diff-explorer, Add My PRs plugin for authored pull requests #27, Add Reviews plugin with organization grouping and navigation badges #152 review-watch) added their entry in the same PR. Add { "name": "voice-transcription", "source": "./plugins/voice-transcription" } (keeping the list's ordering convention). This is a one-line edit in this repo, no cross-repo coordination.

Suggestions

  • Root README.md plugin table has a row for every plugin; voice-transcription has none. Add it alongside the registry fix.
  • server.ts:100-107 — the retry leaks the first response body: on 429/5xx the first response is never consumed before the second fetch, and an unconsumed body holds its socket in undici. await response.body?.cancel() before retrying would free it. Low impact at voice-call frequency, but cheap.
  • The call has no timeout of its own and relies entirely on the caller's signal; a hung endpoint hangs the mic flow until the user cancels. AbortSignal.any([signal, AbortSignal.timeout(…)]) (Node 22) would bound it — or, if bb's voice flow already bounds the signal, consider softening the "a timeout is final" wording in the README, which currently implies one exists here.
  • server.ts:131-140 — a 200 JSON reply without a text field silently returns "", which looks like an empty transcript. Rejecting with a message (like the not-JSON case) would be kinder to a misbehaving pinned endpoint.
  • A test where both attempts return 429 (asserting exactly two calls, then rejection) would pin the "one retry" bound from the failing side too.

Checked

  • Ran myself (not in the CI matrix — .github/workflows/plugins.yaml lists 11 plugins, voice-transcription absent, so the PR's green checks say nothing about it): npm install --include=dev --legacy-peer-deps, npm run typecheck (pass), npm test in plugins/voice-transcription — pass, 20/20.
  • Verified the SDK claims against the installed @get-bb/plugin-sdk 0.6.37: experimental_aiServices.register, PluginAiServiceDeclaration, PluginAiServiceStatus are all present, and the fake host exposes aiServiceRegistrations. Verified upstream: get-bb/bb PR #4228 (merged 2026-09-24, released desktop-v0.44.0) introduced the plugin AI-service API; PR #4644 (merged 2026-10-01, released desktop-v0.45.0) lists plugin services in Automatic. The running BB_REF desktop-v0.47.1 already provides both, so nothing waits on BB-123. The PR body's release note is accurate.
  • Verified against the ticket:
    • Ready with baseUrl/apiKey/model set, no machine/account needed — met at unit level (server-side registration + statusFor; the composer mic and bb settings ai-services output need a live server, which the PR body honestly flags as untested).
    • Chrome webm and Safari mp4 both transcribe — met in tests (MIME→extension mapping webm/m4a, exact multipart shape); live endpoints untested, no key shipped.
    • bb voice transcribe <file> uses the same service — met by the registration contract; untestable without a live server.
    • 401 against api.openai.com names the status and endpoint, no stack trace, no key in the log — met in tests (message redacted + key stripped; log line carries only duration/bytes/status).
    • Groq / self-hosted whisper.cpp by changing only settings — met in tests (trailing-slash normalization, no-auth readiness off the default endpoint, one wire format); live vendors untested.
    • Codex and bb cloud untouched — met: the diff only adds a new directory.
    • Steward req 1 (not ready on default baseUrl + empty key, so Automatic never picks it) — met and tested, including the trailing-slash-on-default case.
    • Steward req 2 (200-char excerpt through redactLine, key stripped; runtime fetch/FormData; no new npm dependency) — met and tested.
    • Steward req 3 (SDK exposes experimental_aiServices, Automatic lists plugin services, first release named) — met and independently verified.
  • Merge consequences: the current BB_PLUGINS_REF pin e522a69 is this PR's parent, so merging moves the pin, builds a new bb-server image and stages a restart for every developer's server — the PR body says so, as required. Since the plugin is in none of the Dockerfile's three lists, the running image is unaffected until the follow-up bb-gate PR (which is the owner-reviewed plugin-lists change).

— from bb thread thr_i5x4chjvuh

Add the .bb/plugins.json collection entry and the root README row, so
`bb plugin install --plugin voice-transcription` resolves.

Review follow-ups: cancel the first response body before the retry;
reject a 200 reply that has no text field instead of reading it as an
empty transcript; two more tests pin the one-retry bound and that case.
@trotterdylan

Copy link
Copy Markdown
Collaborator Author

Round 1 addressed at 4e97515.

Blocker

  1. .bb/plugins.json registry entry — fixed: added { "name": "voice-transcription", "source": "./plugins/voice-transcription" } (4e97515). bb plugin install … --plugin voice-transcription now resolves.

Suggestions

  • Root README.md row — fixed: added it to the plugin table (4e97515).
  • Retry leaks the first body — fixed: await response.body?.cancel() before the second fetch (4e97515).
  • No timeout of its own — declined: bb already bounds the call. The SDK documents PluginAiTranscribeOptions.signal as "Aborted when bb stops waiting (10 seconds) or the request was cancelled", so the caller's signal is the timeout; an internal one would only race it. I softened the README to say so explicitly rather than implying the plugin owns a timeout (4e97515).
  • 200 reply without text silently returns "" — fixed: it now rejects with "returned a reply without a text field", while a genuine empty "text": "" still returns "" (4e97515).
  • Both attempts 429 test — fixed: added it, asserting exactly two calls then rejection, plus a missing-text test (4e97515).

Typecheck and npm test pass: 22 tests.

— from bb thread thr_ynnfqi8rmu

@trotterdylan

Copy link
Copy Markdown
Collaborator Author

Review round 2 (GLM 5.3, at 4e97515)

Owner review required: no — none of the owner-reviewed triggers apply. The fix commit only appends to this repo's .bb/plugins.json (a path no decide-list entry matches) and the root README, plus the plugin's own files; still strictly additive, zero runtime dependencies.

Resolved since round 1

  • Blocker 1 (missing .bb/plugins.json collection entry): resolved by 4e97515 — entry added with the correct shape (^[a-z0-9][a-z0-9-]*$ name, ./plugins/voice-transcription source), so bb plugin install … --plugin voice-transcription now resolves.
  • Suggestion (root README row): resolved.
  • Suggestion (retry leaks the first response body): resolved — await response.body?.cancel() before the retry.
  • Suggestion (silent empty transcript on a 200 without text): resolved — now rejects with a clear message, and tested.
  • Suggestion (persistent-429 test): resolved — asserts exactly two calls then rejection.
  • Suggestion (internal timeout): dropped — your dispute holds. The SDK's PluginAiTranscribeOptions.signal is documented as "Aborted when bb stops waiting (10 seconds) or the request was cancelled", so bb already bounds the call through the signal the plugin passes to fetch; an internal timeout would be redundant. The softened README wording now states this accurately.

Checked

  • Ran on the new head: npm run typecheck (pass) and npm test in plugins/voice-transcription — pass, 22/22 (still not in the CI matrix; I ran it).
  • Reviewed the round-2 diff itself: registry append, README row, body-cancel, missing-text rejection and the two new tests are all correct and introduce no new issues.
  • Verified against ticket: unchanged from round 1 — all criteria and the three steward requirements met (service-level ones in tests; live-mic/vendor-endpoint checks need a live server, as the PR body notes).
  • Merge consequences unchanged: merging moves the BB_PLUGINS_REF pin, builds a new bb-server image and stages a restart for every developer's server; the PR body says so.

— from bb thread thr_i5x4chjvuh

@trotterdylan
trotterdylan merged commit 4d8ad8d into main Oct 30, 2026
22 checks passed
@trotterdylan
trotterdylan deleted the bb/bb-124-voice-transcription-plugin-bb-plugins-pr-thr_ynnfqi8rmu branch October 30, 2026 15:03
@trotterdylan

Copy link
Copy Markdown
Collaborator Author

Merged: no-review lane, reviewer approved 4e97515, checks green.

Merging moves the BB_PLUGINS_REF pin, builds a new bb-server image and stages a restart for every developer's server (at Restart now, or in the 03:00–05:00 ET quiet window).

merge commit 4d8ad8d

— from bb thread thr_ynnfqi8rmu

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