buzz icon indicating copy to clipboard operation
buzz copied to clipboard

Provider protocol: `launch.command` is the inner ACP agent, not the process to exec — a conformant provider can ship silently inert agents

Open jimparkins opened this issue 3 months ago • 1 comments

Summary

Writing a third-party buzz-backend-* provider, I shipped a deploy that Buzz reported as fully successful — backend_agent_id returned, last_error: null, worktree created, process alive — and which produced a completely inert agent. Nothing was connected to the relay.

The cause: I exec'd launch.command as the process to run. It is actually the ACP agent that runs under buzz-acp; the harness is what authenticates to the relay, listens for mentions, and drives the agent over stdio. A provider is responsible for running the harness and passing the inner agent through BUZZ_ACP_AGENT_COMMAND / BUZZ_ACP_AGENT_ARGS.

That is a reasonable contract. The problem is that nothing states it, and nothing can catch getting it wrong.

Why the docs didn't prevent it

docs/remote-agents.md §Launch data describes the field as:

"launch": {
  "command":      str,          // command NAME (e.g. "goose"), never a host path
  "args":         [str],        // normalized args, definition fallback applied

Read on its own, command + args reads unambiguously as the thing to execute. The spec does say elsewhere that agent_command/agent_args are "the ACP agent under the harness", but the deploy contract never states that the provider must supply the harness, and §Launch data — the section a provider author works from — doesn't mention buzz-acp at all.

Why no test catches it

Every deploy-*.request.json fixture in crates/buzz-backend-kubernetes/tests/fixtures/provider-wire/ carries no launch command at all — deploy-no-owner, deploy-relay-mesh, deploy-relay-mesh-padded, deploy-tag-image have neither launch nor agent_command. That is correct for the Kubernetes binding, whose container image ENTRYPOINT is the harness (§K8s Entrypoint). deploy-full-launch does carry launch, but is only asserted structurally.

So a provider can pass the entire golden-fixture suite, satisfy [L2] conformance as written, and still deploy agents that never connect. The layer the bug lives in is the one the fixtures cannot reach.

Symptoms, so others can recognise it

Two runtimes, two different signatures, one cause:

  • goose — goose acp blocks on stdin, so the process lingers. ps shows a healthy agent, the worktree/pod looks fine, and it never responds to anything.
  • buzz-agent — exits immediately with nothing driving it, so its terminal disappears and it looks like a crash with no error.

In both cases Buzz's own view is a successful deploy: backend_agent_id set, last_error: null. There is no failure to surface, because from the provider protocol's perspective nothing failed.

Suggested fixes

Any one of these would have prevented it, roughly in order of preference:

  1. Have launch carry the resolved harness invocation — e.g. a harness_command field, or make command/args the full command to exec with the inner agent already expressed in env. Then providers cannot get it wrong, which is consistent with the stated rationale for the launch block ("A provider MUST NOT reimplement that derivation").
  2. State it in §Launch data: the provider runs the harness; launch.command and launch.args go to BUZZ_ACP_AGENT_COMMAND / BUZZ_ACP_AGENT_ARGS (comma-delimited).
  3. Add a fixture whose expected behaviour exercises the harness layer, so [L2] conformance means something here.

Context

Found while building an out-of-tree provider that runs Buzz agents in Orca worktrees. Happy to send a docs PR for (2) if that is useful.

Verified against main at 07a3c76.

jimparkins avatar Aug 11 '26 05:08 jimparkins

Following up on my own suggestion (3) — "add a fixture" — because having gone back through tests/fixtures/provider-wire/, I don't think a fixture can catch this, and I want to be precise about why before anyone spends effort there. There is also a correction to make to the issue body.

All references verified against main at be48ce98bd163899197b79a82ad5b2bcf0bc9b54.

Correction: the mapping is stated, in the one place a non-Kubernetes provider won't look

I wrote that "nothing states it". That is too strong, and the fixture README's own standard for evidence deserves better. The normative mapping exists:

| launch.command | BUZZ_ACP_AGENT_COMMAND — the name, resolved against the image's own PATH; never a forwarded host path | | launch.args | BUZZ_ACP_AGENT_ARGS, comma-joined |

— docs/remote-agents.md:1088-1090

What is true, and is the real defect, is where it lives. Those lines are in ### Entrypoint and launch ABI {#k8s-entrypoint} (:1051), which is inside ## The Kubernetes Binding (:991). So:

  • The substrate-neutral ### Launch data section (:467-640) — the section a provider author works from — reaches it only via a parenthetical at :556 that is about a different rule (don't remap tier-1 keys after launch.env).
  • [L2] item 3 (:1462-1467), the enumeration of what a provider must apply mechanically, lists three-tier precedence, host-resolved re-derivation, no re-merge of legacy env_vars, no provider-side model/provider mapping, and the two refusals. It does not include "exec the harness, not launch.command".
  • So a conforming provider on a non-Kubernetes substrate can satisfy every L2 term it is given, and the obligation it missed is filed under a heading naming a substrate it does not use.

That is a smaller and more fixable claim than the one in the issue body, and suggestion (2) still stands: promote the mapping into §Launch data or into [L2] item 3, where it binds every provider.

The fixture suite is a serialization contract, so it cannot reach this

The suite's own README states its rules, and two of them are exactly why:

Requests are recorded, not invented. … deploy-full-launch.request.json is the output of the desktop's real build_launch_block → deploy_payload_json path …

The provider cannot police this file, so the desktop must. … The enforcement is the desktop's whole-object equality test, which builds the payload and compares it to this file.

So the two ends asserted are build_launch_block (desktop/src-tauri/src/commands/agents_tests.rs:436, deploy_payload_matches_the_shared_full_launch_fixture) and the provider's Request deserializer (crates/buzz-backend-kubernetes/tests/wire_fixtures.rs:194). Both can be byte-perfect while the provider execs the wrong binary — what the provider does with a correctly-parsed launch block is downstream of every assertion in the suite.

The one test that touches the full launch block makes this concrete. the_full_desktop_payload_is_accepted (wire_fixtures.rs:132-143) asserts that the error string contains "kubeconfig" — i.e. that parsing succeeded and execution reached the cluster. A provider that parsed launch correctly and then exec'd launch.command passes it unchanged.

Two smaller things I got slightly wrong or under-stated in the body, for the record:

  • deploy-full-launch.request.json has no .response.json at all — the other four deploy-* fixtures do. So it is not merely "asserted structurally"; there is no recorded output for it to be compared against.
  • The four command-less fixtures are deploy-no-owner, deploy-relay-mesh, deploy-relay-mesh-padded, deploy-tag-image — confirmed, none carries launch or agent_command. And they are command-less for a correct reason: each exists to pin a refusal, and a refusal fires before launch data matters. Adding launch to them would weaken them.

To be explicit about what I am not claiming: the Kubernetes provider does not have this bug. Its entrypoint is the harness, under an exec, and the spec is emphatic about it (:1056-1066). The claim is only that its fixture suite cannot tell it apart from one that does.

What would catch it

A behavioural case, not a wire fixture. The spec already anticipates the mechanism (:1516): "Conformance is testable without mechanization: a fake-provider harness can exercise L2 items 1–3 and 5 over the wire contract." This is an L2 item-3 obligation once it is promoted there, so it belongs in the same harness.

Concretely — feed the existing deploy-full-launch.request.json, which already carries "command": "goose" and "args": ["acp"], to a provider running against a substrate stub that records the argv and environment of whatever process it starts, then assert:

  1. argv[0] resolves to the harness (buzz-acp / sprig), not goose;
  2. BUZZ_ACP_AGENT_COMMAND == "goose";
  3. BUZZ_ACP_AGENT_ARGS == "acp" — comma-joined per the mapping table, which also pins the delimiter a provider would otherwise have to guess (this bit us: BUZZ_ACP_AGENT_ARGS is comma-delimited, crates/buzz-acp/src/config.rs:197);
  4. the negative: an implementation that execs launch.command directly fails this case.

(4) is the point of the exercise. Without it the case risks becoming another the_full_desktop_payload_is_accepted — green against both the correct and the broken implementation.

A cheap partial that needs no substrate stub, if the above is too much machinery for now: because the Kubernetes binding materializes this mapping into the per-agent Secret, a deploy-full-launch.response.json capturing the rendered Secret/pod env — nsec redacted — would pin BUZZ_ACP_AGENT_COMMAND=goose and BUZZ_ACP_AGENT_ARGS=acp as data in the shared arbiter file. That would not catch a provider that ignores the mapping, but it would make the mapping visible to every provider author who reads the fixtures to learn the contract — which is how I would have learned it.

Either way it is worth deciding before PR #3449 lands. It adds a second reference provider (buzz-backend-ssh) on a substrate with no container image to carry an ENTRYPOINT, so the launch-ABI layer stops being something one binding gets for free from its packaging — and it is the first point at which the fixture suite's blind spot covers a shipped provider rather than only out-of-tree ones.

jimparkins avatar Aug 11 '26 14:08 jimparkins