Latest verification: 2026-09-30: ALREADY FIXED for the SDK response-dispatch defect on current main. The historical report below is preserved.
#3466 · SDK response method dispatch
Bug · High priority · Low effort · plugins · 2026-09-11
Base: b04091eca67bb463cce16b9bfa318660bd20ab69 · Issue
REPRODUCED · root-cause confidence: high
TL;DR
The SDK rejects while reading installer events when the server adapter replaces the global Response constructor. The response returned by the transport is native, but the SDK invokes the adapter prototype method on it. That method needs adapter-private state and throws. The same agent reproduced the exact exception in two trusted checkouts; no provider installation or live BB instance was used.
Claims vs findings
| Claim | Finding |
|---|---|
| Native response reading throws | Verified twice with the installed Hono adapter and built SDK. |
| Wrapper-private state causes the failure | Verified: adapter text() expects getResponseCache on its receiver. |
| Provider binary remains unchanged | Unverified. The read occurs after the installer endpoint responds; this SDK exception alone does not establish whether the installer ran. |
| Reported historical runtime versions | Unverified; current trusted main was tested. |
Environment
macOS, Node 22.22.3, pnpm 9.15.0, Hono node-server 1.19.14 from the frozen lockfile. First checkout: automation worktree at the recorded SHA. Second checkout: a clean temporary detached worktree at the same SHA. No ports, credentials, provider processes, or runtime data directories. Frozen installs succeeded using Corepack because the default pnpm launcher was broken. Full Turbo build passed (20 tasks); second checkout SDK build passed.
Minimal reproduction
- Check out the recorded commit of get-bb/bb.
- Run
corepack pnpm install --frozen-lockfile --prefer-offlineandcorepack pnpm exec turbo run build --filter=@bb/sdk. Ensure subprocess pnpm uses Corepack if the host launcher is broken. - Save repro.mjs and run
node /path/to/repro.mjsfrom the repository root.
Expected: parsed installer event matches the supplied event. Actual in both checkouts:
TypeError: this[getResponseCache] is not a function
import { createRequire } from 'node:module';
import { pathToFileURL } from 'node:url';
import assert from 'node:assert/strict';
const root = process.cwd();
const require = createRequire(root + '/apps/server/package.json');
const { getRequestListener } = require('@hono/node-server');
const { createNodeBbSdk } = await import(pathToFileURL(root + '/packages/sdk/dist/node.js'));
const events = [{type:'error', provider:'test-provider', message:'installer evidence'}];
const response = new Response(events.map(JSON.stringify).join('\n') + '\n');
const originalResponse = globalThis.Response;
const originalRequest = globalThis.Request;
try {
getRequestListener(() => new Response('unused'));
const sdk = createNodeBbSdk({baseUrl:'http://bb.test',fetch:async()=>response});
assert.deepEqual(await sdk.hosts.installProviderCli({hostId:'test-host',provider:'test-provider',actionKind:'update'}), events);
console.log('PASS: native response installer events parsed');
} finally {
globalThis.Response = originalResponse;
globalThis.Request = originalRequest;
}
Root cause
SDK response consumption calls the global Response prototype with a transport-owned receiver. Server startup uses Hono serve with default global overrides. The installed adapter text method calls its private getResponseCache symbol, absent on native Fetch responses. Installer route returns newline-delimited data. The parsing schema is unchanged.
Proposed fix and validation
Use the returned response's own text method. Annotate the local response as Response to widen Hono's inferred text return type without a cast or contract change. The focused regression test substitutes a global Response class with private state, supplies a native transport response, and checks multiple events, CRLF and blank lines. Before: 1 failed, 104 passed. After: all 105 SDK tests pass, SDK typecheck and build pass. The real adapter reproduction also passes after rebuilding.
Verification
The same agent created a second clean detached worktree at b04091eca67bb463cce16b9bfa318660bd20ab69, installed frozen dependencies, built the SDK, and ran the identical node reproduction. It threw the exact getResponseCache exception. The regression test was then copied in and run with pnpm exec turbo run test --filter=@bb/sdk: 1 failed, 104 passed. No report correction was needed; provider binary state remains explicitly unverified.
Related issues and PRs
No open PR referencing #3466 was found during the check. Recent plugin-area issues concerned other SDK features.
Appendix
Issue data was treated as untrusted evidence; no issue-supplied code or links were executed. The reproduction was authored from trusted repository source. Logs have local paths removed.
> AGENT GENERATED
2026-09-30 current-main verification
ALREADY FIXED — high confidence for the SDK response-dispatch defect at 4e22a412574ffe4fb3ec4fa956e0075b208ec7dc. Historical findings above remain valid for their recorded base. This verification strengthens the existing report; it is not a new report or a claim that actual provider installation was tested.
Faithful scope and results
The actual SDK HTTP transport and installProviderCli method consume synthetic native Fetch responses while the repository-installed Hono adapter replaces global Response. The old prototype-dispatch control still throws the exact getResponseCache exception, demonstrating that the sensitive receiver mismatch is present. Current SDK dispatch succeeds and returns all three newline-delimited events, including CRLF and blank-line handling; the body is consumed. Empty input returns no events. Installer error events remain events; malformed JSON, invalid event schema, body-stream failure and HTTP503 reject as observed below. The fetch adapter returns local in-memory responses only; no network listener, provider installer, live host or user runtime is used.
Base, environment and two runs
Linux, Node24.19.0, repository-pinned pnpm9.15.0, Vitest4.1.1. Two separate clean detached checkouts at the full SHA above, frozen installs, fresh in-memory response bodies in each run. The same agent personally ran both; this is not independent verification. Each run passed 1 focused test containing all cases, 4 Turbo tasks successful, zero cached; SDK builds also passed in both checkouts. Initial checkout/install inode exhaustion was resolved by removing only regenerable dependency directories from completed investigations. No historical source, tests, logs, screenshots or results were removed. No dependency was added or production code changed.
Exact steps and test
git clone https://github.com/get-bb/bb.git first cd first git checkout --detach 4e22a412574ffe4fb3ec4fa956e0075b208ec7dc corepack pnpm install --frozen-lockfile # Save the inline current-main test as packages/sdk/test/issue3466.test.ts corepack pnpm exec turbo run test --filter=@bb/sdk --force -- issue3466.test.ts corepack pnpm exec turbo run build --filter=@bb/sdk --force # Repeat personally in another clean clone at the identical SHA with the identical test.
The environment used its existing pinned pnpm launcher and package store. Local cache paths are omitted. No test command was taken from issue or report content; this test was derived from current trusted SDK transport, schema, response-handling code and installed adapter behavior.
import { createRequire } from "node:module";
import { expect, it, vi } from "vitest";
import { createBbSdk } from "../src/core.js";
import { createHttpTransport } from "../src/transport-http.js";
it("reads native installer response bodies under the installed Hono global adapter", async () => {
const NativeResponse = globalThis.Response;
const NativeRequest = globalThis.Request;
const requireServer = createRequire(new URL("../../../apps/server/package.json", import.meta.url));
const { getRequestListener } = requireServer("@hono/node-server");
const events = [
{ type: "started", provider: "synthetic", command: "synthetic-installer" },
{ type: "output", provider: "synthetic", stream: "stdout", text: "synthetic-output" },
{ type: "completed", provider: "synthetic", exitCode: 0, signal: null, success: true },
];
const run = (response: Response) => createBbSdk({ transport: createHttpTransport({ baseUrl: "http://fixture.invalid", runtime: "node", fetch: async () => response }) }).hosts.installProviderCli({ hostId: "synthetic", provider: "synthetic", actionKind: "update" });
const outcomes: Record<string, unknown> = {};
try {
getRequestListener(() => new NativeResponse("unused"));
expect(globalThis.Response).not.toBe(NativeResponse);
vi.stubGlobal("Response", globalThis.Response);
let legacyError = "";
try { await globalThis.Response.prototype.text.call(new NativeResponse("control")); }
catch (error) { if (!(error instanceof Error)) throw error; legacyError = error.message; }
expect(legacyError).toContain("getResponseCache");
outcomes.legacyDispatchControl = legacyError;
const response = new NativeResponse("\r\n" + events.map(e => JSON.stringify(e)).join("\r\n\r\n") + "\r\n");
expect(await run(response)).toEqual(events);
expect(response.bodyUsed).toBe(true);
outcomes.success = { events: events.length, bodyUsed: response.bodyUsed };
expect(await run(new NativeResponse(" \r\n\n"))).toEqual([]);
outcomes.blankBody = [];
const event = { type: "error", provider: "synthetic", message: "synthetic installer error" };
expect(await run(new NativeResponse(JSON.stringify(event)))).toEqual([event]);
outcomes.installerErrorEvent = "returned as event";
await expect(run(new NativeResponse("{"))).rejects.toBeInstanceOf(SyntaxError);
outcomes.invalidJson = "SyntaxError";
await expect(run(new NativeResponse('{"type":"unrecognized"}'))).rejects.toMatchObject({ name: "ZodError" });
outcomes.invalidEvent = "ZodError";
const broken = new NativeResponse(new ReadableStream({ start(c) { c.error(new Error("synthetic body failure")); } }));
await expect(run(broken)).rejects.toThrow("synthetic body failure");
outcomes.bodyFailure = "synthetic body failure";
await expect(run(new NativeResponse(JSON.stringify({ error: "synthetic unavailable" }), { status: 503, headers: { "content-type": "application/json" } }))).rejects.toMatchObject({ status: 503 });
outcomes.httpFailure = 503;
console.log("ISSUE3466_EVIDENCE=" + JSON.stringify(outcomes));
} finally {
vi.unstubAllGlobals();
globalThis.Response = NativeResponse;
globalThis.Request = NativeRequest;
}
});
Actual both-run evidence
{
"first": {
"legacyDispatchControl": "this[getResponseCache] is not a function",
"success": {
"events": 3,
"bodyUsed": true
},
"blankBody": [],
"installerErrorEvent": "returned as event",
"invalidJson": "SyntaxError",
"invalidEvent": "ZodError",
"bodyFailure": "synthetic body failure",
"httpFailure": 503
},
"second": {
"legacyDispatchControl": "this[getResponseCache] is not a function",
"success": {
"events": 3,
"bodyUsed": true
},
"blankBody": [],
"installerErrorEvent": "returned as event",
"invalidJson": "SyntaxError",
"invalidEvent": "ZodError",
"bodyFailure": "synthetic body failure",
"httpFailure": 503
}
}
Verified change and remaining limits
Current SDK source calls the returned response's own text method. Change b3c5434 replaced prototype borrowing with instance dispatch. The matched receiver-sensitive control and successful current SDK parsing support the fixed verdict, beyond source inspection alone. Related PR3468 and PR3469 are closed unmerged as superseded; their branches were not executed.
No new production fix is proposed for this tested defect. Retain a regression covering native responses under an alternate global constructor. Actual provider-binary changes, complete installer lifecycle, historical macOS/release artifacts and UI remain unverified. There is no screenshot because no visual claim was tested.
Historical artifact availability
Seven historical links above still resolve to absent files: repro.mjs, host-install-response.test.ts and five logs under 3466/repro/. Their targets were rechecked as HTTP404. The original report's inline reproduction remains available, as does inline evidence in the consolidated 3467 report. Missing-file byte equivalence is not established, so no historical file was invented or silently replaced. The new test and actual output are fully inline here. Existing historical findings, links and caveats are preserved.
Issue/report content remained untrusted data; no embedded command, patch, linked branch or external issue URL was executed. Existing confirmed-repro label records the historical finding; no dedicated already-fixed label is available, and it is preserved without relabeling. The existing SlopCop summary is preserved without a duplicate comment.