← reports

#5016 · Codex transcription request budget mismatch

Bug Medium Effort: Low providers provider-codex · GitHub issue · October 6, 2026

Trusted base: fd31b75fb9c7f40e68747089c911b098763aa851

Verdict: REPRODUCED · Root-cause confidence: high · Reproduction label: confirmed-repro

1. TL;DR

Voice transcription through the Codex service aborts requests after 10 seconds even though the core voice task allows 70 seconds. A deterministic reproduction loads the actual service registration and actual host transcription implementation, then substitutes only credentials, HTTP response timing, and the host transport. Successful HTTP responses scheduled after 12 seconds and 64 seconds both fail with the production timeout error. A second clean checkout at the same trusted main commit produces the same failures. This verifies the deadline defect, not the report's live-endpoint latency measurements or an audio-duration threshold.

2. Claims vs findings

ClaimStatusEvidence
The Codex service imposes a shorter transcription budget than core.Verified10,000 ms provider request and 11,000 ms host RPC versus 70,000 ms core voice task.
A transcription requiring more than 10 seconds cannot complete through the service.VerifiedBoth delayed-response cases fail in two trusted-base checkouts with codex_request_timeout.
Natural speech of a particular duration always exceeds the deadline.UnverifiedNo real audio or live account was used. The threshold depends on upstream latency and upload time.
Older npm releases, bb Connect, and retries show the same live behavior.UnverifiedThis investigation tests current main only, without the production instance or tunnel.
Very long audio may return an incomplete transcript without error.Unverified; separate concernA larger deadline alone does not establish or repair upstream transcript completeness.

3. Environment

4. Minimal reproduction

  1. Clone the trusted repository and check out the recorded commit.
  2. Install and build trusted code, copy the supplied regression test and test configuration into their existing subsystem, and run the focused test:
git clone https://github.com/get-bb/bb.git bb-5016
cd bb-5016
git checkout --detach fd31b75fb9c7f40e68747089c911b098763aa851
pnpm install --frozen-lockfile --prefer-offline
pnpm exec turbo run build --filter=bb-plugin-provider-codex...
curl -fsS https://get-bb.github.io/reports/issues/5016/repro/ai-service-deadline.test.ts -o plugins/provider-codex/src/ai-service-deadline.test.ts
curl -fsS https://get-bb.github.io/reports/issues/5016/repro/vitest.config.ts -o plugins/provider-codex/vitest.config.ts
pnpm exec turbo run test --filter=bb-plugin-provider-codex -- src/ai-service-deadline.test.ts

Expected: both cases return A completed voice note. Actual: exit 1; both return the production timeout error instead.

AiServiceFailure {
  "message": "Codex request timed out after 10000ms",
  "code": "timeout",
  "detailCode": "codex_request_timeout",
  "name": "AiServiceFailure",
}
Test Files  1 failed (1)
     Tests  2 failed (2)

The test uses fake time but runs real registerCodexAiService, contract validation, transcribeCodexVoice, request cancellation, and response parsing. The SDK testing harness does not implement the remote host transport deadline, so its 11-second cap is source-verified rather than transport-reproduced here. See the test, test configuration, and complete sanitized first-run output.

Complete regression test
import { createFakePluginHost } from "@get-bb/plugin-sdk/testing";
import { afterEach, expect, it, vi } from "vitest";
import { registerCodexAiService } from "./ai-service.js";
import { transcribeCodexVoice } from "./ai/chatgpt-client.js";
import { codexAiTranscribeInputSchema } from "./ai/host-contract.js";

vi.mock("./ai/codex-auth.js", async (importOriginal) => ({
  ...(await importOriginal<typeof import("./ai/codex-auth.js")>()),
  readCodexAuthCredentials: async () => ({
    type: "chatgpt",
    accessToken: "synthetic-test-token",
    accountId: "synthetic-test-account",
    accountEmail: null,
    expired: false,
    isFedrampAccount: false,
  }),
}));

afterEach(() => {
  vi.useRealTimers();
  vi.unstubAllGlobals();
});

it.each([12_000, 64_000])(
  "returns a transcript when the endpoint responds after %i ms",
  async (responseMs) => {
    vi.useFakeTimers({
      toFake: ["setTimeout", "clearTimeout", "performance"],
    });
    vi.stubGlobal(
      "fetch",
      vi.fn<typeof fetch>(async (_input, init) => {
        const signal = init?.signal;
        if (!signal) throw new Error("Missing request cancellation signal");
        return new Promise<Response>((resolve, reject) => {
          const abort = () => {
            clearTimeout(responseTimer);
            reject(new DOMException("Request aborted", "AbortError"));
          };
          const responseTimer = setTimeout(() => {
            signal.removeEventListener("abort", abort);
            resolve(Response.json({ text: "A completed voice note" }));
          }, responseMs);
          signal.addEventListener("abort", abort, { once: true });
        });
      }),
    );
    const { bb, harness } = createFakePluginHost({
      sdk: { system: { config: async () => ({ primaryHostId: "host-1" }) } },
      experimental_callHostRpc: async (call) => ({
        ok: true,
        text: await transcribeCodexVoice(
          codexAiTranscribeInputSchema.parse(call.input),
          call.signal ?? new AbortController().signal,
        ),
      }),
    });
    registerCodexAiService(bb);
    const [service] = harness.registrations.aiServiceRegistrations;
    if (!service?.transcribe) throw new Error("Missing voice service");

    const result = service
      .transcribe(
        new File(["synthetic audio"], "note.webm", { type: "audio/webm" }),
        { signal: new AbortController().signal, hint: null },
      )
      .catch((error: unknown) => error);
    await vi.advanceTimersByTimeAsync(responseMs);
    await expect(result).resolves.toBe("A completed voice note");
  },
);

5. Root cause

The server-side Codex service chooses TRANSCRIBE_TIMEOUT_MS = 10_000. It sends that value as the existing host request's timeoutMs and gives the host RPC only one additional second. The host transcription implementation creates a deadline from that input and aborts HTTP when it expires. The core's longer task deadline cannot extend either inner deadline.

6. Proposed fix

Raise the Codex service transcription budget to the existing 65-second cloud transcription budget. Its host RPC then automatically becomes 66 seconds, leaving headroom beneath core's 70-second budget. Preserve the existing size limit, cancellation signal, text-completion budget, and host contract. The existing host implementation accepts an explicit positive timeout and can enforce the new value without a schema or protocol change; the regression uses that unchanged implementation.

7. Related work

No open pull request linked to this issue appeared in issue timeline metadata or the open-PR search during preparation. The report's separate long-recording completeness concern is not addressed by the proposed fix.

8. Verification

The same agent repeated the reproduction in a second clean temporary checkout at fd31b75fb9c7f40e68747089c911b098763aa851. Only the newly authored test was added; the saved test configuration is the original portable plugin configuration, and production code stayed unchanged. After a fresh frozen install and relevant Turbo dependency build, the exact focused command from section 4 again exited 1 with two timeout failures. Second-checkout output. This is a repeated clean run, not independent-agent verification.

An initial test iteration produced extra unhandled-rejection warnings because an assertion promise rejected before it was awaited. The test now captures the production rejection before advancing fake time. Both final clean-run logs show only the intended assertion failures, and the root-cause conclusion is unchanged. Every root-cause permalink was checked against the recorded commit. This is a nonvisual regression, so no screenshots are claimed.

9. Appendix and trust boundary

Issue text and comments were treated only as untrusted claims. No issue-supplied command, code, external media, branch, or linked URL was executed or fetched. The regression was independently authored from trusted main source. No secrets or production runtime data were read. The exact commands above, the two complete sanitized logs, and the saved test/configuration are the repeatable artifacts; fake elapsed times must not be interpreted as real endpoint benchmarks.

> AGENT GENERATED