#7980 · ACP prompt settlement and unfinished commands
Trusted main commit: 35a03bbbb3f4d8dc814c1a152db5a463102b4250
PARTIALLY REPRODUCED · Root-cause confidence: high for the bridge mechanism; vendor and end-to-end reproduction remain unverified.
1. TL;DR
BB can mark a command and its turn complete as soon as an ACP agent resolves its prompt, even when that agent last described the command as in progress. A self-authored ACP process demonstrates this on trusted main: BB emits both command completion and successful turn completion before the fixture is allowed to send a terminal command update. A second probe shows that an overload-like assistant reply followed by a successful ACP response remains ordinary successful output. The bridge trusts the prompt response, and the workflow text-result path trusts a worker becoming idle. These are verified compatibility mechanisms, not a live reproduction of Antigravity or proof that arbitrary diagnostic-looking text should always be treated as an error.
2. Claims vs findings
| Claim | Status | Evidence |
|---|---|---|
| A command may still be running when BB completes a prompted turn. | Verified at the ACP bridge boundary | Both clean runs emit a completed command and turn while the gated fixture reports terminalSent:false. No terminal update has been sent. |
| A capacity warning conveyed only as assistant text may settle successfully. | Verified with synthetic text | Two chunks containing a synthetic 503 diagnostic plus end_turn produce status:"completed" in both runs. The exact vendor banner and live capacity trigger were not replayed. |
| Workflow idle handling can accept this output as success. | Source-supported; no live workflow run | The no-schema branch stores any idle output as a succeeded result. Worker archival and live workflow orchestration were not exercised. |
| Native vendor swarm commands time out under full permission mode. | Unverified | No vendor binary or credentials were used. Existing full-mode permission-argument forwarding passes its focused control test; that does not prove behavior inside a vendor's nested workers. |
| A detached internal job can be tracked after its launcher says completed. | Unverified / insufficient lifecycle information | This experiment covers an explicitly unfinished execute call, not an already-completed launcher whose internal work is hidden from ACP. |
3. Environment
- Target: public repository
get-bb/bb, fresh main clone; base35a03bbbb3f4d8dc814c1a152db5a463102b4250. - Linux x86_64; Node
v22.19.0; pnpm9.15.0. - Two separate clean clones, called
baseandverify, at the same full commit. The verification run used--forceto prevent Turbo test-cache replay. - Only self-authored ACP fixture processes and repository test helpers ran. No vendor version was tested; no real BB instance, account, runtime store, listener, or network port was used. Each test creates and removes its own temporary workspace and handshake files.
- The normal frozen installation succeeded. The initial broad build stopped because plugin SDK runtime outputs were absent for unrelated plugins. The documented SDK type build succeeded; focused ACP tests and their Turbo upstream tasks ran successfully. No broad-build success is claimed.
4. Minimal reproduction
The test was designed from the trusted bridge wire schemas, prompt-settlement path, and existing bridge test helpers. No issue-supplied fixture, branch, script, binary, patch, or linked PR code was executed.
- Clone the trusted target and select the recorded main commit:
git clone --single-branch --branch main https://github.com/get-bb/bb.git bb-7980 cd bb-7980 git checkout --detach 35a03bbbb3f4d8dc814c1a152db5a463102b4250 pnpm install --frozen-lockfile --prefer-offline
- Copy the complete inline patch in the Appendix into
regression.patch, outside the checkout, then apply it withgit apply /path/to/regression.patch. It changes only the bridge test and adds a synthetic ACP fixture; production files remain unchanged. - Run the two focused probes:
pnpm exec turbo run test --filter=@bb/provider-bridge-acp --force -- src/bridge/bridge.test.ts -t 'settlement repro'
- Run successful controls for ordinary prompt settlement and full-mode permission-argument forwarding:
pnpm exec turbo run test --filter=@bb/provider-bridge-acp -- src/bridge/bridge.test.ts -t 'starts a session and runs a prompt turn end to end|launches full-mode ACP agents with configured permission CLI args'
Expected and actual
The capacity probe deliberately expresses the desired vendor-compatibility behavior, not a general ACP protocol requirement: a solely operational capacity failure must not be accepted as useful success. Actual output contains:
UNAVAILABLE: temporary resource exhaustion (503). - "status": "failed", + "status": "completed",
The command probe sends an in-progress execute event, resolves the prompt, and blocks the terminal event behind a file gate. It expects no successful completion while that gate is closed. Actual assertion:
AssertionError: expected [ { type: 'turn/completed', …(4) } ] to have a length of +0 but got 1
The captured event stream shows a command item/started with pending status, then item/completed with completed status, then turn/completed with completed status. The fixture's terminal-sent check is false at this point. Cleanup opens the gate and waits for the fixture to send its terminal update. Both probes fail intentionally on unchanged production code.
Test Files 1 failed (1)
Tests 2 failed | 231 skipped (233)
Successful controls:
Test Files 1 passed (1)
Tests 2 passed | 231 skipped (233)
Regression test fragment
Insert these cases into the existing describe("acp bridge") block. They use the existing real bridge entrypoint and output-event assembly helpers; no production test seam is added.
it("settlement repro: capacity-only output must not complete successfully", async () => {
const { providerThreadId } = await startThread({
agent: {
command: process.execPath,
args: [resolve(dirname(FAKE_AGENT_PATH), "settlement-repro-agent.mjs")],
},
envVars: { SETTLEMENT_SCENARIO: "capacity" },
});
await waitForResponse(sendTurnRequest("turn/start", providerThreadId, {
input: [{ type: "text", text: "capacity-probe", mentions: [] }],
}));
const completed = await waitForTurnCompleted();
console.error(JSON.stringify({ scenario: "capacity", messages: agentMessageTexts(), completed }));
expect(completed).toMatchObject({ status: "failed" });
});
it("settlement repro: an unfinished execute call must keep the turn open", async () => {
const ready = join(workspaceDir, "ready");
const release = join(workspaceDir, "release");
const done = join(workspaceDir, "done");
const { providerThreadId } = await startThread({
agent: {
command: process.execPath,
args: [resolve(dirname(FAKE_AGENT_PATH), "settlement-repro-agent.mjs")],
},
envVars: {
SETTLEMENT_SCENARIO: "operation",
SETTLEMENT_READY: ready,
SETTLEMENT_RELEASE: release,
SETTLEMENT_DONE: done,
},
});
await waitForResponse(sendTurnRequest("turn/start", providerThreadId, {
input: [{ type: "text", text: "operation-probe", mentions: [] }],
}));
try {
await waitForFileWithRealTimer(ready);
await new Promise((resolveTick) => realSetTimeout(resolveTick, 100));
console.error(JSON.stringify({ scenario: "operation", terminalSent: existsSync(done), events: threadEvents() }));
expect(threadEventsOfType("item/started")).not.toHaveLength(0);
expect(threadEventsOfType("turn/completed")).toHaveLength(0);
} finally {
writeFileSync(release, "release");
await waitForFileWithRealTimer(done);
}
});
Synthetic ACP fixture
New file: packages/provider-bridge-acp/src/bridge/settlement-repro-agent.mjs.
import { existsSync, writeFileSync } from "node:fs";
import { createInterface } from "node:readline";
const send = (message) => process.stdout.write(`${JSON.stringify(message)}\n`);
const update = (content) => send({
jsonrpc: "2.0",
method: "session/update",
params: { sessionId: "settlement-session", update: content },
});
const reply = (id, result) => send({ jsonrpc: "2.0", id, result });
createInterface({ input: process.stdin }).on("line", async (line) => {
const request = JSON.parse(line);
if (request.method === "initialize") {
reply(request.id, { protocolVersion: 1, agentCapabilities: {} });
} else if (request.method === "session/new") {
reply(request.id, { sessionId: "settlement-session" });
} else if (request.method === "session/prompt") {
if (process.env.SETTLEMENT_SCENARIO === "capacity") {
for (const text of ["UNAVAILABLE: ", "temporary resource exhaustion (503)."] ) {
update({ sessionUpdate: "agent_message_chunk", content: { type: "text", text } });
}
reply(request.id, { stopReason: "end_turn" });
} else {
update({ sessionUpdate: "tool_call", toolCallId: "operation-1", title: "Local operation", kind: "execute", status: "in_progress", rawInput: { command: "echo operation-result" } });
reply(request.id, { stopReason: "end_turn" });
writeFileSync(process.env.SETTLEMENT_READY, "ready");
while (!existsSync(process.env.SETTLEMENT_RELEASE)) {
await new Promise((resolveTick) => setTimeout(resolveTick, 10));
}
update({ sessionUpdate: "tool_call_update", toolCallId: "operation-1", status: "completed", rawOutput: { exitCode: 0, stdout: "operation-result" } });
writeFileSync(process.env.SETTLEMENT_DONE, "done");
}
} else if (request.id !== undefined) {
reply(request.id, {});
}
});
5. Root cause
Prompt settlement unconditionally calls finishTurn after the successful ACP response. There is an empty-output warning but no unfinished-execute guard or ordinary-assistant-text error classification on this path. finishTurn clears the active prompt and emits the completion notification.
finishTurn(session, stopReason); return;
The stop-reason mapping maps every non-cancelled stop reason to completed. Completion translation flushes open work using that successful status, then emits the turn boundary. Draining open tool calls closes any still-open tool items with the supplied turn-derived status. This explains the stronger observed symptom: BB marks the command itself complete before receiving a terminal tool event.
const status = turnStatusForStopReason(stopReason);
return [
...flushOpenTurnWork(context, itemStatusForTurnStatus(status)),
...,
{ kind: "turn.boundary", status, claimIfIdle: true },
];
For the diagnostic-text case, no actual JSON-RPC error was sent, so generic ACP success mapping is internally consistent. Built-in dialect selection has no Antigravity-specific adapter on this base. Text recognition therefore needs a deliberate vendor-specific contract rather than a generic keyword rule that would misclassify quotations or valid explanations.
Workflow idle reconciliation distinguishes structured output from plain output, but the plain-output branch stores idle output as succeeded without interpreting its meaning:
settleCall(db, {
id: call.id,
status: "succeeded",
result: output ?? "",
error: null,
});
This downstream acceptance is established by source inspection, not a live archival reproduction. The bridge result is enough to explain why a downstream consumer treating completed as authoritative cannot recover missing lifecycle or error semantics.
6. Proposed fix and simple-fix gate
First establish an authoritative vendor lifecycle trace: prompt return, execute status changes, cancellation, queued steering, late output, and disconnect. For a vendor that actually yields early, keep its existing turn open until observable execute work reaches a terminal state, while preserving interruption and shutdown behavior. Classify a verified capacity-only vendor diagnostic at the provider boundary as a typed retryable error, instead of teaching every workflow consumer to parse arbitrary prose. If a launcher already says completed, require an additional provider lifecycle signal before tracking hidden internal work. Document native-worker launch permissions only after verifying the vendor's accepted configuration.
No autonomous fix PR: the demonstrated generic bridge behavior is clear, but safely overriding prompt-completion authority and interpreting assistant prose require an unresolved provider-specific policy decision. The complete report also spans ACP settlement, workflow result policy, and native-worker permission configuration. This does not satisfy the single-subsystem/no-product-decision simple-fix gate. No production patch, fix branch, or push was made. The 84 added lines in two test/fixture files are local evidence only, not a proposed production repair.
7. Linked PR review
#7981 — closed, not merged
GitHub metadata and diff were read as untrusted evidence only, after authoring the reproduction. No PR branch was checked out and none of its tests or production code ran. The proposal introduces a vendor dialect, delayed execute settlement, capacity-text conversion, a workflow fallback, tests, and permission documentation across nine files. Its direction addresses the source mechanisms described here, but its runtime correctness and real-provider behavior are unverified.
Static scope concern (medium): the proposed plugins/workflows/src/service.ts:1159 fallback is tied to one configured provider identity, while its capacity recognition duplicates provider-side text matching. A differently named custom agent would not use that fallback. This is a configuration-dependent limitation, not a demonstrated new failure in a trusted-main test. Verdict: not runtime reviewed; the closed proposal is not an already-landed fix and is outside this rule's five-file/single-subsystem gate. No open linking PR was found in metadata or the open-PR search.
8. Verification
The same agent repeated the experiment in a second fresh clone named verify, not a worktree sharing edited files. Before copying only the self-authored test and fixture, its HEAD was checked against the recorded trusted main SHA and its working tree was clean. Frozen installation succeeded. The second execution used the same focused command with --force, newly allocated temporary test workspaces and new handshake files; no server ports or persistent app data were involved.
First run: two intended assertion failures, 231 tests skipped; test execution 356 ms. Second run: the same two intended assertion failures, 231 tests skipped; test execution 352 ms. The captured second-run stream again has premature successful command and turn completion before a terminal tool event. Normal prompt and full-mode forwarding controls pass. The report was kept PARTIALLY REPRODUCED because these runs do not validate the exact vendor banner, real native swarm permissions, or live workflow archival. No correction to the bridge root cause was required.
9. Related issues
- #7102 concerns official vendor-provider discovery and usage support; read as metadata only.
- #2461 concerns delivering wake notifications for previously settled ACP background work; this probe instead covers a tool explicitly still in progress at prompt return.
10. Appendix
Issue body, comments, code blocks, and links were treated as untrusted claims. Issue-supplied execution instructions were ignored, and no external issue-data URL was fetched. Only trusted repository code and the self-authored fixture were executed. No user runtime data or secrets were read.
Raw test logs remain outside this public repository under its evidence-retention policy. All code needed for reproduction and relevant exact assertion output are embedded in this HTML. Test scaffolding adds 47 lines to the existing bridge test and a 37-line new fixture; production remains unchanged. git diff --check passed.
Complete self-authored patch
diff --git a/packages/provider-bridge-acp/src/bridge/bridge.test.ts b/packages/provider-bridge-acp/src/bridge/bridge.test.ts
index 9d531dbad..d6c1ea5a6 100644
--- a/packages/provider-bridge-acp/src/bridge/bridge.test.ts
+++ b/packages/provider-bridge-acp/src/bridge/bridge.test.ts
@@ -734,6 +734,53 @@ afterEach(async () => {
}, 30_000);
describe("acp bridge", () => {
+ it("settlement repro: capacity-only output must not complete successfully", async () => {
+ const { providerThreadId } = await startThread({
+ agent: {
+ command: process.execPath,
+ args: [resolve(dirname(FAKE_AGENT_PATH), "settlement-repro-agent.mjs")],
+ },
+ envVars: { SETTLEMENT_SCENARIO: "capacity" },
+ });
+ await waitForResponse(sendTurnRequest("turn/start", providerThreadId, {
+ input: [{ type: "text", text: "capacity-probe", mentions: [] }],
+ }));
+ const completed = await waitForTurnCompleted();
+ console.error(JSON.stringify({ scenario: "capacity", messages: agentMessageTexts(), completed }));
+ expect(completed).toMatchObject({ status: "failed" });
+ });
+
+ it("settlement repro: an unfinished execute call must keep the turn open", async () => {
+ const ready = join(workspaceDir, "ready");
+ const release = join(workspaceDir, "release");
+ const done = join(workspaceDir, "done");
+ const { providerThreadId } = await startThread({
+ agent: {
+ command: process.execPath,
+ args: [resolve(dirname(FAKE_AGENT_PATH), "settlement-repro-agent.mjs")],
+ },
+ envVars: {
+ SETTLEMENT_SCENARIO: "operation",
+ SETTLEMENT_READY: ready,
+ SETTLEMENT_RELEASE: release,
+ SETTLEMENT_DONE: done,
+ },
+ });
+ await waitForResponse(sendTurnRequest("turn/start", providerThreadId, {
+ input: [{ type: "text", text: "operation-probe", mentions: [] }],
+ }));
+ try {
+ await waitForFileWithRealTimer(ready);
+ await new Promise((resolveTick) => realSetTimeout(resolveTick, 100));
+ console.error(JSON.stringify({ scenario: "operation", terminalSent: existsSync(done), events: threadEvents() }));
+ expect(threadEventsOfType("item/started")).not.toHaveLength(0);
+ expect(threadEventsOfType("turn/completed")).toHaveLength(0);
+ } finally {
+ writeFileSync(release, "release");
+ await waitForFileWithRealTimer(done);
+ }
+ });
+
it("answers initialize and lists grouped models without spawning an agent", async () => {
const initializeId = sendRequest("initialize", {
protocolVersion: PROVIDER_BRIDGE_PROTOCOL_VERSION,
diff --git a/packages/provider-bridge-acp/src/bridge/settlement-repro-agent.mjs b/packages/provider-bridge-acp/src/bridge/settlement-repro-agent.mjs
new file mode 100644
index 000000000..f110dd71d
--- /dev/null
+++ b/packages/provider-bridge-acp/src/bridge/settlement-repro-agent.mjs
@@ -0,0 +1,37 @@
+import { existsSync, writeFileSync } from "node:fs";
+import { createInterface } from "node:readline";
+
+const send = (message) => process.stdout.write(`${JSON.stringify(message)}\n`);
+const update = (content) => send({
+ jsonrpc: "2.0",
+ method: "session/update",
+ params: { sessionId: "settlement-session", update: content },
+});
+const reply = (id, result) => send({ jsonrpc: "2.0", id, result });
+
+createInterface({ input: process.stdin }).on("line", async (line) => {
+ const request = JSON.parse(line);
+ if (request.method === "initialize") {
+ reply(request.id, { protocolVersion: 1, agentCapabilities: {} });
+ } else if (request.method === "session/new") {
+ reply(request.id, { sessionId: "settlement-session" });
+ } else if (request.method === "session/prompt") {
+ if (process.env.SETTLEMENT_SCENARIO === "capacity") {
+ for (const text of ["UNAVAILABLE: ", "temporary resource exhaustion (503)."] ) {
+ update({ sessionUpdate: "agent_message_chunk", content: { type: "text", text } });
+ }
+ reply(request.id, { stopReason: "end_turn" });
+ } else {
+ update({ sessionUpdate: "tool_call", toolCallId: "operation-1", title: "Local operation", kind: "execute", status: "in_progress", rawInput: { command: "echo operation-result" } });
+ reply(request.id, { stopReason: "end_turn" });
+ writeFileSync(process.env.SETTLEMENT_READY, "ready");
+ while (!existsSync(process.env.SETTLEMENT_RELEASE)) {
+ await new Promise((resolveTick) => setTimeout(resolveTick, 10));
+ }
+ update({ sessionUpdate: "tool_call_update", toolCallId: "operation-1", status: "completed", rawOutput: { exitCode: 0, stdout: "operation-result" } });
+ writeFileSync(process.env.SETTLEMENT_DONE, "done");
+ }
+ } else if (request.id !== undefined) {
+ reply(request.id, {});
+ }
+});
Investigation command inventory
git clone --single-branch --branch main https://github.com/get-bb/bb.git <base or verify> git fetch origin main git rev-parse origin/main git status --short pnpm install --frozen-lockfile --prefer-offline pnpm exec turbo run build pnpm exec turbo run build:types --filter=@get-bb/plugin-sdk pnpm exec turbo run test --filter=@bb/provider-bridge-acp -- src/bridge/bridge.test.ts -t 'settlement repro' pnpm exec turbo run test --filter=@bb/provider-bridge-acp --force -- src/bridge/bridge.test.ts -t 'settlement repro' pnpm exec turbo run test --filter=@bb/provider-bridge-acp -- src/bridge/bridge.test.ts -t 'starts a session and runs a prompt turn end to end|launches full-mode ACP agents with configured permission CLI args' git diff --check git diff --numstat origin/main gh issue view 7980 --repo get-bb/bb --json title,body,comments gh pr view 7981 --repo get-bb/bb --json number,state,mergedAt,title,body gh pr diff 7981 --repo get-bb/bb gh pr list --repo get-bb/bb --state open --search 7980 --json number gh issue view 7102 --repo get-bb/bb --json number,title,state gh issue view 2461 --repo get-bb/bb --json number,title,state
Additional read-only GraphQL queries inspected issue properties, allowed options, labels, and cross-reference metadata. All GitHub classification writes used the caller-supplied SlopCop command. No live app was started; test child processes and temporary workspaces were cleaned up by the repository's existing test helpers.