#7544 · ACP bridge discards idle user input
Verdict: REPRODUCED · Root-cause confidence: high · Reproduction label: confirmed-repro
1. TL;DR
The ACP bridge can display an agent's unsolicited answer without the user input that prompted it. An idle user_message_chunk starts agent work, but the translator classifies it as noise and emits no timeline delta. Subsequent assistant chunks do produce timeline items. A repository-native bridge test reproduces the missing message in two clean checkouts of trusted main; no user configuration, real account, or issue-provided program was used.
2. Claims vs findings
| Claim | Finding | Evidence |
|---|---|---|
| Idle user input disappears while the answer survives. | Verified | Both runs contain two assistant items and no intervening user item. |
| The session model observes the user chunk, but translation drops it. | Verified | Agent turn starts; source inspection identifies the unconditional noise path. |
| Prompt echoes and history replay should remain suppressed. | Verified guard behavior | Focused post-change bridge test covers prompted input, compaction, and session/load. |
| The same behavior occurs in the reported desktop/cloud setup. | Not separately verified | The Linux bridge process boundary is exercised, not the original macOS client or third-party service. |
3. Environment
- Trusted target: public
get-bb/bb; origin/main and GitHub main resolved tof024a372f0e1e0670f6fd7452ebcd1341f639c95. - Linux x86_64; Node v22.19.0; pnpm 9.15.0; Vitest 4.1.12; repository-pinned ACP SDK 1.9.0.
- Each checkout used its own frozen install and repository fixture subprocess. Tests allocate fresh temporary workspace directories and capture bridge JSON-RPC output.
- No live bb instance, production store, configured account, HTTP port, or browser was needed. This verifies missing timeline data rather than a rendering-only defect.
4. Minimal reproduction
- Use the trusted base and apply only the independently authored fixture/test patch below.
- Run the focused test. The existing harness starts the actual ACP bridge, sends a prompted turn, then receives two remote user text chunks and an unsolicited assistant answer from its fixture agent.
- The assertion requires the remote text as one user item between the two answers. On unchanged production code it fails because only the two assistant items exist.
git clone https://github.com/get-bb/bb.git bb-7544 cd bb-7544 git checkout f024a372f0e1e0670f6fd7452ebcd1341f639c95 pnpm install --frozen-lockfile --prefer-offline curl -fsS https://get-bb.github.io/reports/issues/7544/repro/regression.patch -o /tmp/bb-7544-regression.patch git apply /tmp/bb-7544-regression.patch pnpm exec turbo run build --filter=@bb/provider-bridge-acp pnpm exec turbo run test --filter=@bb/provider-bridge-acp -- --testNamePattern='preserves external user chunks'
Expected completed message items:
agentMessage: initial answer userMessage: Remote question continued agentMessage: remote answer
Actual completed message items on trusted main:
agentMessage: initial answer agentMessage: remote answer
Both runs exit 1 with:
AssertionError: expected [ Array(2) ] to match object [ Array(3) ] Test Files 1 failed | 24 skipped (25) Tests 1 failed | 591 skipped (592)
Author-created fixture and regression test, supplied as a patch to existing repository tests (download):
diff --git a/packages/provider-bridge-acp/src/bridge/bridge.test.ts b/packages/provider-bridge-acp/src/bridge/bridge.test.ts
index 4ad213c727..25469270b5 100644
--- a/packages/provider-bridge-acp/src/bridge/bridge.test.ts
+++ b/packages/provider-bridge-acp/src/bridge/bridge.test.ts
@@ -5218,6 +5218,42 @@ describe("acp bridge: work the agent starts on its own", () => {
expect(turnStatuses()).toEqual(["completed", "completed"]);
});
+ it("preserves external user chunks as one message before the unprompted answer", async () => {
+ const { providerThreadId } = await startThread();
+ vi.useFakeTimers({ toFake: [...FAKED_TIMERS] });
+ try {
+ await runPromptedTurn(providerThreadId, "then-external-input");
+ await waitForTurnStartedCount(2);
+ await waitFor(
+ () => agentMessageTexts().includes("remote answer") ? true : undefined,
+ "external answer",
+ );
+ await vi.advanceTimersByTimeAsync(5_000);
+ await waitFor(
+ () => turnStatuses().length === 2 ? true : undefined,
+ "external turn completion",
+ );
+
+ const messages = threadEventsOfType("item/completed")
+ .map((event) => event.item)
+ .filter((item) =>
+ typeof item === "object" && item !== null && "type" in item &&
+ (item.type === "userMessage" || item.type === "agentMessage"),
+ );
+ expect(messages).toMatchObject([
+ { type: "agentMessage", text: "initial answer" },
+ {
+ type: "userMessage",
+ content: [{ type: "text", text: "Remote question continued" }],
+ },
+ { type: "agentMessage", text: "remote answer" },
+ ]);
+ expect(turnStatuses()).toEqual(["completed", "completed"]);
+ } finally {
+ vi.useRealTimers();
+ }
+ });
+
it("opens a turn for unprompted output and closes it after a quiet window", async () => {
const { providerThreadId } = await startThread();
vi.useFakeTimers({ toFake: [...FAKED_TIMERS] });
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 3f2aaef30d..5e3702514f 100755
--- a/packages/provider-bridge-acp/src/bridge/fake-acp-agent.mjs
+++ b/packages/provider-bridge-acp/src/bridge/fake-acp-agent.mjs
@@ -685,6 +685,17 @@ async function handlePrompt(message) {
} catch {
notifyUpdate(messageChunk("write:denied"));
}
+ } else if (text.includes("then-external-input")) {
+ notifyUpdate(messageChunk("initial answer"));
+ setTimeout(() => {
+ for (const text of ["Remote question", " continued"]) {
+ notifyUpdate({
+ sessionUpdate: "user_message_chunk",
+ content: { type: "text", text },
+ });
+ }
+ notifyUpdate(messageChunk("remote answer"));
+ }, UNPROMPTED_DELAY_MS);
} else if (text.includes("then-unprompted-stream")) {
notifyUpdate(messageChunk("prompted reply"));
setTimeout(() => {
5. Root cause
The session model treats a decoded message chunk as agent activity. The bridge applies that update and opens an agent-initiated turn while idle. It then sends the update through the delta translator. The translator has no user-message case: its default path calls unhandledDeltas, which returns an empty array for anything classified as non-unknown. Visibility metadata unconditionally classifies user chunks as noise. Assistant chunks follow a recognized translation path, so the answer survives without the input.
packages/provider-bridge-acp/src/session/session-model.ts:274
function applyMessageChunk(
role: AcpMessageRole,
sessionUpdate: string,
update: AcpJsonObject,
): AcpSessionEvent[] {
const block = decodeContentBlock(update["content"]);
if (!block) {
return unhandled("malformed", sessionUpdate, update);
}
const activity = noteAgentActivity();
const message = resolveMessage(role, readString(update, "messageId"));
message.content.push(block);
currentMessage = message;
return [
...activity,
{
type: "message",
replay: replaying,
packages/provider-bridge-acp/src/bridge/bridge.ts:2982
const events = session.model.applySessionUpdate(rawUpdate);
publishSessionStateEvents(session, events);
session.agentUpdateCount += 1;
if (turnOutput) {
session.turnOutputCount += 1;
}
if (session.activePromptKind === null && startsAgentWork(events)) {
openAgentTurn(session);
} else if (session.activePromptKind === "agent") {
armAgentTurnQuietTimer(session);
}
emitForSession(session, ACP_UPDATE_METHOD, {
threadId: session.bbThreadId,
update,
});
}
async function releaseSession(session: AcpThreadSession): Promise<void> {
if (session.stopping) {
packages/provider-bridge-acp/src/visibility.ts:38
const NOISE_ACP_UPDATE_KINDS = new Set<string>([ "user_message_chunk", "available_commands_update", "current_mode_update", "config_option_update", ]);
packages/provider-bridge-acp/src/delta-translation.ts:475
function unhandledDeltas(rawEvent: JsonRpcMessage): ThreadDelta[] {
const description = acpVisibilityMetadata.describeRawEvent(rawEvent);
if (description.coverage !== "unknown") {
return [];
}
return [
{
kind: "unhandled",
raw: toRawEvent(rawEvent),
rawType: description.kind,
vouchedTurn: true,
},
];
}
packages/provider-bridge-acp/src/delta-translation.ts:892
default:
return unhandledDeltas(rawEvent);
}
History is separately consumed during session/load before ordinary translation, which is why globally displaying every user chunk would be the wrong repair.
packages/provider-bridge-acp/src/bridge/bridge.ts:3561
return;
}
const rawUpdate = isJsonObject(params) ? params["update"] : undefined;
if (session.loading) {
if (parsed.data.sessionId === session.loadingSessionId) {
session.model.applySessionUpdate(rawUpdate);
if (parsed.data.update.sessionUpdate === "usage_update") {
const usageUpdate = acpUsageUpdateSchema.safeParse(parsed.data.update);
if (usageUpdate.success) {
session.pendingLoadUsageUpdate = usageUpdate.data;
}
}
}
return;
}
if (session.providerThreadId === "") {
session.deferStartEmit?.(
6. Proposed fix
Have the bridge explicitly allow user input only during agent-initiated work, not prompted turns or compaction. Translate validated text through the existing input.provider delta. Coalesce adjacent user chunks, ignore interleaved metadata as message boundaries, and flush before assistant/tool output or at turn completion. Retain history suppression. The local implementation passes focused coverage for external text and echo/replay guards; full package checks are recorded with the eventual pull request.
Scope limits: no wire or persisted schema change, new CLI surface, or new label design is required to preserve text. Existing provider-input presentation uses its existing system-message card; a specialized “another client” badge and non-text ACP input remain separate design work, not claims made by this repair.
7. Related issues and PRs
#2122 addressed unsolicited agent turns, not the missing user item reproduced here. #3621 concerns input provenance, which is not redesigned in this repair. At investigation time the issue had no comments, no cross-referenced pull requests, and no matching open pull request. No fork or linked branch was fetched, checked out, or executed.
8. Verification
The same agent repeated the test in a second clean temporary checkout, detached at the exact trusted base. Its initial status was clean; only the regression patch was applied. A fresh frozen install and filtered Turbo build preceded the same focused command. The second run independently allocated fixture processes and temporary workspaces and failed for the same missing-user-item assertion. This is a repeat by one agent, not independent review. No report correction was needed.
- First reproduction log: one intended regression failure.
- Second clean reproduction log: same intended failure.
- Initial post-change focused run: two passing tests (external input and echo/load suppression).
Final local verification after extending coverage for metadata-interleaved chunks and input without a subsequent answer: uncached package suite, 25 files passed, 590 tests passed and 4 skipped; extracted package typecheck/lint output, both successful. The source diff changes four files within the ACP bridge subsystem, totaling 179 text lines (177 additions plus 2 deletions), with no binary changes; git diff --check passes. This is a normal package test/typecheck/lint check, not a desktop, browser, or cloud-service verification.
9. Appendix and trust boundary
The executable demo, quoted shell commands, and fork references in the issue were treated as untrusted claims. None were run or fetched. The fixture and test were authored from trusted repository evidence. Source excerpts above are taken directly from the recorded commit. Artifact logs replace local checkout paths with descriptive markers; no credentials or real user data were collected. The commands in the reproduction section are the full minimal execution sequence; setup additionally used GitHub read APIs to verify public visibility, classifications, and absence of linked open PRs.