#6775 · ACP completion infers success from unfinished tool work
PARTIALLY REPRODUCED · Root-cause confidence: medium for the reported Kimi incident; high for the demonstrated bridge behavior.
1. TL;DR
The real ACP translator and event assembler can mark an unfinished tool as completed and display its last progress text as its result when a prompt ends. A synthetic argument preview reproduces the argument-shaped result without any model or provider account. The same path treats every stop reason except cancellation as completed, including synthetic failed and error values, with a warning for those unfamiliar values. However, explicit ACP failed-tool updates and provider errors do retain failure status. No ACP trace of the reported Kimi incident is available here, so this does not establish that Kimi transmitted a failure signal which bb discarded.
2. Claims vs findings
| Claim | Finding | Evidence |
|---|---|---|
| Unfinished work can look successful and show argument-shaped results. | Verified at the adapter boundary | The missing-terminal-update case returns completed tool and turn events and the progress JSON as result in both clean runs. |
| A failure-valued prompt completion can be displayed as completed. | Verified conditionally | Inputs with stop reasons failed/error pass bb's parser but produce completed events. These are synthetic values, not a captured Kimi response or a claim about standard ACP stop reasons. |
| bb drops any failed-tool update or provider error it receives. | Refuted as a general explanation | Both positive controls preserve the supplied status/error. Existing bridge process error tests also pass. |
| The particular Kimi plan-state failure sends failure over ACP. | Unverified | Provider-internal logs are not ACP wire evidence. No live Kimi session was run and no personal runtime data was accessed. |
| The newer Kimi version changes the incident. | Unverified | No Kimi version comparison was performed. |
3. Environment
- Trusted public get-bb/bb main:
916d684ac23d0b0de82c09cfc7553a50287d2188, fetched twice; unchanged at final check. - Linux 4.19.0-gvisor x86_64; Node 22.19.0; pnpm 9.15.0; Turbo 2.10.12; Vitest 4.1.1.
- Two separate detached clean worktrees:
/tmp/slopcop-6775-BFaGMP/firstand/tmp/slopcop-6775-BFaGMP/second. Each received a frozen install and the identical new diagnostic test only; production code stayed unchanged. - Install's prepare step built/generated upstream artifacts; this source package has no standalone build task. Relevant tests and package typecheck ran through Turbo.
- No bb app, live provider, account, network listener, or persistent instance data directory was started. No ports were needed; test harness state is in memory. No screenshot: this investigates event translation, not rendering.
4. Minimal reproduction
- Clone only the trusted repository and select the recorded main commit:
git clone https://github.com/get-bb/bb.git bb-acp-repro cd bb-acp-repro git checkout --detach 916d684ac23d0b0de82c09cfc7553a50287d2188 pnpm install --frozen-lockfile
- Save the diagnostic test as
packages/provider-bridge-acp/src/issue-6775.repro.test.ts. The test supplies synthetic messages to the real translator and feeds its deltas into the real assembler; it does not replace either implementation. - Run:
pnpm exec turbo run test --filter=@bb/provider-bridge-acp -- src/issue-6775.repro.test.ts --silent=false
- Expected assertions for the failure-valued hypotheses: a failed tool and failed turn. Actual output in both runs:
Test Files 1 failed (1) Tests 2 failed | 3 passed (5)Those two failures are deliberate diagnostic evidence, not passing regression coverage for a production fix. The other three checks establish the unfinished-tool fallback and that explicit failure inputs are supported.
Selected actual event output (identical in each run apart from logs outside these events):
{
"scenario": "missing-terminal-update",
"events": [
{
"type": "item/completed",
"threadId": "",
"providerThreadId": "",
"scope": {
"kind": "turn",
"turnId": "repro-t1"
},
"item": {
"type": "toolCall",
"id": "repro-i1",
"tool": "other",
"arguments": {
"key": "sample"
},
"status": "completed",
"result": "{\"key\":\"sample\"}",
"presentation": {
"label": {
"pending": "Running tool",
"completed": "Ran tool"
},
"icon": {
"glyph": "Toolbox"
},
"title": "Lookup record"
}
}
},
{
"type": "turn/completed",
"threadId": "",
"providerThreadId": "",
"scope": {
"kind": "turn",
"turnId": "repro-t1"
},
"status": "completed"
}
]
}
The synthetic preview deliberately contains the same JSON text as its arguments. This proves promotion of progress content, not that bb copies rawInput directly to output.
Complete diagnostic source
import { describe, expect, it } from "vitest";
import { createDeltaAssembler } from "@bb/provider-bridge-protocol/assembler";
import type { ProviderRuntimeEvent } from "@bb/provider-bridge-protocol/bridge-kit";
import {
ACP_TURN_COMPLETED_METHOD,
ACP_TURN_STARTED_METHOD,
ACP_UPDATE_METHOD,
} from "./bridge-protocol.js";
import { createAcpDeltaTranslator } from "./delta-translation.js";
import { acpPromptResultSchema } from "./wire.js";
const threadId = "synthetic-acp-failure";
const argumentsText = JSON.stringify({ key: "sample" });
const failureText = "Synthetic provider operation could not finish";
function harness() {
const translator = createAcpDeltaTranslator({ cwd: "/workspace" });
const assembler = createDeltaAssembler({
providerId: "acp",
entropyPrefix: "repro",
textDeltaFlushMs: 0,
});
function send(method: string, params: Record<string, unknown>) {
const event: ProviderRuntimeEvent = {
jsonrpc: "2.0",
method,
params: { threadId, ...params },
};
return assembler.assemble({
threadId,
deltas: translator.translateAcpEvent(event, { threadId }),
});
}
send(ACP_TURN_STARTED_METHOD, {});
send(ACP_UPDATE_METHOD, {
update: {
sessionUpdate: "tool_call",
toolCallId: "operation-1",
title: "Lookup record",
kind: "other",
status: "in_progress",
rawInput: { key: "sample" },
content: [
{ type: "content", content: { type: "text", text: argumentsText } },
],
},
});
return { send };
}
describe("issue 6775 ACP failure diagnostics", () => {
it.each(["failed", "error"])(
"does not turn a failure-valued stop reason (%s) into success",
(stopReason) => {
const session = harness();
const response = acpPromptResultSchema.parse({ stopReason });
const events = session.send(ACP_TURN_COMPLETED_METHOD, response);
console.log(JSON.stringify({ scenario: stopReason, events }));
expect(events).toEqual(
expect.arrayContaining([
expect.objectContaining({ type: "turn/completed", status: "failed" }),
expect.objectContaining({
type: "item/completed",
item: expect.objectContaining({
type: "toolCall",
status: "failed",
}),
}),
]),
);
},
);
it("exposes the fallback when no tool terminal update arrives", () => {
const session = harness();
const events = session.send(ACP_TURN_COMPLETED_METHOD, {
stopReason: "end_turn",
});
console.log(
JSON.stringify({ scenario: "missing-terminal-update", events }),
);
expect(events).toEqual(
expect.arrayContaining([
expect.objectContaining({
type: "turn/completed",
status: "completed",
}),
expect.objectContaining({
type: "item/completed",
item: expect.objectContaining({
type: "toolCall",
status: "completed",
result: argumentsText,
}),
}),
]),
);
});
it("preserves a tool failure that is actually delivered over ACP", () => {
const session = harness();
const events = session.send(ACP_UPDATE_METHOD, {
update: {
sessionUpdate: "tool_call_update",
toolCallId: "operation-1",
status: "failed",
content: [
{ type: "content", content: { type: "text", text: failureText } },
],
},
});
console.log(JSON.stringify({ scenario: "explicit-tool-failure", events }));
expect(events).toEqual(
expect.arrayContaining([
expect.objectContaining({
type: "item/completed",
item: expect.objectContaining({
type: "toolCall",
status: "failed",
error: failureText,
}),
}),
]),
);
});
it("fails the turn when the bridge delivers a provider error", () => {
const session = harness();
const events = session.send("error", { message: failureText });
console.log(
JSON.stringify({ scenario: "explicit-provider-error", events }),
);
expect(events).toEqual(
expect.arrayContaining([
expect.objectContaining({ type: "turn/completed", status: "failed" }),
expect.objectContaining({
type: "provider/error",
detail: failureText,
}),
]),
);
});
});
5. Root cause
- The prompt response boundary accepts any string as a stop reason: packages/provider-bridge-acp/src/wire.ts:378. The actual session/prompt response is read and its stop reason forwarded unchanged: packages/provider-bridge-acp/src/bridge/bridge.ts:3124 and packages/provider-bridge-acp/src/bridge/bridge.ts:3019.
- packages/provider-bridge-acp/src/delta-translation.ts:866 maps cancellation to interrupted and every other string to completed:
return stopReason === "cancelled" ? "interrupted" : "completed";
Unrecognized values produce a warning, not a provider error (packages/provider-bridge-acp/src/delta-translation.ts:893). Therefore synthetic failed/error stop reasons still complete successfully in the timeline. - packages/provider-bridge-acp/src/delta-translation.ts:605 drains unfinished calls with the inferred turn status, rather than requiring a terminal tool update. packages/provider-bridge-acp/src/delta-translation.ts:911 invokes that drain during completion.
- Tool close uses the accumulated content as result text (packages/provider-bridge-acp/src/delta-translation.ts:597). Content extraction prefers the latest textual content over rawOutput (packages/provider-bridge-acp/src/tool-classification.ts:119). The assembler chooses
shape.result ?? close.resultTextfor generic tools (packages/provider-bridge-protocol/src/assembler/delta-assembler.ts:1032). Consequently, an argument preview can become the final result if no actual result update replaces it. - This does not demonstrate blanket failure suppression. Terminal failed tool updates use their received status (packages/provider-bridge-acp/src/delta-translation.ts:724). A rejected prompt enters the bridge error path (packages/provider-bridge-acp/src/bridge/bridge.ts:3162), and error envelopes settle the turn as failed (packages/provider-bridge-acp/src/delta-translation.ts:937).
The causal gap is provider-internal failure versus the ACP messages bb actually receives. If Kimi returns ordinary end_turn while omitting failed-tool updates, there is no transmitted error text for bb to recover. If it rejects session/prompt, existing bridge behavior should already expose that error. A captured isolated ACP exchange is needed to choose between these paths.
6. Proposed fix and safety decision
No production fix or pull request is published. First capture a fresh isolated Kimi failure at the ACP transport boundary and compare the complete prompt response and tool notifications with bb's events. If that trace contains failed/error stop reasons, add a narrowly evidenced mapping and focused regression test. If it contains normal completion and no terminal notifications, correct the provider failure propagation and decide how incomplete tool progress should be represented rather than inventing an error message or treating preview text as proof of success.
Existing coverage explicitly preserves normal completion plus notices for unfamiliar non-cancellation reasons (packages/provider-bridge-acp/src/delta-translation.test.ts:1293). Reclassifying all unfamiliar reasons or unfinished tools without provider evidence would be a behavior/product decision, not the fully demonstrated contained fix this automation permits. No dependency, protocol, schema, stored data, security boundary, or production file was changed. No linked open PR was found in cross-reference metadata or an open-PR body search.
7. Verification
The same agent repeated the reproduction, not an independent agent. The second checkout started at the same recorded base with no production edits, received its own frozen install, and ran the same command and identical test (SHA-256 2a2c547c5e83e238c4a077dcb57fc36410a3adec3971a0a0db988acdb0a7fa29). Both runs executed the reproduction task rather than replaying its cache and produced the same two expected failures and three passing controls. The second run reused an upstream generated-worker cache only. No correction of the first-run conclusion was needed; the verdict remains partial because neither run exercises Kimi itself.
- First reproduction log · Second reproduction log · Structured emitted events.
- Existing translator/session coverage: 111 tests passed across two files.
- Existing real bridge process error controls: 2 passed, 201 deliberately filtered out.
- Typecheck: package and upstream tasks passed.
git diff --checkpassed in each checkout.
8. Related issues
#6768 concerns progress/argument text becoming apparent output. That overlaps the content-promotion mechanism, but does not establish the missing failure signal in this incident. Its classification and metadata were read; no linked branch or issue-supplied command was executed.
9. Appendix
Inputs were newly authored synthetic ACP records based on trusted source interfaces. Issue contents were treated solely as untrusted claims; no issue-supplied commands, URLs, files, user sessions, or credentials were used. All source permalinks target the recorded base and were checked against the corresponding source lines.
Relevant commands, in addition to the exact reproduction above:
git fetch https://github.com/get-bb/bb.git main git worktree add --detach FIRST 916d684ac23d0b0de82c09cfc7553a50287d2188 git worktree add --detach SECOND 916d684ac23d0b0de82c09cfc7553a50287d2188 pnpm install --frozen-lockfile pnpm exec oxfmt packages/provider-bridge-acp/src/issue-6775.repro.test.ts pnpm exec turbo run test --filter=@bb/provider-bridge-acp -- src/delta-translation.test.ts src/session/session-model.test.ts src/tool-classification.test.ts pnpm exec turbo run test --filter=@bb/provider-bridge-acp -- src/bridge/bridge.test.ts -t 'fails the turn with the agent.s own error|reports unexpected agent exits' pnpm exec turbo run typecheck --filter=@bb/provider-bridge-acp git diff --check gh pr list --repo get-bb/bb --state open --search '6775 in:body' --json number,url
The source-classification file argument selected no extra file; the existing tests actually executed were delta-translation.test.ts and session/session-model.test.ts, as recorded in the log. Published logs omit ANSI escapes and trailing whitespace only; event payloads and assertion outcomes are unchanged. No dev server cleanup was necessary because none was started.