← reports

#7597 · String user echoes create diagnostic events

BugPriority: LowEffort: Lowproviders · provider-claude-code · confirmed-reproGitHub issue

2026-11-15 · trusted main da3e60b81d560e114a2bec724bb59c997aaaae7f

Verdict: REPRODUCED · Root-cause confidence: high

1. TL;DR

A normal user-prompt echo is converted into a diagnostic event even though it contains no unsupported behavior. The Claude bridge sends user content as a string, but its visibility classifier only discovers content types in block arrays. The translator correctly consumes a text echo without creating timeline content; its outer fallback then mistakes that empty result for an unknown event. A focused test through the real translator and event assembler produces one provider/unhandled event per supplied string echo. The same agent repeated this result in a second clean checkout; no desktop session, user data, or live provider account was used.

2. Claims vs findings

ClaimFindingEvidence
Replay is enabled and bridge inputs contain string content.Verified in trusted source.SDK session options and pushInput, linked below.
String user echoes become unknown SDK user events.Verified dynamically twice.Both nonempty and empty replayed strings produce provider/unhandled, rawType sdk/user. The existing block-array control passes.
There is one diagnostic row per live turn with diagnostics enabled.Event mechanism verified; live frequency and UI not re-run.One emitted unhandled event per synthetic echo through the production assembler. No screenshots or fresh Claude process were needed to establish this classification defect.
The fix is only a small classifier adjustment.Production change is small, but a complete change also needs generated expectations.The three-line candidate passes the regression; the existing transcript suite then rejects its pinned unhandled count changing from 6 to 0.
Reported desktop and provider versions, operating system, and historical thread counts.Unverified.Only trusted source at the recorded commit was executed. The reporter's local threads were not accessed.

3. Environment

4. Minimal reproduction

The regression extends the existing text-echo test at the production translator/assembler boundary. It retains the original synthetic block-array input and adds a nonempty replayed string and an empty replayed string. No mock, new production export, or test-only seam is needed.

  1. Create a clean checkout and prepare the existing dependencies:
    git clone --branch main https://github.com/get-bb/bb.git bb-7597
    cd bb-7597
    git checkout --detach da3e60b81d560e114a2bec724bb59c997aaaae7f
    pnpm install --frozen-lockfile --prefer-offline
    pnpm exec turbo run build build:types --filter=@get-bb/plugin-sdk
  2. Save the following complete test-only patch as /tmp/issue-7597-regression.patch. It modifies the already-imported test harness and runs against unchanged production code:
    diff --git a/plugins/provider-claude-code/src/delta-translation.test.ts b/plugins/provider-claude-code/src/delta-translation.test.ts
    index d8a62a1b1a..60c56ee016 100644
    --- a/plugins/provider-claude-code/src/delta-translation.test.ts
    +++ b/plugins/provider-claude-code/src/delta-translation.test.ts
    @@ -1250,36 +1250,59 @@ describe("claude unhandled and ignored events", () => {
         ]);
       });
     
    -  it("ignores sdk user text echoes", () => {
    -    const harness = createClaudeDeltaHarness();
    +  it.each([
    +    {
    +      name: "synthetic block-array text",
    +      content: [
    +        {
    +          type: "text",
    +          text: "This session is being continued from a previous conversation.",
    +        },
    +      ],
    +      isSynthetic: true,
    +      isReplay: false,
    +    },
    +    {
    +      name: "replayed string text",
    +      content: "echoed user input",
    +      isSynthetic: false,
    +      isReplay: true,
    +    },
    +    {
    +      name: "empty replayed string text",
    +      content: "",
    +      isSynthetic: false,
    +      isReplay: true,
    +    },
    +  ])(
    +    "ignores sdk user text echoes ($name)",
    +    ({ content, isSynthetic, isReplay }) => {
    +      const harness = createClaudeDeltaHarness();
     
    -    const events = harness.translate({
    -      jsonrpc: "2.0",
    -      method: "sdk/message",
    -      params: {
    -        threadId: "bb-thread-1",
    -        message: {
    -          type: "user",
    +      const events = harness.translate({
    +        jsonrpc: "2.0",
    +        method: "sdk/message",
    +        params: {
    +          threadId: "bb-thread-1",
               message: {
    -            role: "user",
    -            content: [
    -              {
    -                type: "text",
    -                text: "This session is being continued from a previous conversation.",
    -              },
    -            ],
    +            type: "user",
    +            message: {
    +              role: "user",
    +              content,
    +            },
    +            parent_tool_use_id: null,
    +            session_id: "sess-1",
    +            uuid: "user-message-1",
    +            timestamp: "2026-05-03T07:53:31.543Z",
    +            isSynthetic,
    +            isReplay,
               },
    -          parent_tool_use_id: null,
    -          session_id: "sess-1",
    -          uuid: "user-message-1",
    -          timestamp: "2026-05-03T07:53:31.543Z",
    -          isSynthetic: true,
             },
    -      },
    -    });
    +      });
     
    -    expect(events).toEqual([]);
    -  });
    +      expect(events).toEqual([]);
    +    },
    +  );
     
       it("ignores sdk stream ping keepalives", () => {
         const harness = createClaudeDeltaHarness();
    
  3. Apply the patch and run only the echo cases:
    git apply /tmp/issue-7597-regression.patch
    pnpm exec turbo run test --filter=bb-plugin-provider-claude-code -- src/delta-translation.test.ts -t 'ignores sdk user text echoes'

Expected: all three cases return an empty event array. Actual on trusted main: the block-array control passes; each string case emits one unhandled event. The relevant verbatim assertion/output excerpts are:

expect(events).toEqual([]);

+     "rawType": "sdk/user",
+     "scope": {
+       "kind": "thread",
+     },
+     "threadId": "",
+     "type": "provider/unhandled",

Tests  2 failed | 1 passed | 55 skipped (58)
BASELINE_EXIT=1

The empty threadId above is the real harness's unstamped output, not missing production data. The test runs the production assembler with its existing harness defaults.

5. Root cause

  1. SDK session options explicitly enable user-message replay. pushInput supplies message: { role: "user", content: text }.
  2. getMessageContentTypes returns an empty list for any non-array content:
    const content = messagePayload?.["content"];
    if (!Array.isArray(content)) {
      return [];
    }
  3. User parsing passes that list to the descriptor. User classification treats only sdk/user:text as noise and sdk/user:tool_result as normalized. An empty list becomes bare sdk/user, coverage unknown.
  4. translateUserMessage consumes prompt/checkpoint bookkeeping and normally returns no deltas for a text echo. The outer SDK-envelope fallback then calls unhandledDeltas.
  5. unhandledDeltas emits an unhandled delta for coverage unknown. The real assembler turns it into the event observed by the test. The defect is not in replay enabling, prompt delivery, or diagnostics settings.

6. Proposed fix and simple-fix assessment

Recognize a string at the content boundary as text, including an empty string. Preserve array handling and the existing unknown fallback for unsupported shapes. The tested production candidate is:

if (typeof content === "string") {
  return ["text"];
}

With this candidate, the focused regression passes: 3 passed | 55 skipped (58). The local diff is two files, 51 additions and 25 deletions: 76 changed text lines. It contains no binary, dependency, lockfile, protocol, schema, stored-data, or security change; git diff --check passes.

No pull request was opened or branch pushed. The full existing plugin suite fails because the candidate reduces the pinned background-agents transcript's unhandled count from 6 to 0. The existing test generates expected.json when its update flag is enabled, then compares exact projections. Completing the fix therefore requires generated transcript-expectation changes, which this autopilot's simple-fix rules expressly exclude. The generated file was not modified. A follow-up change should regenerate and review all affected transcript projections before opening a PR.

AssertionError: background-agents.ndjson: expected { …(6) } to deeply equal { …(6) }
-   "unhandled": 6,
+   "unhandled": 0,

Test Files  3 failed | 27 passed (30)
Tests  7 failed | 437 passed (444)

The other six full-suite failures involve executable discovery or sandbox permission expectations. They were not repaired, and no claim is made that they were caused by this classifier change. Plugin lint reports zero errors; the combined Turbo invocation ended on test failure, so it is not presented as a successful full validation.

7. Verification

The same agent created a second clean detached worktree at the recorded base commit, checked that its tracked state was clean, performed a new frozen install and SDK build, then applied only the test patch above. No production file was modified in that checkout.

pnpm exec turbo run test --filter=bb-plugin-provider-claude-code -- src/delta-translation.test.ts -t 'ignores sdk user text echoes'

Tests  2 failed | 1 passed | 55 skipped (58)
VERIFICATION_EXIT=1

The second run failed for exactly the same intended assertion and sdk/user event shape. The report required no root-cause correction. This is a second clean run by the same agent, not independent verification.

On that unchanged production code, the pre-existing classifier and transcript suites also passed:

pnpm exec turbo run test --filter=bb-plugin-provider-claude-code -- src/transcript-fixtures.test.ts src/visibility.test.ts

Test Files  2 passed (2)
Tests  54 passed (54)
BASE_EXISTING_EXIT=0

8. Related issues and pull requests

GitHub metadata was checked for open PRs referencing issue 7597 before and after investigation; none were found. Issues #5252 and #2224 show the same Low/Low provider classification pattern; they concern other SDK event kinds, not this string-content path. No linked branch or external issue URL was fetched or executed.

9. Appendix and limitations