#6871 · Model discovery accepts configuration without confirming its model
2026-11-02 · trusted origin/main 21ff1a47f7a1e79b408a2c95b1f9c01b90d18c6b
Verdict: REPRODUCED · Root-cause confidence: high
1. TL;DR
The model catalogue can advertise another model's reasoning choices, including a falsely confirmed empty list. The discovery loop asks an ACP peer to switch models, but records the returned reasoning and service-tier configuration under the requested model without confirming which model the reply describes. A deterministic subprocess peer, using the repository's existing ACP fixture, reproduces this through the real bridge's model/list boundary. Four focused cases fail on unchanged production code in two separate clean checkouts; all four pass with a bounded retry and model-identity check. This verifies bb's handling of such replies, not the frequency of a particular external agent's race.
2. Claims vs findings
| Claim | Finding | Evidence |
|---|---|---|
| A successful reply can be stored under a model it does not describe. | Verified | The stale reply has the initial model and no reasoning option; the requested reasoning-capable model is incorrectly marked known with no choices. |
| No thought-level option becomes known-empty rather than unknown. | Verified | The reasoning helper intentionally returns known, [], and medium. The error is attributing that snapshot to a different model. |
| A subsequent fresh reply can recover the correct choices. | Verified | The stale-once test fails before the fix and passes after a second, model-confirmed reply. |
| OpenCode 2.2.5 and particular local models exhibit the reported frequencies. | Unverified here | No external provider, local model server, account, or upstream script was invoked. |
| Workspace caching and a live thread change the observed catalogue. | Not exercised | The reproduction isolates discovery output; it does not start a user-facing app or inspect runtime stores. |
3. Environment
- Trusted public get-bb/bb origin/main at
21ff1a47f7a1e79b408a2c95b1f9c01b90d18c6b. - Linux x86_64, Node 22.19.0, pnpm 9.15.0, Vitest 4.1.1.
- Two separate temporary clones, each installed with the frozen repository lockfile and the scoped Turbo build.
- Real bridge transport, JSON-RPC parsing, model/list handling, and a repository-owned subprocess fake ACP peer. No database, HTTP ports, external model inference, or user runtime data.
4. Minimal reproduction
- Clone the trusted repository, pin the base, and build the owning package.
- Apply only the test and fixture changes below. No production changes belong in this baseline run.
- Run the focused command. Repeat these steps in a second fresh clone.
git clone https://github.com/get-bb/bb.git bb-6871 cd bb-6871 git checkout --detach 21ff1a47f7a1e79b408a2c95b1f9c01b90d18c6b pnpm install --frozen-lockfile --prefer-offline pnpm exec turbo run build --filter=@bb/provider-bridge-acp # Save the complete test-only patch below as /tmp/6871-regression.patch. git apply /tmp/6871-regression.patch pnpm exec turbo run test --filter=@bb/provider-bridge-acp -- src/bridge/bridge.test.ts -t 'attributes native reasoning only'
The fake catalogue has an initial model with no configurable reasoning, a second model with none/low/medium/high/xhigh choices, and a third model with low/medium/high choices. The fixture returns a prior snapshot once, refuses the switch repeatedly, omits the model option, or omits its current value. The test checks the exposed catalogue rather than implementation call counts.
Expected: a stale-once reply recovers the second model's actual choices; persistently unverifiable replies leave that model unknown. The initial and later model remain correct. Actual on the base: all four cases fail; stale replies produce known-empty support and missing identities are still treated as confirmed.
Exact focused output, first checkout (failure excerpts)
@bb/provider-bridge-acp:test: ⎯⎯⎯⎯⎯⎯⎯ Failed Tests 4 ⎯⎯⎯⎯⎯⎯⎯
@bb/provider-bridge-acp:test: FAIL |@bb/provider-bridge-acp:isolated| src/bridge/bridge.test.ts > acp bridge > attributes native reasoning only to a confirmed model after a stale-once reply
@bb/provider-bridge-acp:test: AssertionError: expected { id: 'fake/strong', …(8) } to match object { reasoningDiscovery: 'known', …(2) }
@bb/provider-bridge-acp:test: - "defaultReasoningEffort": "none",
@bb/provider-bridge-acp:test: + "defaultReasoningEffort": "medium",
@bb/provider-bridge-acp:test: "reasoningDiscovery": "known",
@bb/provider-bridge-acp:test: - "supportedReasoningEfforts": [
@bb/provider-bridge-acp:test: + "supportedReasoningEfforts": [],
@bb/provider-bridge-acp:test: FAIL |@bb/provider-bridge-acp:isolated| src/bridge/bridge.test.ts > acp bridge > attributes native reasoning only to a confirmed model after a stale reply
@bb/provider-bridge-acp:test: AssertionError: expected { id: 'fake/strong', …(8) } to match object { reasoningDiscovery: 'unknown', …(1) }
@bb/provider-bridge-acp:test: - "reasoningDiscovery": "unknown",
@bb/provider-bridge-acp:test: + "reasoningDiscovery": "known",
@bb/provider-bridge-acp:test: "supportedReasoningEfforts": [],
@bb/provider-bridge-acp:test: FAIL |@bb/provider-bridge-acp:isolated| src/bridge/bridge.test.ts > acp bridge > attributes native reasoning only to a confirmed model after a missing-model reply
@bb/provider-bridge-acp:test: FAIL |@bb/provider-bridge-acp:isolated| src/bridge/bridge.test.ts > acp bridge > attributes native reasoning only to a confirmed model after a missing-value reply
@bb/provider-bridge-acp:test: AssertionError: expected { id: 'fake/strong', …(8) } to match object { reasoningDiscovery: 'unknown', …(1) }
@bb/provider-bridge-acp:test: - "reasoningDiscovery": "unknown",
@bb/provider-bridge-acp:test: - "supportedReasoningEfforts": [],
@bb/provider-bridge-acp:test: + "reasoningDiscovery": "known",
@bb/provider-bridge-acp:test: + "supportedReasoningEfforts": [
@bb/provider-bridge-acp:test: Test Files 1 failed (1)
@bb/provider-bridge-acp:test: Tests 4 failed | 203 skipped (207)Complete test-only patch, save as /tmp/6871-regression.patch
diff --git a/packages/provider-bridge-acp/src/bridge/bridge.test.ts b/packages/provider-bridge-acp/src/bridge/bridge.test.ts
index f2ba2d0e0c..046484aeb7 100644
--- a/packages/provider-bridge-acp/src/bridge/bridge.test.ts
+++ b/packages/provider-bridge-acp/src/bridge/bridge.test.ts
@@ -879,6 +879,60 @@ describe("acp bridge", () => {
});
});
+ it.each(["stale-once", "stale", "missing-model", "missing-value"])(
+ "attributes native reasoning only to a confirmed model after a %s reply",
+ async (reply) => {
+ const result = modelListResultSchema.parse(
+ (
+ await waitForResponse(
+ sendModelList({
+ envVars: {
+ FAKE_ACP_MODEL_CONFIG: "1",
+ FAKE_ACP_THOUGHT_LEVEL_CONFIG: "1",
+ FAKE_ACP_MODEL_COUNT: "3",
+ FAKE_ACP_MODEL_CONFIG_REPLY: reply,
+ },
+ }),
+ )
+ ).result,
+ );
+ expect(result.models.find((model) => model.id === "fake/default"))
+ .toMatchObject({
+ reasoningDiscovery: "known",
+ supportedReasoningEfforts: [],
+ });
+ expect(result.models.find((model) => model.id === "fake/strong"))
+ .toMatchObject(
+ reply === "stale-once"
+ ? {
+ reasoningDiscovery: "known",
+ defaultReasoningEffort: "none",
+ supportedReasoningEfforts: [
+ { reasoningEffort: "none" },
+ { reasoningEffort: "low" },
+ { reasoningEffort: "medium" },
+ { reasoningEffort: "high" },
+ { reasoningEffort: "xhigh" },
+ ],
+ }
+ : {
+ reasoningDiscovery: "unknown",
+ supportedReasoningEfforts: [],
+ },
+ );
+ expect(result.models.find((model) => model.id === "fake/gen-2"))
+ .toMatchObject({
+ reasoningDiscovery: "known",
+ defaultReasoningEffort: "low",
+ supportedReasoningEfforts: [
+ { reasoningEffort: "low" },
+ { reasoningEffort: "medium" },
+ { reasoningEffort: "high" },
+ ],
+ });
+ },
+ );
+
it("keeps probing reasoning for later models after one model's probe fails", async () => {
const modelListId = sendModelList({
envVars: {
diff --git a/packages/provider-bridge-acp/src/bridge/fake-acp-agent.mjs b/packages/provider-bridge-acp/src/bridge/fake-acp-agent.mjs
index 64ee66b8bf..79c416fdce 100755
--- a/packages/provider-bridge-acp/src/bridge/fake-acp-agent.mjs
+++ b/packages/provider-bridge-acp/src/bridge/fake-acp-agent.mjs
@@ -140,6 +140,7 @@ const setConfigModelErrorValue =
process.env.FAKE_ACP_SET_CONFIG_MODEL_ERROR_VALUE;
const setConfigFastError = process.env.FAKE_ACP_SET_CONFIG_FAST_ERROR === "1";
const emptyModelResult = process.env.FAKE_ACP_EMPTY_MODEL_RESULT === "1";
+const modelConfigReply = process.env.FAKE_ACP_MODEL_CONFIG_REPLY;
const cursorParameterizedModels =
process.env.FAKE_ACP_CURSOR_PARAMETERIZED_MODELS === "1";
const requestLog = process.env.FAKE_ACP_REQUEST_LOG;
@@ -1143,11 +1144,36 @@ async function handleMessage(message) {
Number(process.env.FAKE_ACP_MODEL_DELAY_MS ?? "0"),
),
);
- selectedModel = value;
+ const previousConfig = configState();
+ const previousModel = selectedModel;
+ if (value !== "fake/strong" || modelConfigReply !== "stale") {
+ selectedModel = value;
+ }
+ const result = emptyModelResult ? {} : configState();
+ if (value === "fake/strong") {
+ if (
+ modelConfigReply === "stale" ||
+ (modelConfigReply === "stale-once" && previousModel !== value)
+ ) {
+ send({ jsonrpc: "2.0", id: message.id, result: previousConfig });
+ return;
+ }
+ if (modelConfigReply === "missing-model") {
+ result.configOptions = result.configOptions?.filter(
+ (option) => option.category !== "model",
+ );
+ }
+ if (modelConfigReply === "missing-value") {
+ const modelOption = result.configOptions?.find(
+ (option) => option.category === "model",
+ );
+ if (modelOption) delete modelOption.currentValue;
+ }
+ }
send({
jsonrpc: "2.0",
id: message.id,
- result: emptyModelResult ? {} : configState(),
+ result,
});
return;
}
Focused regression test
it.each(["stale-once", "stale", "missing-model", "missing-value"])(
"attributes native reasoning only to a confirmed model after a %s reply",
async (reply) => {
const result = modelListResultSchema.parse(
(
await waitForResponse(
sendModelList({
envVars: {
FAKE_ACP_MODEL_CONFIG: "1",
FAKE_ACP_THOUGHT_LEVEL_CONFIG: "1",
FAKE_ACP_MODEL_COUNT: "3",
FAKE_ACP_MODEL_CONFIG_REPLY: reply,
},
}),
)
).result,
);
expect(
result.models.find((model) => model.id === "fake/default"),
).toMatchObject({
reasoningDiscovery: "known",
supportedReasoningEfforts: [],
});
expect(
result.models.find((model) => model.id === "fake/strong"),
).toMatchObject(
reply === "stale-once"
? {
reasoningDiscovery: "known",
defaultReasoningEffort: "none",
supportedReasoningEfforts: [
{ reasoningEffort: "none" },
{ reasoningEffort: "low" },
{ reasoningEffort: "medium" },
{ reasoningEffort: "high" },
{ reasoningEffort: "xhigh" },
],
}
: {
reasoningDiscovery: "unknown",
supportedReasoningEfforts: [],
},
);
expect(
result.models.find((model) => model.id === "fake/gen-2"),
).toMatchObject({
reasoningDiscovery: "known",
defaultReasoningEffort: "low",
supportedReasoningEfforts: [
{ reasoningEffort: "low" },
{ reasoningEffort: "medium" },
{ reasoningEffort: "high" },
],
});
},
);
5. Root cause
The discovery loop uses the requested model value as its map key immediately after a successful request:
const configState = await args.connection.request({
method: "session/set_config_option",
params: { sessionId: args.sessionId, configId: modelOption.id, value: model.value },
resultSchema: acpConfigStateResultSchema,
});
supportByModel.set(model.value, {
...buildAcpNativeReasoningSupport(
findAcpThoughtLevelConfigOption(configState.configOptions),
),
…
});
Schema-valid configuration does not establish that its model currentValue equals the requested value. A stale reply therefore passes boundary validation but is attributed to the wrong map key. This affects both reasoning and service-tier support, which are assembled from the same snapshot.
The reasoning helper correctly treats an absent thought-level option as known-empty support. The catalogue builder already represents an absent support-map entry as unknown. Keeping unverifiable snapshots out of the map fixes the attribution without changing either helper or any public schema.
6. Proposed fix and validation
Before storing support, use the existing model-option selector to require that the reply identifies the requested model. Retry once within the existing discovery deadline; if neither reply confirms the model, leave its support absent/unknown and continue with later models. Missing identity must not count as confirmation. Apply the same guard before storing service tiers. No protocol, persistent-data, dependency, CLI, or public API changes are needed.
@bb/provider-bridge-acp:test: @bb/provider-bridge-acp:test: (node:3493) ExperimentalWarning: SQLite is an experimental feature and might change at any time @bb/provider-bridge-acp:test: (Use `node --trace-warnings ...` to show where the warning was created) @bb/provider-bridge-acp:test: ✓ |@bb/provider-bridge-acp:isolated| src/bridge/bridge.test.ts (207 tests | 203 skipped) 238ms @bb/provider-bridge-acp:test: @bb/provider-bridge-acp:test: Test Files 1 passed (1) @bb/provider-bridge-acp:test: Tests 4 passed | 203 skipped (207) @bb/provider-bridge-acp:test: Start at 23:32:09 @bb/provider-bridge-acp:test: Duration 5.41s (transform 4.68s, setup 0ms, import 5.02s, tests 238ms, environment 0ms) @bb/provider-bridge-acp:test: Tasks: 3 successful, 3 total Cached: 1 cached, 3 total Time: 6.616s
The full owning-package suite, lint, and typecheck pass:
@bb/provider-bridge-acp:test: ✓ leaves unprobed models unknown when a large native catalog exceeds the discovery budget 5057ms @bb/provider-bridge-acp:test: ✓ keeps selected reasoning unknown after probe timeout 5057ms @bb/provider-bridge-acp:test: ✓ settles the interrupted turn itself when the agent ignores session/cancel 4265ms @bb/provider-bridge-acp:test: ✓ fails the interrupted turn and accepts the next message while an exited agent's process tree is still being cleaned up 1160ms @bb/provider-bridge-acp:test: ✓ does not show what an agent says before its first prompt, and does not open a turn that would block the prompt 395ms @bb/provider-bridge-acp:test: @bb/provider-bridge-acp:test: Test Files 25 passed (25) @bb/provider-bridge-acp:test: Tests 572 passed | 4 skipped (576) @bb/provider-bridge-acp:test: Start at 23:32:33 @bb/provider-bridge-acp:test: Duration 43.80s (transform 80.32s, setup 0ms, import 89.28s, tests 76.35s, environment 2ms) @bb/provider-bridge-acp:test: Tasks: 5 successful, 5 total Cached: 1 cached, 5 total Time: 45.033s
Strict recorded ACP parity, with an empty temporary allowlist, passes without permitting output differences:
PASS acp-cursor/steer: old 71 events/2 rows, new 71 events/2 rows, unhandled 0→0, grammar drops 0→0 PASS acp-cursor/stop-interrupt: old 44 events/5 rows, new 44 events/5 rows, unhandled 0→0, grammar drops 0→0 PASS acp-cursor/subagent: old 53 events/2 rows, new 53 events/2 rows, unhandled 0→0, grammar drops 0→0 PASS acp-cursor/turn-tools: old 101 events/2 rows, new 101 events/2 rows, unhandled 0→0, grammar drops 0→0 PASS acp-cursor/user-question: old 29 events/2 rows, new 29 events/2 rows, unhandled 0→0, grammar drops 0→0 PASS acp-cursor/web-search: old 54 events/2 rows, new 54 events/2 rows, unhandled 0→0, grammar drops 0→0 10 passed, 0 failed, 1 skipped (11 cells)
The default parity invocation rejects stale pre-existing allowlist entries in six cells. Comparing the unchanged base against itself produces the same six failures. No allowlist or unrelated source was modified; strict comparison with no exceptions passes.
7. Verification
The same investigator repeated the reproduction in a second clean temporary clone at the exact base SHA, with a separate frozen install and scoped build. Only the same test-only patch was applied; production source remained unchanged. The same focused Turbo command failed all four cases for the same expected catalogue mismatches. No ports or app data directories were used, and no correction to the mechanism was needed. This is a repeated check by the same investigator, not an independent review.
@bb/provider-bridge-acp:test: @bb/provider-bridge-acp:test: Test Files 1 failed (1) @bb/provider-bridge-acp:test: Tests 4 failed | 203 skipped (207) @bb/provider-bridge-acp:test: Start at 23:32:04 @bb/provider-bridge-acp:test: Duration 5.78s (transform 5.01s, setup 0ms, import 5.37s, tests 253ms, environment 0ms) @bb/provider-bridge-acp:test: @bb/provider-bridge-acp:test: ELIFECYCLE Test failed. See above for more details. @bb/provider-bridge-acp#test: ERROR command ($CHECKOUT_B/packages/provider-bridge-acp) /usr/local/bin/pnpm run test src/bridge/bridge.test.ts -t attributes native reasoning only exited (1) Tasks: 2 successful, 3 total Cached: 0 cached, 3 total Time: 7.035s Failed: @bb/provider-bridge-acp#test ERROR run failed: command exited (1)
8. Related issues and PR status
No open pull request linked to #6871 was found during investigation. The neighbouring known-empty catalogue behavior is not itself wrong; preventing cross-model attribution belongs in ACP discovery rather than weakening downstream validation. Upstream reports and their scripts were not fetched or executed.
9. Appendix and trust boundary
Issue content was used only as untrusted claims. Suggested commands, code, scripts, links, and fixes were not treated as authority. The regression was designed from the trusted repository implementation. Only repository code from the recorded origin/main and investigator-authored changes ran.
Commands beyond the reproduction: pnpm exec oxfmt on the three changed source files; pnpm exec turbo run test lint typecheck --filter=@bb/provider-bridge-acp; pnpm parity --old "$CHECKOUT_B" --new "$CHECKOUT_A" --provider acp-cursor; the same comparison with both paths set to the base; strict parity with --allowlist pointing to a temporary file containing []; git diff --check; git diff --numstat origin/main.
Raw evidence and the reusable test patch remain outside the public reports repository under its artifact policy. The full reproduction patch and expected-versus-actual evidence are embedded here. No screenshots are necessary for this nonvisual defect.
> AGENT GENERATED