← reports

#7123 · Credential errors bypass Codex recovery

Bug Medium priority Medium effort providers provider-codex GitHub issue
November 5, 2026 · trusted main fa30b0a7dcdf745f7baf8e41721f754b7d3198fe

Verdict: PARTIALLY REPRODUCED · Root-cause confidence: high for the bridge recovery gap

1. TL;DR

A credential-loading failure delivered by Codex can end a BB turn without arranging a fresh Codex child session for the next turn. Running BB's actual bridge and translator against a controlled app-server process confirms this for a missing category, an unknown category, and a stream-disconnection category. The first two cases miss the authentication text matcher; the third exits before text matching. A structured unauthorized control does rebuild and retains the provider thread identity, while a plain stream-disconnection control does not rebuild. We did not reproduce AWS SSO expiration itself or demonstrate that restarting Codex repairs a real AWS credential provider; those parts remain unverified.

2. Claims vs findings

ClaimFindingEvidence
The reported terminal credential message can miss session recovery.Verified at the real bridge boundaryThree failing recovery expectations in each clean run; error deltas contain the fixture diagnostic, but recovery and session-replacement lists are empty.
A generic stream category may hide more specific text.Verified for a supported stream-disconnection categoryThe native responseStreamDisconnected object becomes stream-disconnected and the classifier returns null before scanning text.
Recognized authentication errors restore the same provider thread on a later turn.Verified at the simulated-provider boundaryThe unauthorized control emits authRequired with retryable:false; the next explicit turn emits sessionReplaced with the same providerThreadId and contextLost:false.
A fresh process fixes expired or stale AWS credential state.UnverifiedNo AWS accounts, SSO tokens, credentials, Bedrock calls, or real installed macOS runtime were accessed.
Existing authentication recovery automatically retries the failed turn.Not supported by the inspected pathThe bridge emits retryable:false and sets a next-turn rebuild flag. The runtime forwards unsolicited auth hints; it does not schedule a retry for authRequired.
The original failing event had a particular structured category.UnverifiedNo original native event was supplied. The reproduction deliberately varies category as a controlled input.

3. Environment

4. Minimal reproduction

Save the complete regression test and diagnostic-only JSON fixture shown below as issue-7123.test.ts and issue-7123-error.json. The fixture is untrusted text data, never executable code. The test was designed from trusted bridge APIs and the repository's native fake-process harness; no issue-supplied test or script was executed. All evidence is embedded in this HTML; local artifact files are retained outside the public reports repository under its publication policy.

  1. Make a clean checkout and install pinned dependencies:
    git clone https://github.com/get-bb/bb.git bb-7123
    cd bb-7123
    git checkout --detach fa30b0a7dcdf745f7baf8e41721f754b7d3198fe
    pnpm install --frozen-lockfile --prefer-offline
    pnpm exec turbo run build --filter=@get-bb/plugin-sdk
  2. Save the two inline blocks to plugins/provider-codex/src/bridge/, using the filenames above.
  3. Run the focused regression (a nonzero exit is expected on the unchanged base):
    pnpm exec turbo run test --force --filter=bb-plugin-provider-codex -- src/bridge/issue-7123.test.ts
  4. Run the existing relevant suites:
    pnpm exec turbo run test --filter=bb-plugin-provider-codex -- src/bridge/bridge.recovery.test.ts src/bridge/bridge.rate-limit-recovery.test.ts src/translator.test.ts

Every case resumes a thread, dispatches a failed turn through the native protocol, waits for a real failed boundary and provider error, then explicitly dispatches a second turn. The cursor survives a child restart, so the positive control follows the same sequence even after reconstruction. The test observes public recovery and replacement notifications, not a private predicate.

Diagnostic / categoryExpected recovery hints / next-turn replacementsActual, both runs
Credential message / missing1 / 10 / 0 — regression fails
Credential message / other → unknown1 / 10 / 0 — regression fails
Credential message / responseStreamDisconnected → stream-disconnected1 / 10 / 0 — regression fails
Credential message / unauthorized (positive control)1 / 11 / 1 — passes, preserves identity
Ordinary disconnect / responseStreamDisconnected (negative control)0 / 00 / 0 — passes

Verbatim meaningful failure and suite totals:

AssertionError: expected { recoveryHints: +0, replacements: +0 } to deeply equal { recoveryHints: 1, replacements: 1 }
Test Files  1 failed (1)
Tests  3 failed | 2 passed (5)

Existing relevant suites:
Test Files  3 passed (3)
Tests  58 passed (58)
Complete regression test
import { mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs";
import { tmpdir } from "node:os";
import { join } from "node:path";
import { afterEach, beforeEach, expect, it, vi } from "vitest";
import { z } from "zod";
import { BRIDGE_NOTIFICATION_METHODS } from "@get-bb/plugin-sdk/provider-bridge";
import { experimental_createBridgeJsonRpcTestHarness as createHarness } from "@get-bb/plugin-sdk/provider-bridge/testing";
import type { BridgeJsonRpcTestHarness } from "@get-bb/plugin-sdk/provider-bridge/testing";
import { handleLine } from "./bridge.js";
import {
  FULL_ACCESS_SESSION_OPTIONS,
  stubFakeCodexAppServer,
} from "./fake-codex-app-server-harness.js";

const fixture = z
  .object({ message: z.string().min(1).max(1000) })
  .parse(
    JSON.parse(
      readFileSync(new URL("./issue-7123-error.json", import.meta.url), "utf8"),
    ),
  );
const threadId = "thr_issue7123_repro";
const providerThreadId = "issue7123-provider";
const deltaSchema = z.object({
  deltas: z.array(z.object({ kind: z.string() }).passthrough()),
});
let harness: BridgeJsonRpcTestHarness | undefined;
let workspaceDir: string;

function notifications(method: string) {
  return (
    harness?.messages
      .filter((message) => message.method === method)
      .map((message) => message.params) ?? []
  );
}

function deltas() {
  return notifications("thread/delta").flatMap(
    (params) => deltaSchema.parse(params).deltas,
  );
}

beforeEach(() => {
  workspaceDir = mkdtempSync(join(tmpdir(), "bb-issue7123-"));
});

afterEach(async () => {
  if (harness !== undefined) {
    harness.sendRequest(99, "thread/stop", {
      threadId,
      providerThreadId,
      intent: "release",
      activeTurnId: null,
    });
    await harness.waitForResponse(99);
    harness.restore();
    harness = undefined;
  }
  vi.unstubAllEnvs();
  rmSync(workspaceDir, { recursive: true, force: true });
});

it.each([
  {
    name: "credential text without a category",
    errorInfo: undefined,
    credential: true,
    recover: true,
  },
  {
    name: "credential text with an unknown category",
    errorInfo: "other",
    credential: true,
    recover: true,
  },
  {
    name: "credential text with a stream category",
    errorInfo: { responseStreamDisconnected: { httpStatusCode: 502 } },
    credential: true,
    recover: true,
  },
  {
    name: "structured unauthorized control",
    errorInfo: "unauthorized",
    credential: true,
    recover: true,
  },
  {
    name: "ordinary stream disconnection control",
    errorInfo: { responseStreamDisconnected: { httpStatusCode: 502 } },
    credential: false,
    recover: false,
  },
])(
  "$name",
  async ({ name, errorInfo, credential, recover }) => {
    const message = credential ? fixture.message : "Connection closed by peer";
    const scriptPath = join(workspaceDir, "script.json");
    writeFileSync(
      scriptPath,
      JSON.stringify({
        turnCursorPath: join(workspaceDir, "cursor"),
        turns: [
          [
            {
              method: "turn/started",
              params: {
                threadId: "x",
                turn: { id: "failed-turn", status: "inProgress" },
              },
            },
            {
              method: "error",
              params: {
                threadId: "x",
                turnId: "failed-turn",
                error: { message, codexErrorInfo: errorInfo },
                willRetry: false,
              },
            },
            {
              method: "turn/completed",
              params: {
                threadId: "x",
                turn: { id: "failed-turn", status: "failed" },
              },
            },
          ],
          [
            {
              method: "turn/started",
              params: {
                threadId: "x",
                turn: { id: "next-turn", status: "inProgress" },
              },
            },
            {
              method: "turn/completed",
              params: {
                threadId: "x",
                turn: { id: "next-turn", status: "completed" },
              },
            },
          ],
        ],
      }),
    );
    stubFakeCodexAppServer(scriptPath);
    harness = createHarness(handleLine);
    harness.sendRequest(1, "thread/resume", {
      threadId,
      providerThreadId,
      cwd: workspaceDir,
      instructionMode: "append",
      options: { ...FULL_ACCESS_SESSION_OPTIONS },
    });
    expect((await harness.waitForResponse(1)).error).toBeUndefined();
    harness.sendRequest(2, "turn/start", {
      threadId,
      providerThreadId,
      clientRequestId: "creq_cdxrcvry22",
      input: [{ type: "text", text: "first", mentions: [] }],
      options: { ...FULL_ACCESS_SESSION_OPTIONS },
    });
    expect((await harness.waitForResponse(2)).error).toBeUndefined();
    await vi.waitFor(
      () =>
        expect(deltas()).toContainEqual(
          expect.objectContaining({ kind: "turn.boundary", status: "failed" }),
        ),
      { timeout: 5000 },
    );
    expect(deltas()).toContainEqual(
      expect.objectContaining({ kind: "provider.error", detail: message }),
    );
    harness.sendRequest(3, "turn/start", {
      threadId,
      providerThreadId,
      clientRequestId: "creq_cdxrcvry23",
      input: [{ type: "text", text: "second", mentions: [] }],
      options: { ...FULL_ACCESS_SESSION_OPTIONS },
    });
    expect((await harness.waitForResponse(3)).error).toBeUndefined();
    await vi.waitFor(
      () =>
        expect(deltas()).toContainEqual(
          expect.objectContaining({
            kind: "turn.boundary",
            status: "completed",
          }),
        ),
      { timeout: 5000 },
    );
    const recovery = notifications(
      BRIDGE_NOTIFICATION_METHODS.providerRecovery,
    );
    const replacements = notifications(
      BRIDGE_NOTIFICATION_METHODS.sessionReplaced,
    );
    console.info(
      JSON.stringify({
        name,
        errors: deltas().filter((delta) => delta.kind === "provider.error"),
        recovery,
        replacements,
      }),
    );
    expect({
      recoveryHints: recovery.length,
      replacements: replacements.length,
    }).toEqual({
      recoveryHints: recover ? 1 : 0,
      replacements: recover ? 1 : 0,
    });
    if (recover) {
      expect(recovery).toContainEqual(
        expect.objectContaining({ kind: "authRequired", retryable: false }),
      );
      expect(replacements).toContainEqual(
        expect.objectContaining({
          threadId,
          providerThreadId,
          contextLost: false,
        }),
      );
    }
  },
  15000,
);
Diagnostic fixture, used only as data
{
  "message": "stream disconnected before completion: failed to load AWS credentials: an error occurred while loading credentials"
}

5. Root cause

Two classifier paths miss the credential-specific failure

Authentication text matching and category precedence: the matcher recognizes HTTP 401/403 and auth/unauthorized words, but not the fixture's credential-loading diagnostic. A known category other than unauthorized or rate-limit returns before this fallback. Thus widening only the matcher would still miss the tested stream category.

const CODEX_AUTH_REQUIRED_TEXT_PATTERN =
  /\b(?:40[13]|auth(?:entication|orization)?|unauthori[sz]ed)\b/i;
const CODEX_RATE_LIMITED_TEXT_PATTERN =
  /\b(?:429|credits?|quota|rate[-\s]?limit(?:ed)?|usage limit)\b/i;

function classifyTerminalAccountError(
  delta: Extract<ThreadDelta, { kind: "provider.error" }>,
): "authRequired" | "rateLimited" | null {
  const category = delta.errorInfo?.category;
  if (category === "unauthorized") {
    return "authRequired";
  }
  if (category === "rate-limit") {
    return "rateLimited";
  }
  if (category !== undefined && category !== "unknown") {
    return null;
  }
  const text = [delta.message, delta.detail]
    .filter((part) => part !== undefined)
    .join("\n");
  if (CODEX_AUTH_REQUIRED_TEXT_PATTERN.test(text)) {
    return "authRequired";
  }
  if (CODEX_RATE_LIMITED_TEXT_PATTERN.test(text)) {
    return "rateLimited";
  }
  return null;
}

Native category translation maps other to unknown and responseStreamDisconnected to stream-disconnected. Both mappings were observed in emitted provider.error deltas; the latter is not an unknown-category fallback.

      case "unauthorized":
        return "unauthorized";
      case "badRequest":
        return "bad-request";
      case "threadRollbackFailed":
        return "thread-rollback-failed";
      case "sandboxError":
        return "sandbox";
      case "other":
        return "unknown";
    }
  }
  if ("httpConnectionFailed" in errorInfo) {
    return "connection-failed";
  }
  if ("responseStreamConnectionFailed" in errorInfo) {
    return "connection-failed";
  }
  if ("responseStreamDisconnected" in errorInfo) {
    return "stream-disconnected";
  }
  if ("responseTooManyFailedAttempts" in errorInfo) {
    return "too-many-failed-attempts";

No classification means no pending reconstruction

Terminal error recovery notification returns without setting rebuildBeforeNextTurnReason when classification returns null. A recognized unauthorized event sets the flag and emits a non-retryable authRequired hint.

function emitTerminalAccountErrorHint(
  session: CodexBridgeSession,
  delta: Extract<ThreadDelta, { kind: "provider.error" }>,
): void {
  const kind = classifyTerminalAccountError(delta);
  if (kind === null) {
    return;
  }
  const message = delta.detail ?? delta.message;
  session.rebuildBeforeNextTurnReason =
    kind === "authRequired"
      ? "codex session restarted after an authentication failure so a new login can take effect."
      : "codex session restarted after a rate limit so a refreshed account state can take effect.";
  sendNotification(BRIDGE_NOTIFICATION_METHODS.providerRecovery, {
    threadId: session.bbThreadId,
    kind,
    message,
    retryable: false,
  });
}

Next-turn session selection only reconstructs a live unchanged session when the pending flag is set. The failed cases therefore emit no session-replacement notification on the second dispatch, whereas the positive control does.

  if (session.connection === null || session.connection.exited) {
    session = await rebuildThreadSession(
      session,
      params.options,
      "codex app-server exited; the session was restored from its rollout.",
    );
  } else if (session.rebuildBeforeNextTurnReason !== null) {
    session = await rebuildThreadSession(
      session,
      params.options,
      session.rebuildBeforeNextTurnReason,
    );
  } else if (signature !== session.constructionSignature) {
    session = await rebuildThreadSession(
      session,
      params.options,
      "Execution settings changed; the codex session was rebuilt to apply them.",
    );
  }

Reconstruction and bounded automatic replay are separate contracts

Runtime hint handling forwards recovery hints and only schedules a bridge restart for restartRecommended. A broader solution must not assume mapping this diagnostic to authRequired supplies a one-shot automatic retry, prevents completed tool replay, identifies expired SSO login, or proves that process replacement repairs AWS state. None of those claims was established by this controlled reproduction.

6. Proposed fix and safety decision

At the provider bridge, recognize a narrow credential-loading signature from the diagnostic before generic stream-category early returns, while preserving structured unauthorized/rate-limit behavior and the plain-disconnect negative control. Reuse the existing restoration path and add a bridge-level regression like this artifact, rather than exporting a new test-only classifier. Do not classify every transport or AWS failure as expired login.

Before adding automatic retry, capture the real native category and establish, using a dedicated isolated test account, whether an expired credential provider is recovered by a fresh process or requires SSO reauthentication. Validate a strict retry budget, stable thread history, and no completed-tool replay at the actual retry owner. A restart must not be presented as a substitute for reauthentication.

No pull request was attempted. Only the deterministic bridge gap was reproduced, not the real credential-expiry workflow. Authentication recovery is also expressly excluded from this rule's simple-fix scope. No production source was modified, no fix branch was pushed, and no dependency, protocol, or stored data was changed.

7. Verification

The same agent repeated the reproduction in a second new checkout at the exact trusted SHA, verified it was clean before adding the two reproduction files, performed a separate frozen install, and built SDK runtime dependencies. Each case obtained a fresh temporary workspace and process peer; no ports were used. The second command included --force, and Turbo reported zero cached tasks.

Checkout: <work>/verify
Base: fa30b0a7dcdf745f7baf8e41721f754b7d3198fe
Initial git status --porcelain: empty
Command: pnpm exec turbo run test --force --filter=bb-plugin-provider-codex -- src/bridge/issue-7123.test.ts
Result: 3 failed credential cases, 2 passing controls
Expected failure: zero recovery hints and zero replacements instead of one each

The second run supported the report without correction. It is a repeat check by the same investigator, not independent verification. Its complete output is embedded in the appendix.

8. Related issues and pull requests

Issue timeline cross-references contained no pull requests, and an open-PR metadata search for 7123 returned none. Title searches for the same provider/credential scenario returned only this issue. Existing Codex issue classification patterns support Medium priority and Medium effort for this limited-provider work block with unverified live recovery. No linked PR code was checked out or executed.

9. Appendix

First reproduction output
• turbo 2.10.12

   • Packages in scope: bb-plugin-provider-codex
   • Running test in 1 packages
   • Remote caching disabled

//:ensure-native-modules: cache bypass, force executing 927e7cfdd7c291ad
@bb/templates:generate:templates: cache hit, replaying logs 4eb2e00867c81d9e
@bb/templates:generate:templates: 
@bb/templates:generate:templates: > @bb/templates@0.0.1 generate:templates <work>/base/packages/templates
@bb/templates:generate:templates: > node ./scripts/generate-templates.mjs
@bb/templates:generate:templates: 
@bb/process-utils:generate:profile-worker: cache hit, replaying logs b9263f461c3cb7fb
@bb/process-utils:generate:profile-worker: 
@bb/process-utils:generate:profile-worker: > @bb/process-utils@0.0.1 generate:profile-worker <work>/base/packages/process-utils
@bb/process-utils:generate:profile-worker: > node scripts/generate-profile-worker.mjs
@bb/process-utils:generate:profile-worker: 
@bb/templates:generate:plugin-scaffold: cache hit, replaying logs a58c2f3061ee93d4
@bb/templates:generate:plugin-scaffold: 
@bb/templates:generate:plugin-scaffold: > @bb/templates@0.0.1 generate:plugin-scaffold <work>/base/packages/templates
@bb/templates:generate:plugin-scaffold: > node ./scripts/generate-plugin-scaffold.mjs
@bb/templates:generate:plugin-scaffold: 
@bb/plugin-build:generate: cache hit, replaying logs 2075ea94882c9392
@bb/plugin-build:generate: 
@bb/plugin-build:generate: > @bb/plugin-build@0.0.1 generate <work>/base/packages/plugin-build
@bb/plugin-build:generate: > node ./scripts/generate-plugin-theme.mjs && node ./scripts/generate-runtime-export-manifest.mjs
@bb/plugin-build:generate: 
@bb/plugin-build:generate: plugin-theme.generated.ts up to date
@bb/plugin-build:generate: host-tailwind.css up to date
@bb/plugin-build:generate: host-tailwind-version.ts up to date
@bb/plugin-build:generate: wrote <work>/base/packages/plugin-build/src/generated/runtime-export-manifest.generated.ts (react@19.3.0)
@get-bb/plugin-sdk:build: cache hit, replaying logs e2745b2aec7d37c6
@get-bb/plugin-sdk:build: 
@get-bb/plugin-sdk:build: > @get-bb/plugin-sdk@0.6.124 build <work>/base/packages/plugin-sdk
@get-bb/plugin-sdk:build: > node scripts/build-runtime.mjs
@get-bb/plugin-sdk:build: 
@get-bb/plugin-sdk:build: Built 24 @get-bb/plugin-sdk runtime entries.
//:ensure-native-modules: 
//:ensure-native-modules: > bb@ ensure-native-modules <work>/base
//:ensure-native-modules: > node scripts/ensure-native-modules.mjs
//:ensure-native-modules: 
bb-plugin-provider-codex:test: cache miss, executing 6c428d8af96a5958
bb-plugin-provider-codex:test: 
bb-plugin-provider-codex:test: > bb-plugin-provider-codex@0.1.0 test <work>/base/plugins/provider-codex
bb-plugin-provider-codex:test: > vitest run --config vitest.config.ts "src/bridge/issue-7123.test.ts"
bb-plugin-provider-codex:test: 
bb-plugin-provider-codex:test: 
bb-plugin-provider-codex:test:  RUN  v4.1.1 <work>/base/plugins/provider-codex
bb-plugin-provider-codex:test: 
bb-plugin-provider-codex:test: stdout | src/bridge/issue-7123.test.ts > 'credential text without a category'
bb-plugin-provider-codex:test: {"name":"credential text without a category","errors":[{"kind":"provider.error","message":"Provider error","detail":"stream disconnected before completion: failed to load AWS credentials: an error occurred while loading credentials","willRetry":false,"providerTurnId":"failed-turn"}],"recovery":[],"replacements":[]}
bb-plugin-provider-codex:test: 
bb-plugin-provider-codex:test: stdout | src/bridge/issue-7123.test.ts > 'credential text with an unknown categ…'
bb-plugin-provider-codex:test: {"name":"credential text with an unknown category","errors":[{"kind":"provider.error","message":"Provider error","detail":"stream disconnected before completion: failed to load AWS credentials: an error occurred while loading credentials","willRetry":false,"errorInfo":{"category":"unknown","providerCode":"other","httpStatusCode":null},"providerTurnId":"failed-turn"}],"recovery":[],"replacements":[]}
bb-plugin-provider-codex:test: 
bb-plugin-provider-codex:test: stdout | src/bridge/issue-7123.test.ts > 'credential text with a stream category'
bb-plugin-provider-codex:test: {"name":"credential text with a stream category","errors":[{"kind":"provider.error","message":"Provider error","detail":"stream disconnected before completion: failed to load AWS credentials: an error occurred while loading credentials","willRetry":false,"errorInfo":{"category":"stream-disconnected","providerCode":"responseStreamDisconnected","httpStatusCode":502},"providerTurnId":"failed-turn"}],"recovery":[],"replacements":[]}
bb-plugin-provider-codex:test: 
bb-plugin-provider-codex:test:  ❯ |bb-plugin-provider-codex| src/bridge/issue-7123.test.ts (5 tests | 3 failed) 271ms
bb-plugin-provider-codex:test:    × 'credential text without a category' 68ms
bb-plugin-provider-codex:test:    × 'credential text with an unknown categ…' 40ms
bb-plugin-provider-codex:test:    × 'credential text with a stream category' 39ms
bb-plugin-provider-codex:test:    ✓ 'structured unauthorized control' 82ms
bb-plugin-provider-codex:test:    ✓ 'ordinary stream disconnection control' 42ms
bb-plugin-provider-codex:test: 
bb-plugin-provider-codex:test: ⎯⎯⎯⎯⎯⎯⎯ Failed Tests 3 ⎯⎯⎯⎯⎯⎯⎯
bb-plugin-provider-codex:test: 
bb-plugin-provider-codex:test:  FAIL  |bb-plugin-provider-codex| src/bridge/issue-7123.test.ts > 'credential text without a category'
bb-plugin-provider-codex:test:  FAIL  |bb-plugin-provider-codex| src/bridge/issue-7123.test.ts > 'credential text with an unknown categ…'
bb-plugin-provider-codex:test:  FAIL  |bb-plugin-provider-codex| src/bridge/issue-7123.test.ts > 'credential text with a stream category'
bb-plugin-provider-codex:test: AssertionError: expected { recoveryHints: +0, replacements: +0 } to deeply equal { recoveryHints: 1, replacements: 1 }
bb-plugin-provider-codex:test: 
bb-plugin-provider-codex:test: - Expected
bb-plugin-provider-codex:test: + Received
bb-plugin-provider-codex:test: 
bb-plugin-provider-codex:test:   {
bb-plugin-provider-codex:test: -   "recoveryHints": 1,
bb-plugin-provider-codex:test: -   "replacements": 1,
bb-plugin-provider-codex:test: +   "recoveryHints": 0,
bb-plugin-provider-codex:test: +   "replacements": 0,
bb-plugin-provider-codex:test:   }
bb-plugin-provider-codex:test: 
bb-plugin-provider-codex:test:  ❯ src/bridge/issue-7123.test.ts:212:8
bb-plugin-provider-codex:test:     210|       recoveryHints: recovery.length,
bb-plugin-provider-codex:test:     211|       replacements: replacements.length,
bb-plugin-provider-codex:test:     212|     }).toEqual({
bb-plugin-provider-codex:test:        |        ^
bb-plugin-provider-codex:test:     213|       recoveryHints: recover ? 1 : 0,
bb-plugin-provider-codex:test:     214|       replacements: recover ? 1 : 0,
bb-plugin-provider-codex:test: 
bb-plugin-provider-codex:test: ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[1/3]⎯
bb-plugin-provider-codex:test: 
bb-plugin-provider-codex:test: 
bb-plugin-provider-codex:test:  Test Files  1 failed (1)
bb-plugin-provider-codex:test:       Tests  3 failed | 2 passed (5)
bb-plugin-provider-codex:test:    Start at  15:37:12
bb-plugin-provider-codex:test:    Duration  2.26s (transform 1.70s, setup 0ms, import 1.87s, tests 271ms, environment 0ms)
bb-plugin-provider-codex:test: 
bb-plugin-provider-codex:test:  ELIFECYCLE  Test failed. See above for more details.
bb-plugin-provider-codex#test:  ERROR  command (<work>/base/plugins/provider-codex) /usr/local/bin/pnpm run test src/bridge/issue-7123.test.ts exited (1)

 Tasks:    6 successful, 7 total
Cached:    5 cached, 7 total
  Time:    3.339s 
Failed:    bb-plugin-provider-codex#test

 ERROR  run failed: command  exited (1)
Second clean reproduction output
• turbo 2.10.12

   • Packages in scope: bb-plugin-provider-codex
   • Running test in 1 packages
   • Remote caching disabled

@bb/process-utils:generate:profile-worker: cache bypass, force executing b9263f461c3cb7fb
@bb/plugin-build:generate: cache bypass, force executing 2075ea94882c9392
@bb/templates:generate:templates: cache bypass, force executing 4eb2e00867c81d9e
@bb/templates:generate:plugin-scaffold: cache bypass, force executing a58c2f3061ee93d4
//:ensure-native-modules: cache bypass, force executing 927e7cfdd7c291ad
@bb/templates:generate:plugin-scaffold: 
@bb/templates:generate:plugin-scaffold: > @bb/templates@0.0.1 generate:plugin-scaffold <work>/verify/packages/templates
@bb/templates:generate:plugin-scaffold: > node ./scripts/generate-plugin-scaffold.mjs
@bb/templates:generate:plugin-scaffold: 
@bb/plugin-build:generate: 
@bb/plugin-build:generate: > @bb/plugin-build@0.0.1 generate <work>/verify/packages/plugin-build
@bb/plugin-build:generate: > node ./scripts/generate-plugin-theme.mjs && node ./scripts/generate-runtime-export-manifest.mjs
@bb/plugin-build:generate: 
@bb/process-utils:generate:profile-worker: 
@bb/process-utils:generate:profile-worker: > @bb/process-utils@0.0.1 generate:profile-worker <work>/verify/packages/process-utils
@bb/process-utils:generate:profile-worker: > node scripts/generate-profile-worker.mjs
@bb/process-utils:generate:profile-worker: 
@bb/templates:generate:templates: 
@bb/templates:generate:templates: > @bb/templates@0.0.1 generate:templates <work>/verify/packages/templates
@bb/templates:generate:templates: > node ./scripts/generate-templates.mjs
@bb/templates:generate:templates: 
//:ensure-native-modules: 
//:ensure-native-modules: > bb@ ensure-native-modules <work>/verify
//:ensure-native-modules: > node scripts/ensure-native-modules.mjs
//:ensure-native-modules: 
//:ensure-native-modules: [ensure-native-modules] Detached hardlinked better-sqlite3 binary before verification
@get-bb/plugin-sdk:build: cache bypass, force executing 13272ef2df8105f1
@get-bb/plugin-sdk:build: 
@get-bb/plugin-sdk:build: > @get-bb/plugin-sdk@0.6.124 build <work>/verify/packages/plugin-sdk
@get-bb/plugin-sdk:build: > node scripts/build-runtime.mjs
@get-bb/plugin-sdk:build: 
@get-bb/plugin-sdk:build: Built 24 @get-bb/plugin-sdk runtime entries.
@bb/plugin-build:generate: plugin-theme.generated.ts up to date
@bb/plugin-build:generate: host-tailwind.css up to date
@bb/plugin-build:generate: host-tailwind-version.ts up to date
@bb/plugin-build:generate: wrote <work>/verify/packages/plugin-build/src/generated/runtime-export-manifest.generated.ts (react@19.3.0)
bb-plugin-provider-codex:test: cache bypass, force executing c02173fd038a46fe
bb-plugin-provider-codex:test: 
bb-plugin-provider-codex:test: > bb-plugin-provider-codex@0.1.0 test <work>/verify/plugins/provider-codex
bb-plugin-provider-codex:test: > vitest run --config vitest.config.ts "src/bridge/issue-7123.test.ts"
bb-plugin-provider-codex:test: 
bb-plugin-provider-codex:test: 
bb-plugin-provider-codex:test:  RUN  v4.1.1 <work>/verify/plugins/provider-codex
bb-plugin-provider-codex:test: 
bb-plugin-provider-codex:test: stdout | src/bridge/issue-7123.test.ts > 'credential text without a category'
bb-plugin-provider-codex:test: {"name":"credential text without a category","errors":[{"kind":"provider.error","message":"Provider error","detail":"stream disconnected before completion: failed to load AWS credentials: an error occurred while loading credentials","willRetry":false,"providerTurnId":"failed-turn"}],"recovery":[],"replacements":[]}
bb-plugin-provider-codex:test: 
bb-plugin-provider-codex:test: stdout | src/bridge/issue-7123.test.ts > 'credential text with an unknown categ…'
bb-plugin-provider-codex:test: {"name":"credential text with an unknown category","errors":[{"kind":"provider.error","message":"Provider error","detail":"stream disconnected before completion: failed to load AWS credentials: an error occurred while loading credentials","willRetry":false,"errorInfo":{"category":"unknown","providerCode":"other","httpStatusCode":null},"providerTurnId":"failed-turn"}],"recovery":[],"replacements":[]}
bb-plugin-provider-codex:test: 
bb-plugin-provider-codex:test: stdout | src/bridge/issue-7123.test.ts > 'credential text with a stream category'
bb-plugin-provider-codex:test: {"name":"credential text with a stream category","errors":[{"kind":"provider.error","message":"Provider error","detail":"stream disconnected before completion: failed to load AWS credentials: an error occurred while loading credentials","willRetry":false,"errorInfo":{"category":"stream-disconnected","providerCode":"responseStreamDisconnected","httpStatusCode":502},"providerTurnId":"failed-turn"}],"recovery":[],"replacements":[]}
bb-plugin-provider-codex:test: 
bb-plugin-provider-codex:test:  ❯ |bb-plugin-provider-codex| src/bridge/issue-7123.test.ts (5 tests | 3 failed) 378ms
bb-plugin-provider-codex:test:    × 'credential text without a category' 81ms
bb-plugin-provider-codex:test:    × 'credential text with an unknown categ…' 68ms
bb-plugin-provider-codex:test:    × 'credential text with a stream category' 61ms
bb-plugin-provider-codex:test:    ✓ 'structured unauthorized control' 112ms
bb-plugin-provider-codex:test:    ✓ 'ordinary stream disconnection control' 54ms
bb-plugin-provider-codex:test: 
bb-plugin-provider-codex:test: ⎯⎯⎯⎯⎯⎯⎯ Failed Tests 3 ⎯⎯⎯⎯⎯⎯⎯
bb-plugin-provider-codex:test: 
bb-plugin-provider-codex:test:  FAIL  |bb-plugin-provider-codex| src/bridge/issue-7123.test.ts > 'credential text without a category'
bb-plugin-provider-codex:test:  FAIL  |bb-plugin-provider-codex| src/bridge/issue-7123.test.ts > 'credential text with an unknown categ…'
bb-plugin-provider-codex:test:  FAIL  |bb-plugin-provider-codex| src/bridge/issue-7123.test.ts > 'credential text with a stream category'
bb-plugin-provider-codex:test: AssertionError: expected { recoveryHints: +0, replacements: +0 } to deeply equal { recoveryHints: 1, replacements: 1 }
bb-plugin-provider-codex:test: 
bb-plugin-provider-codex:test: - Expected
bb-plugin-provider-codex:test: + Received
bb-plugin-provider-codex:test: 
bb-plugin-provider-codex:test:   {
bb-plugin-provider-codex:test: -   "recoveryHints": 1,
bb-plugin-provider-codex:test: -   "replacements": 1,
bb-plugin-provider-codex:test: +   "recoveryHints": 0,
bb-plugin-provider-codex:test: +   "replacements": 0,
bb-plugin-provider-codex:test:   }
bb-plugin-provider-codex:test: 
bb-plugin-provider-codex:test:  ❯ src/bridge/issue-7123.test.ts:212:8
bb-plugin-provider-codex:test: 
bb-plugin-provider-codex:test:     210|       recoveryHints: recovery.length,
bb-plugin-provider-codex:test:  Test Files  1 failed (1)
bb-plugin-provider-codex:test:       Tests  3 failed | 2 passed (5)
bb-plugin-provider-codex:test:     211|       replacements: replacements.length,
bb-plugin-provider-codex:test:     212|     }).toEqual({
bb-plugin-provider-codex:test:        |        ^
bb-plugin-provider-codex:test:    Start at  15:38:07
bb-plugin-provider-codex:test:    Duration  2.79s (transform 2.00s, setup 0ms, import 2.28s, tests 378ms, environment 0ms)
bb-plugin-provider-codex:test: 
bb-plugin-provider-codex:test:     213|       recoveryHints: recover ? 1 : 0,
bb-plugin-provider-codex:test:     214|       replacements: recover ? 1 : 0,
bb-plugin-provider-codex:test: 
bb-plugin-provider-codex:test: ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[1/3]⎯
bb-plugin-provider-codex:test: 
bb-plugin-provider-codex:test:  ELIFECYCLE  Test failed. See above for more details.
bb-plugin-provider-codex#test:  ERROR  command (<work>/verify/plugins/provider-codex) /usr/local/bin/pnpm run test src/bridge/issue-7123.test.ts exited (1)

 Tasks:    6 successful, 7 total
Cached:    0 cached, 7 total
  Time:    5.231s 
Failed:    bb-plugin-provider-codex#test

 ERROR  run failed: command  exited (1)
58 existing tests passing
• turbo 2.10.12

   • Packages in scope: bb-plugin-provider-codex
   • Running test in 1 packages
   • Remote caching disabled

//:ensure-native-modules: cache bypass, force executing a9c76a92e0688444
@bb/templates:generate:templates: cache miss, executing 8217af644c4aabc8
@bb/plugin-build:generate: cache miss, executing b06fad5c94159a62
@bb/templates:generate:plugin-scaffold: cache miss, executing caa94e9718111af7
@bb/process-utils:generate:profile-worker: cache miss, executing 9ec0a319ad1b495d
@bb/templates:generate:templates: 
@bb/templates:generate:templates: > @bb/templates@0.0.1 generate:templates <work>/base/packages/templates
@bb/templates:generate:templates: > node ./scripts/generate-templates.mjs
@bb/templates:generate:templates: 
@bb/plugin-build:generate: 
@bb/plugin-build:generate: > @bb/plugin-build@0.0.1 generate <work>/base/packages/plugin-build
@bb/plugin-build:generate: > node ./scripts/generate-plugin-theme.mjs && node ./scripts/generate-runtime-export-manifest.mjs
@bb/plugin-build:generate: 
//:ensure-native-modules: 
//:ensure-native-modules: > bb@ ensure-native-modules <work>/base
//:ensure-native-modules: > node scripts/ensure-native-modules.mjs
//:ensure-native-modules: 
@bb/templates:generate:plugin-scaffold: 
@bb/templates:generate:plugin-scaffold: > @bb/templates@0.0.1 generate:plugin-scaffold <work>/base/packages/templates
@bb/templates:generate:plugin-scaffold: > node ./scripts/generate-plugin-scaffold.mjs
@bb/templates:generate:plugin-scaffold: 
@bb/process-utils:generate:profile-worker: 
@bb/process-utils:generate:profile-worker: > @bb/process-utils@0.0.1 generate:profile-worker <work>/base/packages/process-utils
@bb/process-utils:generate:profile-worker: > node scripts/generate-profile-worker.mjs
@bb/process-utils:generate:profile-worker: 
@get-bb/plugin-sdk:build: cache miss, executing 750b6e86b2cec5a4
@get-bb/plugin-sdk:build: 
@get-bb/plugin-sdk:build: > @get-bb/plugin-sdk@0.6.124 build <work>/base/packages/plugin-sdk
@get-bb/plugin-sdk:build: > node scripts/build-runtime.mjs
@get-bb/plugin-sdk:build: 
@get-bb/plugin-sdk:build: Built 24 @get-bb/plugin-sdk runtime entries.
@bb/plugin-build:generate: plugin-theme.generated.ts up to date
@bb/plugin-build:generate: host-tailwind.css up to date
@bb/plugin-build:generate: host-tailwind-version.ts up to date
@bb/plugin-build:generate: wrote <work>/base/packages/plugin-build/src/generated/runtime-export-manifest.generated.ts (react@19.3.0)
bb-plugin-provider-codex:test: cache miss, executing ae9fa198d2b16d0a
bb-plugin-provider-codex:test: 
bb-plugin-provider-codex:test: > bb-plugin-provider-codex@0.1.0 test <work>/base/plugins/provider-codex
bb-plugin-provider-codex:test: > vitest run --config vitest.config.ts "src/bridge/bridge.recovery.test.ts" "src/bridge/bridge.rate-limit-recovery.test.ts" "src/translator.test.ts"
bb-plugin-provider-codex:test: 
bb-plugin-provider-codex:test: 
bb-plugin-provider-codex:test:  RUN  v4.1.1 <work>/base/plugins/provider-codex
bb-plugin-provider-codex:test: 
bb-plugin-provider-codex:test:  ✓ |bb-plugin-provider-codex| src/translator.test.ts (44 tests) 55ms
bb-plugin-provider-codex:test: codex rollout is not ready; retrying rename in 50ms.
bb-plugin-provider-codex:test: codex rollout is not ready; retrying rename in 200ms.
bb-plugin-provider-codex:test: codex rollout is not ready; retrying rename in 50ms.
bb-plugin-provider-codex:test: codex rollout is not ready; retrying rename in 200ms.
bb-plugin-provider-codex:test:  ✓ |bb-plugin-provider-codex| src/bridge/bridge.recovery.test.ts (3 tests) 682ms
bb-plugin-provider-codex:test:  ✓ |bb-plugin-provider-codex| src/bridge/bridge.rate-limit-recovery.test.ts (11 tests) 5787ms
bb-plugin-provider-codex:test:    ✓ keeps quota ahead of failure and reads only missing failure metadata (timeout)  5080ms
bb-plugin-provider-codex:test: 
bb-plugin-provider-codex:test:  Test Files  3 passed (3)
bb-plugin-provider-codex:test:       Tests  58 passed (58)
bb-plugin-provider-codex:test:    Start at  15:37:59
bb-plugin-provider-codex:test:    Duration  8.02s (transform 5.23s, setup 0ms, import 5.94s, tests 6.52s, environment 0ms)
bb-plugin-provider-codex:test: 

 Tasks:    7 successful, 7 total
Cached:    0 cached, 7 total
  Time:    10.58s 

Full workspace build: 73 successful tasks
@bb/desktop:build:   You need to set the output format to "esm" for "import.meta" to work correctly.
@bb/desktop:build: 
@bb/desktop:build: @bb/desktop: built Electron entries

 Tasks:    73 successful, 73 total
Cached:    9 cached, 73 total
  Time:    48.956s 

Build preparation initially encountered plugin bundles running before the SDK runtime existed. The prescribed SDK type build alone did not resolve missing runtime entries; the normal Turbo SDK runtime build did. A subsequent full pnpm exec turbo run build completed all 73 tasks. This setup issue is not evidence about AWS credentials. The first draft of the reproduction used invalid client request IDs; those were corrected to match the trusted protocol before the recorded runs. Both final runs reach the terminal provider error and fail only on missing recovery/replacement behavior.

Investigation commands, with only trusted repository/numeric metadata inputs:

git fetch origin main
git rev-parse origin/main
git status --porcelain
pnpm install --frozen-lockfile --prefer-offline
pnpm exec turbo run build
pnpm exec turbo run build:types --filter=@get-bb/plugin-sdk
pnpm exec turbo run build --filter=@get-bb/plugin-sdk
pnpm exec oxfmt plugins/provider-codex/src/bridge/issue-7123.test.ts
pnpm exec turbo run test --filter=bb-plugin-provider-codex -- src/bridge/issue-7123.test.ts
pnpm exec turbo run test --force --filter=bb-plugin-provider-codex -- src/bridge/issue-7123.test.ts
pnpm exec turbo run test --filter=bb-plugin-provider-codex -- src/bridge/bridge.recovery.test.ts src/bridge/bridge.rate-limit-recovery.test.ts src/translator.test.ts
git diff --check
git log --oneline -- plugins/provider-codex/src/bridge/bridge.ts
git blame -L 318,345 -- plugins/provider-codex/src/bridge/bridge.ts
gh api repos/get-bb/bb
gh api repos/get-bb/bb/issues/7123
gh api graphql [repository property definitions, issue classifications, comments and cross-references]
gh pr list --repo get-bb/bb --state open --search 7123 --json number,url

Untrusted-data note: The issue and its comment contained suggested implementation and test steps. They were treated only as claims to check. No instructions, scripts, patches, branches, external URLs, or commands from issue content were followed. The one diagnostic string was parsed into a bounded JSON text fixture and only fed through native error notification data. No credentials were read or published.

AGENT GENERATED · Investigation and second-run verification by the same SlopCop agent.