buzz icon indicating copy to clipboard operation
buzz copied to clipboard

buzz-acp advertises `protocolVersion: 2` but implements v1 semantics — every v2-capable ACP adapter fails (initialize -32602, then missing stopReason)

Open ashneil12 opened this issue 3 months ago • 6 comments

Summary

buzz-acp hardcodes "protocolVersion": 2 in its initialize request but implements ACP v1 semantics throughout. Any adapter that actually supports v2 therefore negotiates v2, behaves correctly for v2, and breaks Buzz — twice, at two different layers.

This blocks the path recommended in #2393, where the generic answer to "please support runtime X" is that any ACP-over-stdio binary can be registered from Settings. That is true only for v1-only adapters. A v2-capable adapter cannot be registered today.

Found while wiring Google Antigravity CLI (agy) via the third-party adapter agy-acp as a Custom harness, which is precisely the flow #2393 was closed in favour of.

Symptom 1: initialize fails with -32602

INFO  buzz_acp: buzz-acp starting: agent_cmd=/Users/ash/.local/bin/agy-acp ... agents=10
ERROR buzz_acp: agent initialize failed: Agent reported error (code -32602): Invalid params agent=0
... identical for agents 1-9 ...
Error: all 10 agents failed to start — cannot continue

build_initialize_params() (crates/buzz-acp/src/acp.rs:126) sends protocolVersion: 2 with a v1-shaped body: clientCapabilities and clientInfo, and no info. Draft ACP v2 renames clientInfo to info and makes it required, so a v2 router validates against the v2 schema and rejects the handshake.

Repro

npm i -g [email protected]
printf '%s\n' '{"jsonrpc":"2.0","id":0,"method":"initialize","params":{"protocolVersion":2,"clientCapabilities":{"auth":{"terminal":true},"_meta":{"goose":{"customNotifications":true},"terminal-auth":true}},"clientInfo":{"name":"buzz-acp","version":"0.1.0"}}}' | agy-acp

Actual:

{"jsonrpc":"2.0","id":0,"error":{"code":-32602,"message":"Invalid params","data":"invalid initialize params: [{\"expected\":\"object\",\"code\":\"invalid_type\",\"path\":[\"info\"],\"message\":\"Invalid input: expected object, received undefined\"}]"}}

Isolated across 15 payload variants: clientCapabilities, _meta, auth and the presence of clientInfo are all irrelevant, and the schema tolerates unknown keys. It is strict only about info. Rejecting schema is @agentclientprotocol/[email protected], dist/v2/schema/zod.gen.js:2488 (info: zImplementation, no .optional()), thrown from dist/protocol-router.js:399.

Symptom 2: adding info moves the failure one layer down

Injecting params.info makes the handshake succeed with result.protocolVersion == 2. The pool starts, the agent joins the channel and reports commands available. The first prompt then fails:

Turn error · error: Protocol error: session/prompt response missing stopReason

This is not a second bug. It is the same one surfacing where it actually matters. From agy-acp's own source (dist/acp/agent.js:261-268):

v1 prompt lifecycle: response carries stopReason after the full turn. v2: progress and stopReason arrive as state_update notifications.

Under v2 the prompt response has no stopReason by design. buzz-acp waits for it in the response, which is v1 behaviour. So Buzz asks for v2, gets v2, and cannot consume it.

Why it works with the bundled adapters

claude-agent-acp is v1-only. It parses {"protocolVersion": 2} fine, clamps its reply to "protocolVersion": 1, and buzz-acp accepts the downgrade. The tolerant v1 schema is the only one that ever runs, so the mismatch stays invisible. Same for codex-acp. It surfaces the moment an adapter is capable of honouring the version Buzz asked for.

Impact

Every pool slot fails identically before any prompt, so the run aborts. No v2-capable ACP adapter can be used with Buzz today, and the failure is opaque: -32602 Invalid params with no indication that a protocol version is involved.

Suggested fix

Either:

  1. Send info: {name, version} alongside clientInfo in the initialize params (v1 agents ignore unknown keys, so one body serves both) and implement the v2 prompt lifecycle, consuming stopReason from state_update notifications; or
  2. Revert the pin at acp.rs:126 to "protocolVersion": 1 until the v2 body and lifecycle are implemented.

(2) is the smaller change and restores correctness immediately. The comment at that line notes Buzz is squatting on ACP v2 ahead of the upstream RFD; the problem is that adapters take the advertised version at face value.

Secondary: the error is undiagnosable from the logs

agent_error_from_json (crates/buzz-acp/src/acp.rs:115) surfaces only error.message. The v2 SDK puts the zod detail in error.data and leaves message as the bare string "Invalid params", so operators see a detail-free error ten times over. Logging error.data on initialize failure would have made this self-diagnosing in seconds. Related: #4069 notes the same error.data loss for a different error, and #3338 covers the misleading "all N agents failed to start" wording.

Workaround

A stdio shim that clamps the initialize request to v1 before forwarding, leaving everything else verbatim. Verified working end to end with [email protected]:

#!/usr/bin/env node
const { spawn } = require("node:child_process");
const target = process.env.AGY_ACP_BIN; // real adapter entry
const child = spawn(process.execPath, [target, ...process.argv.slice(2)],
                    { stdio: ["pipe", "pipe", "inherit"], env: process.env });
child.stdout.pipe(process.stdout);
child.on("exit", (c, s) => process.exit(s ? 1 : (c ?? 0)));

let patched = false, buf = "";
const clamp = (line) => {
  if (patched || !line.includes('"initialize"')) return line;
  let m; try { m = JSON.parse(line); } catch { return line; }
  if (m.method !== "initialize" || !m.params) return line;
  patched = true;
  if (typeof m.params.protocolVersion === "number" && m.params.protocolVersion > 1) {
    m.params.protocolVersion = 1;
    return JSON.stringify(m);
  }
  return line;
};
process.stdin.on("data", (c) => {
  buf += c.toString("utf8");
  let i;
  while ((i = buf.indexOf("\n")) !== -1) {
    const line = buf.slice(0, i); buf = buf.slice(i + 1);
    child.stdin.write((line.trim() ? clamp(line) : line) + "\n");
  }
});
process.stdin.on("end", () => { if (buf.length) child.stdin.write(buf); child.stdin.end(); });

Register that as the Custom harness Command instead of the adapter itself.

Versions

  • Buzz Desktop v0.5.4, buzz-acp 0.1.0
  • agy-acp 0.4.3, @agentclientprotocol/sdk 1.3.0
  • Google Antigravity CLI (agy), macOS 15 (Darwin 25.5.0), node 22.23.1
  • Relay: managed *.communities.buzz.xyz

ashneil12 avatar Aug 04 '26 14:08 ashneil12

Two more symptoms from the same root cause, both observed on Buzz Desktop v0.5.4 with [email protected].

buzz-acp cannot read the agent's name from a v2 response

When the handshake lands on v2, every slot logs:

INFO buzz_acp: agent initialized agent=0 name="unknown" steering_supported=false

With the handshake clamped to v1, the same adapter logs:

INFO buzz_acp: agent initialized agent=0 name="agy-acp" steering_supported=false

buzz-acp reads agentInfo, which is the v1 field name; v2 returns the same content under info. So Buzz cannot parse a v2 initialize result either, not just produce a v2 request. name="unknown" in a harness log is a reliable tell that version negotiation has gone wrong.

The pool heals one slot at a time, so a fix looks like it did not work

session/prompt failures respawn a single slot, and circuit open — not respawning stops even that after three attempts. After changing the adapter, 8 of 10 pool members were still the old processes:

14:32:14  ×10  protocolVersion: 2   <- pool start
14:33:01  ×1   protocolVersion: 2   <- respawn, agent=0
14:33:52       ERROR circuit open — not respawning agent=0
14:34:28  ×1   protocolVersion: 1   <- respawn, agent=1, after the fix
14:39:04  ×1   protocolVersion: 1   <- slot refill, agent=0

Turns routed to the two repaired slots succeeded and everything else kept failing, which reads as an intermittent bug rather than a stale pool. A full stop and start is required. Worth considering whether a respawn should re-read harness config, or whether the mixed-version state should be detected and the pool recycled.

Misleading operator-facing error

The Buzz UI reports a harness internal error as:

The agent's harness reported an internal error. For Codex agents this can mean the configured model isn't supported by your installed codex-acp — check the model in ~/.codex/config.toml or upgrade the adapter (brew upgrade codex-acp).

That Codex-specific advice is shown regardless of the configured harness. On a custom harness it points at a file and a package that are not involved, which cost real debugging time here. Related to the error.data loss noted above and in #4069: the underlying JSON-RPC error carried the detail, and none of it reached the operator.

ashneil12 avatar Aug 04 '26 14:08 ashneil12

This now also breaks @agentclientprotocol/claude-agent-acp from 0.99.1 on, the default Claude adapter, so it's no longer limited to third-party adapters.

Versions: buzz main @ acf56fff6 (2026-10-31), Linux x86_64. claude-agent-acp 0.81.2 works; 0.99.1 fails.

Symptom: after updating the adapter, every agent slot fails at startup and mentions go unanswered:

ERROR buzz_acp: agent initialize failed: Agent reported error (code -32602): Invalid params agent=0

The adapter's error data:

invalid initialize params: [{"expected":"object","code":"invalid_type","path":["info"],
  "message":"Invalid input: expected object, received undefined"}]

Why: build_initialize_params() still sends protocolVersion: 2 with the v1-shaped body (clientCapabilities, clientInfo). In the v2 schema (schema/v2/schema.json, InitializeRequest), info is required and the fields are info / capabilities (see the v2 RFD: "replacing the v1-style clientInfo and agentInfo fields"). claude-agent-acp ≤0.81.x is v1-only and answers a v2 request with protocolVersion: 1, which hid the bug. 0.99.1 implements v2 and validates the request.

Minimal repro: send buzz-acp's exact initialize to each version:

{"jsonrpc":"2.0","id":0,"method":"initialize","params":{"protocolVersion":2,
  "clientCapabilities":{"auth":{"terminal":true},"_meta":{"terminal-auth":true}},
  "clientInfo":{"name":"buzz-acp","version":"0.1.0"}}}
0.81.2 0.99.1
the request above (v2 + clientInfo) ok, negotiates protocolVersion: 1 -32602, info required
same body with protocolVersion: 1 ok ok

Workaround: pin @agentclientprotocol/[email protected].

Suggested fix: either send protocolVersion: 1 until buzz-acp implements v2 (smallest change, works with both), or build the body by version: v2 sends info + capabilities and reads info / stopReason per the v2 schema, as described in the original report.

00al avatar Nov 01 '26 12:11 00al

Confirming on a packaged release: Buzz Desktop 0.5.28 on Windows 11, with @agentclientprotocol/claude-agent-acp 0.100.0 (latest today). Every Claude-backed agent fails at start, three slots in a row, then all 3 agents failed to start — cannot continue:

ERROR buzz_acp: agent initialize failed: Agent reported error (code -32602): Invalid params agent=0

Sending 0.100.0 an initialize with protocolVersion: 2 and a v1-shaped body returns the same missing-info error described above. protocolVersion: 1 is accepted. Rolling the adapter back to 0.81.2 restores both.

For Desktop users, the trigger is invisible. The adapter is a global npm package that Buzz neither pins nor version-checks, so a routine npm install -g @agentclientprotocol/claude-agent-acp@latest silently takes every Claude agent offline, and the Desktop shows only "harness exited with status exit code: 1". Until the handshake is fixed, pinning or warning on adapter versions ≥ 0.99.1 would prevent that.

uevuleocha avatar Nov 02 '26 21:11 uevuleocha

Confirming on Buzz Desktop 0.5.28 (macOS 27), with the exact boundary: I sent buzz-acp's real initialize frame to each claude-agent-acp release. 0.94.0 negotiates down to protocol 1. Every release from 0.95.0 through 0.100.0 answers -32602 (info required), so 0.95.0 is the first failing version, not 0.97.0 or 0.99.1.

Workaround for anyone needing a current adapter until #8621 lands: a small stdio wrapper that rewrites protocolVersion from 2 to 1 in the first initialize frame and passes everything else through. On 0.100.0 this has handled live turns with tool calls over a real relay; steering and session/cancel also passed in a scripted session. The wrapper must be named claude-agent-acp, because buzz-acp chooses its Claude adapter behaviour from the command basename.

Johnyryal avatar Nov 04 '26 12:11 Johnyryal

Hi, I'm interested in working on this issue.

Is anyone currently working on a fix? If not, I'd be happy to investigate the problem and submit a PR.

Please let me know if there's a preferred approach to fixing the ACP version compatibility issue. Thanks!

conan0220 avatar Nov 05 '26 17:11 conan0220

re "Why it works with the bundled adapters [..] claude-agent-acp is v1-only. It parses {"protocolVersion": 2} fine, clamps its reply to "protocolVersion": 1, and buzz-acp accepts the downgrade. The tolerant v1 schema is the only one that ever runs, so the mismatch stays invisible. Same for codex-acp. It surfaces the moment an adapter is capable of honouring the version Buzz asked for."

Not any more, folks. This now breaks. Try CLAUDE_AGENT_ACP_PROTOCOL=v1

-- Confirmed on Buzz (Linux .deb, Debian 13 base) and Windows 11 with claude-agent-acp . Workaround: set CLAUDE_AGENT_ACP_PROTOCOL=v1 in the agent's env vars — initialize then succeeds and the agent replies normally. Root cause appears to be build_initialize_params() in buzz-acp/src/acp.rs sending protocolVersion 2 with v1 field names (clientCapabilities/clientInfo).

nonakrfitcc avatar Nov 18 '26 22:11 nonakrfitcc