← reports

#5480 · Codex review warnings bypass normalization

Bug Priority: Low Effort: Medium providers provider-codex · GitHub issue

2026-10-20 · trusted origin/main bd93d18896bab97c950c4fa3451b621c1e0569c1

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

1. TL;DR

BB knows that Codex can send a guardian review notification, but its translator does not handle that notification as a warning. A valid message is therefore emitted as provider/unhandled, carrying the raw JSON instead of the existing human-readable warning event. The timeline's diagnostic renderer explains the raw-event presentation, while the ordinary warning renderer already supports the desired text. The focused regression fails identically in two separate clean checkouts of trusted main. The proposed local repair reuses that existing warning path; it does not approve commands, alter permissions, or introduce a new review UI.

2. Claims vs findings

ClaimStatusEvidence
Review messages are not normalized and reach raw diagnostics.VerifiedBoth clean runs receive one provider/unhandled event for a valid notification; the regression expects a warning with the original message.
The fallback explains the raw method and payload presentation.Verified in sourceThe shared timeline renderer uses diagnostic operations for unhandled events and a separate warning renderer for normalized warnings.
Codex emits this notification during a live automatic-approval turn.Unverified in this runNo authenticated provider process was launched. The input follows the generated notification contract already present on trusted main.
Consecutive review messages should collapse together.Product choice, not implementedThe focused repair changes normalization only; grouping multiple warnings needs its own presentation decision.
A different provider has a similar replay issue.UnverifiedThe reported replay event belongs to another provider subsystem and is outside this one-subsystem fix.

3. Environment

4. Minimal reproduction

  1. Clone the trusted repository and select the tested base:
    git clone https://github.com/get-bb/bb.git bb-repro
    cd bb-repro
    git checkout --detach bd93d18896bab97c950c4fa3451b621c1e0569c1
    pnpm install --frozen-lockfile --prefer-offline
    pnpm exec turbo run build --filter=bb-plugin-provider-codex
  2. Save the complete test below as plugins/provider-codex/src/guardian-warning.test.ts. Its synthetic message was authored for this test; no issue script, payload text, or external attachment is executed.
  3. Run the owner-boundary test through Turbo:
    pnpm exec turbo run test --filter=bb-plugin-provider-codex -- src/guardian-warning.test.ts
  4. Expected: a provider/warning with category general, the original review message, and thread scope; malformed notifications stay visible as diagnostics. Actual: the valid notification is also emitted as provider/unhandled. Both runs exit 1 with one failed and three passed tests. The key assertion output is:
    -     "category": "general",
    +     "providerId": "codex",
    +     "rawEvent": {
    +       "jsonrpc": "2.0",
    +       "method": "guardianWarning",
    +       "params": {
    +         "message": "Review completed for a read-only operation.",
    +         "threadId": "provider-thread",
    +       },
    +     },
    +     "rawType": "guardianWarning",
    -     "summary": "Review completed for a read-only operation.",
    -     "type": "provider/warning",
    +     "type": "provider/unhandled",
    
    Test Files  1 failed (1)
         Tests  1 failed | 3 passed (4)

Complete regression test

import { describe, expect, it } from "vitest";
import { experimental_createDeltaAssembler as createDeltaAssembler } from "@get-bb/plugin-sdk/provider-bridge/testing";
import { createCodexEventTranslator } from "./translator.js";
import { threadScope } from "./event-scope.test-support.js";

function translate(params: Record<string, unknown>) {
  const translator = createCodexEventTranslator({
    additionalWorkspaceWriteRoots: [],
  });
  const assembler = createDeltaAssembler({
    providerId: "codex",
    entropyPrefix: "guardian-test",
    textDeltaFlushMs: 0,
  });
  return assembler.assemble({
    threadId: "guardian-test-thread",
    deltas: translator.translateEvent({
      jsonrpc: "2.0",
      method: "guardianWarning",
      params,
    }),
  });
}

describe("Codex guardian warning translation", () => {
  it("preserves the review message as a warning instead of raw diagnostics", () => {
    expect(
      translate({
        threadId: "provider-thread",
        message: "Review completed for a read-only operation.",
      }),
    ).toEqual([
      expect.objectContaining({
        type: "provider/warning",
        category: "general",
        summary: "Review completed for a read-only operation.",
        scope: threadScope(),
      }),
    ]);
  });

  it.each([
    { threadId: "provider-thread" },
    { threadId: "provider-thread", message: 42 },
    { message: "Review completed for a read-only operation." },
  ])("keeps malformed notifications visible as diagnostics: %j", (params) => {
    expect(translate(params)).toEqual([
      expect.objectContaining({
        type: "provider/unhandled",
        rawType: "guardianWarning",
      }),
    ]);
  });
});

Evidence is inline so this report is self-contained. Local command logs are retained privately, not published as raw artifacts. No UI screenshot is claimed: this is an event-translation reproduction, not a live-provider or browser run.

5. Root cause

  1. The generated provider contract already defines a string thread identifier and message. The wire format is not missing.
  2. The handled-event union accepts general, deprecation, and configuration warnings, but has no guardian-warning variant. A valid guardian notification therefore fails the handled parser.
  3. The visibility table classifies this known notification as unknown. Structured review-start/review-completion notifications are separately classified as noise; those are not the message-bearing warning.
  4. The translator's failed-parse branch calls the unknown-event fallback, which includes the raw envelope. The real shared delta assembler materializes the unhandled event observed in both tests.
  5. The shared timeline diagnostic renderer explains the raw-event row when diagnostic operations are enabled. With diagnostic operations disabled, it returns no operation for this event. By contrast, the existing warning renderer uses the warning summary as its title.
guardianWarning: "unknown"

const parsed = codexHandledEventSchema.safeParse(rawEvent);
if (!parsed.success) {
  return isHandledCodexMethod(rawEvent.method)
    ? buildUnhandledCodexDeltas({ rawEvent, rawType: rawEvent.method })
    : buildUnhandledCodexDeltas({ rawEvent });
}

This is missing presentation normalization, not evidence of an approval failure, authorization bypass, or failed command execution. Hiding every review event would discard potentially meaningful messages; changing the global diagnostic fallback would affect unrelated unknown events.

6. Proposed fix and validation

Validate the existing guardian notification at the provider boundary, route it to the same general-warning branch as ordinary Codex warnings, and mark its visibility coverage normalized. Preserve malformed notifications as unhandled diagnostics. This changes no public protocol, persisted schema, permission decision, authentication, dependency, CLI command, or SDK surface; the already supported warning event reaches existing consumers.

The local candidate changes 4 files, 60 additions and 1 deletion: 61 changed text lines, all within the Codex provider. The regression fails on unchanged production code and passes after the repair: 4/4 focused tests. The relevant existing package suite also passes: 42 files, 539 tests. Turbo lint and typecheck pass; formatting and git diff --check pass. No binary, generated file, lockfile, migration, or stored-data change is included.

pnpm exec turbo run test --filter=bb-plugin-provider-codex -- src/guardian-warning.test.ts
pnpm exec turbo run test lint typecheck --filter=bb-plugin-provider-codex
git diff --check
git diff --numstat origin/main

Focused: 1 file passed, 4 tests passed
Package: 42 files passed, 539 tests passed
Turbo: 10 successful tasks, 10 total
Changed text: 60 additions + 1 deletion = 61 lines

Warning grouping, approval-state behavior, other providers, and live-provider UI are deliberately not changed or claimed verified.

7. Verification

The same agent repeated the reproduction, rather than claiming independent verification. A second separate temporary checkout was created clean at bd93d18896bab97c950c4fa3451b621c1e0569c1. After a separate frozen install and scoped build, only the authored regression test was copied into it; no production file was changed. The same Turbo test command failed for the same expected-warning versus actual-unhandled mismatch, with 1 failed and 3 passed. No server was started in either checkout, so no ports or database were reused. Source links were checked against the recorded base. No correction to the translation root cause was required.

8. Related issues and pull requests

No linked or matching open pull request was found in the issue timeline or repository PR search before implementation. A repository issue search for the provider's guardian-event identifier returned this issue only. No external issue attachment or linked code was fetched or executed. This report refreshes the older investigation for the same numeric issue with the current trusted-main base and tested local repair; it does not remove another issue's report.

9. Appendix and limits

Classification was already complete and preserved: Bug, Low priority, Medium effort, providers, provider-codex. Final Type was read again before reproduction. GitHub metadata was read to check public visibility, current fields, comments, similar provider issues, and pull-request linkage. All repository execution used trusted main or the small evidence-derived change described here.

The verification-map inventory check separately reports an unmapped browser CLI family. That unrelated documentation drift is not modified or counted as a passing app verification. The tools-and-interactions live journey is not run; only notification normalization and the existing provider test suite are verified. No production instance, account, workflow, or delegated agent was used.

Local source audit and style review found no additional change required. Cleanup requires no server shutdown because no service was launched.