feat: remote agents over SSH — provider contract, buzz-backend-ssh, and where-runs-first
Summary
- Specify the
BackendKind::Providerwire contract thatmanaged_agents/backend.rsalready describes, and shipbuzz-backend-sshas its reference implementation - Move "where does this agent run" to the top of the create dialog, and make the harness list, the model list, and the credential contract read from that answer instead of assuming this computer
- Add a read-only Remote servers section under Settings > Agents, with a typed
recoverychannel so a host failure the user can fix renders a button - Add a
provision-buzz-host.shpreflight and Windows CI coverage for the provider crate
Fixes #3034.
Why
managed_agents/backend.rs has described BackendKind::Provider for a while: the desktop finds a buzz-backend-<id> executable on PATH, writes one JSON request to its stdin, reads one JSON response from its stdout. #2859 states the gap plainly — that path "has no OSS implementation," so the seam exists and nothing exercises it. #3034 is the user-facing shape of the same gap.
Two things follow from filling it. The first is a provider: crates/buzz-backend-ssh implements the five ops over SSH, one process per op, no daemon and no state. The second is that the desktop has to stop answering questions about a remote record out of this computer's catalog — the harness list, the model catalog, the credential contract, and the avatar precedence chain all change meaning once the host can be somewhere else. That is the bulk of the desktop diff, and it is why the create dialog's question order changes: every question below "where" is scoped by the answer to it, so asking last means answering the dependent questions against the wrong machine.
The contract is specified in docs/remote-agents.md and lands in the first commit, ahead of the code, so the design can be judged before a line of Rust.
Reading order
154 files, +18,069/−1,413 — 12,453 lines of production code, 4,686 of tests, 930 of markdown. 12 commits, each of which compiles and passes its tests standalone; review in order.
d307c1d1ddocs(remote-agents): specify the SSH provider contract — the five ops (info,check,discover_harnesses,probe_models,deploy), their schemas, the optionalrecoverykey, the systemd unit and env-file contract, and the security invariants the implementation is required to hold. Everything after this is an implementation of this file.1b14b6e2cfeat(backend-ssh): add the SSH remote-agent provider crate — the reference implementation. Six modules, one protocol:protocol(wire types, theSecretthat renders[REDACTED]),ssh(transport),tailscale(peer enumeration, re-auth URL),discover,install,deploy. One commit because they are one protocol implementation and do not separate —deployreaches intoinstallat 43 call sites, anddiscover/deployare mutually dependent. 115 tests.204ecf55bfeat(desktop): discover and invoke backend providers on PATH — splitsbackend.rsinto what a provider may make the desktop do (provider_recovery.rs) and which files on PATH are providers at all (provider_discovery.rs).invoke_providerreturnsProviderFailure, notString; there is deliberately noFrom<ProviderFailure> for String, because flattening the recovery away is the bug the type exists to prevent.489c1a59dfeat(desktop): build a remote deploy payload from a provider record — every value the desktop derives from its own machine is wrong for a remote agent. Addsdiscover_harnessesandprobe_models, and normalizes remote models through the samenormalize_agent_modelsthe local path uses so the picker needs no remote-specific rendering.c8ec0df04feat(desktop): scope persona runtime sync to local records — the one behavioral change to existing desktop code in this series. A persona sync used to clear a provider-backed record's harness pin, because the local "is this a known runtime?" test cannot answer a question about another machine's filesystem.cf22ca946feat(desktop): type and bind the backend-provider Tauri surface — the TypeScript half. Remote vocabulary gets its ownbackendProviderTypes.tsandtauriBackendProviders.tsrather than being added to the local-runtime modules next door;types.tsre-exports so existing importers are unaffected.9ec77b7b6feat(desktop): ask where an agent runs before anything else — grows yourWhereToRunSection(126 lines) andwhereToRunIntent(46) along the seam they already left: the section keeps owning "where", and every field the answer scopes now reads from it. "Where to run" moves to the top of the form;createRuntimeGate,useRemoteAwareModelDiscovery, andcreateGateHarnessIdmake the rest a function of it.dd04b629dfeat(desktop): one agent per exclusive host identity — anexclusivecatalog entry may back at most one agent, because it names a persistent identity on the host rather than an ephemeral runner.pinnedHarnessis the single owner of "may this surface read the record instead of the local catalog?"; liveness comes from relay presence, not the write-oncedeployedflag.e8552f932feat(settings): permanent Remote servers section under Settings > Agents — read-only by design and with no host list: a provider is a binary on PATH, so adding one is an install, and the host is a per-agent decision the create dialog pins onto the record. This is the frontend end ofrecovery: {action: "open_url"}; the message always stands alone and the recovery only ever adds a button.b0a0cb231ci(windows): run buzz-backend-ssh's tests on Windows — the crate's Windows-specific surface is path resolution (tailscale.execandidates,ssh.exelookup), which no Linux or macOS runner exercises. Goes in the existingwindows-rustjob, which already triggers oncrates/**.5cfd9924ftest(desktop): cover provider-backed edit routing and the empty remote gallery — two Playwright pins for claims about which component mounts. The routing spec asserts both the positive and the negative, because the bug it pins was a silently wrong surface rather than an error.2a495cc18feat(scripts): add a remote-host provisioning preflight — two items in the host contract fail in ways that do not look like misconfiguration (missingloginctl enable-lingerpresents as "the agent keeps dying"), so the preflight checks and names them.
Security invariants
- Secrets travel on the SSH stdin channel only — never an argv, a log line, an error string, or a
Debugrendering. The remotepsis world-readable. - A deploy without the desktop-minted
private_key_nsecfails closed, insideAgent::from_request, so no caller can route around it. Env values pass a control-character guard, because a newline would split the assignment into a second attacker-chosen line. - Tailscale is an enhancement, never a dependency: absent, logged out, or empty, the
infoschema is byte-identical to the plain one. Trust-on-first-use is confined to addresses the local Tailscale daemon already lists as peers; for anything the user typed, host-key checking stays strict. The re-auth URL is constructed, never parsed out of host output. - Provider execution on Windows goes through an exec allowlist.
- Harness profile names are untrusted input on their way into a catalog id and then an argument vector, so they are filtered against Hermes's own charset and capped twice — once in the script so the bytes are never sent, and once on the way back in, because a host is free to ignore the script it was handed.
- The provider crate is deliberately not bundled with the desktop app. Discovery prepends the app bundle's own directory to the search path, so shipping it inside the bundle would give every install an auto-discovered SSH-deploy capability and undermine the "Only use providers from trusted sources" warning the desktop already shows. It installs to
~/.local/bin, which discovery already covers.
Verification
cargo test -p buzz-backend-ssh— 115 passedcargo test --manifest-path desktop/src-tauri/Cargo.toml— 1,890 passed- Desktop unit suite — 4,042 passed;
tsctypecheck and Biome clean pnpm test:e2e:smokefor the two new specsshellcheckonscripts/provision-buzz-host.sh- File-size ratchet (#3352) clean against the base tree
- Every commit compiles and passes its own tests standalone (12/12), and every commit carries a
Signed-off-by - No
unsafe; no newunwrap/expecton a production path
Relationship to open work
- Fixes #3034.
- #2859 — the design issue that concedes the provider path has no OSS implementation. This is that reference implementation, following the
buzz-backend-<id>convention the desktop already looks for and the precedent set by #2538 (Crabbox). - #3185–#3188 (buzz-spawner) — complementary, not overlapping. That stack spawns agents; this one answers where they live and how a host is described to the desktop.
- #3220 — the
draftRefspread inWhereToRunSection.tsx:159keeps the section's draft authoritative across the remount, so a rapid edit cannot be clobbered by an in-flight probe. That is a stronger fix than the one proposed on the issue, but it is cited rather than absorbed: close #3220 or land both, your call. - #3310 (open) — this branch contains the
ExecNamingseam #3310 introduces, held verbatim so the split is preserved. Whichever lands second is a trivial rebase. - Harness discovery builds on the existing
hermespreset rather than replacing it: because a host commonly runs several Hermes profiles out of one install,discover_harnessesfans that single preset out intohermes-<name>entries carrying--profileargs, so each configuration appears as its own harness.
Follow-ups
- Protocol v1 has no undeploy op. Deleting a persona cascade-deletes its instances, but a provider-backed instance is a deployed unit this app can forget and not stop — so the cascade discloses the running remote units and refuses without an explicit
force_remote_deleteopt-in, rather than silently orphaning them. - Removing a provider-backed persona from a team still refuses silently. That is pre-existing behavior on the team path, unchanged here, and worth a separate fix.
One additional project-workspace parity point: local managed agents receive Desktop's REPOS workspace, while this provider starts the unit without a WorkingDirectory and only configures Buzz Git auth if git-credential-nostr already happens to be installed on the host. The provider does not install that helper or hydrate a project checkout. In the VPS pilot the helper is installed and works, but every long-running agent is currently operating in a separately provisioned GitHub checkout; none receives the Desktop/Buzz-native project workspace automatically.
At minimum, provision-buzz-host.sh/readiness should report git-credential-nostr separately from the non-fatal buzz CLI check and docs/remote-agents.md should list the missing REPOS/working-directory projection as a known limitation. A later protocol field can model a workspace without making the provider guess which project to clone.
Thanks for the review. All three items are addressed, and the three Codex findings are answered inline.
NoNewPrivileges: added to assets/[email protected] in 7bbb95dd3, with an asset assertion pinning the directive in the unit template and in the rendered script. Kept to exactly that delta. ProtectSystem/ProtectHome belong here too eventually, but an agent has no modeled workspace yet, so those directives would be guessing at which paths it legitimately writes. The commit says so rather than half-applying them.
Team instructions: 071974d28 discloses the limitation on the provider-backed create/edit surface. Local spawn resolves a linked team's instructions into BUZZ_ACP_TEAM_INSTRUCTIONS; the deploy payload has no team field, so a remote record starts without its team's standing rules. The create flow states this as soon as "elsewhere" is chosen, and the edit dialog states it on any record where it is already true. One module owns the copy and the condition so the two surfaces can't drift. Carrying the resolved text is a protocol change and out of scope here, as you suggested.
Provisioning and docs: d45c25e72 gives git-credential-nostr its own preflight row in provision-buzz-host.sh, still reported and still non-fatal, rather than folding a distinct failure behind the buzz CLI's status. Deploy resolves the helper but never installs it, and writes the agent's GIT_CONFIG_* block only when the host already has it, so a missing helper surfaces no error until an agent tries to push. The same commit adds the missing REPOS/working-directory projection to Known limitations in docs/remote-agents.md: the unit has no WorkingDirectory, so a remote agent gets no Buzz-native project checkout, and closing that properly means a protocol field the desktop states rather than the provider guessing. 41b8a628d also documents the stale name-keyed unit a pre-rekey host leaves behind, since the pubkey-keyed slug lands beside it under Restart=always and there is no undeploy op.
Gates green on the new head: cargo fmt --check, clippy with -D warnings and tests for buzz-backend-ssh (118) and desktop/src-tauri (1892), plus desktop pnpm check, typecheck and test (4047).
Ran this branch today against a self-hosted relay: provider built from the branch on macOS (arm64), target host a Debian 12 KVM guest behind an ~/.ssh/config ProxyJump alias. It works end to end. deploy provisioned buzz-acp@codex-test-<pubkey12> under systemd --user, the lazy pool warmed on the first mention, codex-acp 1.1.7 came up with steering, and the agent answered an owner @mention in-channel. The env file matched the doc: PATH pinning, atomic write, and the GIT_CONFIG_* block once git-credential-nostr was on the host.
Three things we hit:
-
Harness resolution misses
~/.local/bin. The two-part rule (PATH or~/.local/bin) coversbuzz-acpand theclaudeCLI, but the harness probes and the harness pin are barecommand -v(PROBE_PREAMBLEin discover.rs,harness=$(command -v "$harness_name")in deploy.rs,check_harness()in provision-buzz-host.sh). Over non-interactive SSH on a stock Debian 12 host (PATH=/usr/local/bin:/usr/bin:/bin:/usr/games), adapters installed per the preflight's own hints land in~/.local/binand become invisible:discover_harnessesreported all 12 candidatesavailable: false, and deploy failed with{"error":"ssh failed (exit 91): harness codex-acp not found on the server's PATH","ok":false}. APATH="$HOME/.local/bin:$PATH"line at the top of the probe and deploy scripts, matching what the env file already does for the unit, would cover it. We worked around it by symlinking the adapters into/usr/local/bin. -
The preflight's mandatory PATH row can't pass over
ssh host 'sh provision-buzz-host.sh'— non-interactively it always lands in the NOTE case, so the script exits 1 on a fully provisioned host. Letting the ~/.profile case satisfy the check (deploy composes the unit's PATH itself), or noting the script needs a login shell, would fix it. -
Doc suggestion. Deploying without
auth_tagand withrespond_to=allowlistruns fine but logsrelay observer requested but no agent owner was resolved at startup; observer frames will not be published, so the pinnedBUZZ_ACP_RELAY_OBSERVER=truedoes nothing in that configuration. Since dropping NIP-OA identity is the current workaround for the cross-machine mention gate (#3277 / #2987), a sentence about this in remote-agents.md would help.
Minor: buzz_acp.version comes back empty since buzz-acp has no --version.
Happy to re-test as this moves. The StartLimitIntervalSec=0 rationale and the PATH-composition note in the doc both saved us time.
To use Codex here, create a Codex account and connect to github.
@Jud thanks for running it end to end. All three are fixed on the branch.
- Fixed in
e8a8e34fb. There is now one shared constant,install::PATH_PREAMBLE:
export PATH="${HOME:-}/.local/bin${PATH:+:$PATH}"
${HOME:-} because the discover script runs under set -u, and the ${PATH:+} guard so an unset PATH does not leave an empty element, which would mean cwd. It goes at the top of the discover probe, at the top of the buzz-acp --models script, into the deploy script ahead of the harness=$(command -v ...) pin, and into check_harness() in provision-buzz-host.sh. install::probe_script is deliberately untouched: it is a separate round trip with no preamble and already tests -x $HOME/.local/bin/<tool> directly, so it answers correctly standalone.
One simplification fell out of it. The env file's PATH line is now the deploy script's own $PATH written verbatim rather than "$HOME/.local/bin:$PATH", since that PATH already leads with the install destination. That is one prepend in one place instead of two that can drift.
Two tests run the real generated scripts through /bin/sh with the stock Debian PATH and an adapter only in ~/.local/bin, asserting the resolved absolute path lands in the probe record and in BUZZ_ACP_AGENT_COMMAND. Both fail with the preamble stubbed to "".
-
Fixed in
c4a0e16cf, the behavioral option. The script now captures the inherited PATH before prepending~/.local/binto its own, so section 3 still reports on the login PATH rather than one it just fixed up for itself. Both~/.profilearms report OK and carry the difference in the ACTION column, which is whether a re-login is still owed. The strict form was not load-bearing: nothing in the deploy path consults the login PATH, and both remote scripts now prepend the directory themselves. Exit semantics are otherwise unchanged, so an unsatisfied mandatory row still exits 1. It exits 0 on a provisioned host underenv -i HOME=... PATH=/usr/local/bin:/usr/bin:/bin:/usr/games. -
Added in
879f57da3, next to the env file section. It states that observer frames are encrypted to the owner's pubkey, thatbuzz-acpresolves an owner at startup fromBUZZ_AUTH_TAGor--agent-owner, and that with neither it logs the line you saw and publishes nothing. It calls out that a deploy with noauth_tagandrespond_to=allowlistis otherwise a working agent and only the telemetry is quietly absent, and points at #3277 / #2987 as the reason that configuration comes up. The same commit brings the doc'sPATHrow in step with how the value is now composed.
On buzz_acp.version coming back empty: that is buzz-acp having no --version. The acp crate is out of scope for this PR, so I will land that with the harness changes rather than here.
Branch is at 879f57da3 if you want another pass.
@Jud checking in on this one. Your three field-test findings are fixed on the branch (head 879f57da3), and the Codex and dschwartzAI rounds are addressed in the threads above. Is anything else blocking a review pass, or the workflow approval for the heavier CI jobs?
One tie-in since your test: the remote-agents spec in #3748 lists the Windows .exe discovery id pollution as Known Defect 1 and marks the fix as an open decision. That fix is already on this branch (285924daf strips the extension and dedupes on id), so this PR would close it.
Re-tested on the new head (879f57d), this time from a genuinely clean host. I
stopped and removed all three long-running units, deleted their env files, the
unit template, our drop-in, and (the part that matters for finding 1) the five
/usr/local/bin adapter symlinks we had been using as the workaround. Adapters
existed only in ~/.local/bin for the whole run. macOS arm64 desktop, Debian 12
KVM guest behind an ~/.ssh/config ProxyJump alias, self-hosted relay.
All three findings from the last round are fixed.
-
Harness resolution from
~/.local/bin, fixed on both halves.discover_harnessesreturns 4 of 13 available where it previously returned 0 of 12, each with a correct absolutebinaryPath(/home/agent/.local/bin/codex-acp, and so on). The deploy half, meaning theharness=$(command -v …)pin that producedexit 91last time, now writesBUZZ_ACP_AGENT_COMMAND="/home/agent/.local/bin/codex-acp"into the env file. Deploy succeeded first try and returned{"agent_id":"buzz-acp@bringup-4094cb17c050","ok":true}. -
Preflight over a non-login shell, fixed.
ssh host 'sh -s' < provision-buzz-host.shnow exits 0 on a provisioned host. The PATH row reports OK and carries the re-login note in the ACTION column instead of failing the run. -
Observer/owner doc, present and accurate.
Also confirmed on this pass: NoNewPrivileges=true in the rendered unit, the
quoted absolute ExecStart, env file at mode 600, the PATH line leading with
~/.local/bin, the pubkey-keyed unit slug, and the hermes --profile fan-out
with exclusive: true. check and probe_models both work over the ProxyJump
alias, and probe_models returned the host's real Claude catalog.
buzz_acp.version is still empty, as you said it would be.
Three new things, in the order I'd weight them.
1. A desktop test fails whenever the provider is actually installed
managed_agents::provider_discovery::tests::executable_extensions_are_not_part_of_a_provider_id
fails on any machine that has buzz-backend-ssh in ~/.local/bin, which is
where this PR's own docs say to install it, and where discovery is documented to
look.
panicked at src/managed_agents/provider_discovery.rs:208:54:
called `Result::unwrap_err()` on an `Ok` value: "/Users/jud/.local/bin/buzz-backend-ssh"
The cause is resolve_provider_binary(&id).unwrap_err(). The test assumes
resolution fails, which is only true on a machine with no provider installed.
Demonstrated by toggling just that one file:
### provider moved aside
test …executable_extensions_are_not_part_of_a_provider_id ... ok
### provider back in ~/.local/bin
test …executable_extensions_are_not_part_of_a_provider_id ... FAILED
CI stays green because CI has no provider installed, so this lands on exactly
the population that uses the feature, and it reads as a product bug on first
encounter. The assertion only needs the error when there is one, or a hermetic
search path. This is the test for 285924d, the commit you cite as closing
#3748's Known Defect 1.
2. The provider trusts a caller-supplied pubkey rather than deriving it
Agent::from_request requires a pubkey field and validates only its shape (64
hex chars). The crate has no secp256k1 dependency and never derives the key. The
unit name, env filename and returned agent_id are all keyed on that supplied
value.
That reopens the collision 449a5b9 set out to close, one level up. A payload
whose pubkey disagrees with its private_key_nsec produces a unit named for
identity A running as identity B, and two records sharing one nsec with
different pubkey values get two live units for one relay identity. Nothing in
the provider can detect either case. #3748 §Deploy State Machine Step 0 requires
derivation for this reason.
3. Restart=always has no terminal-failure arm
My test agent's key was not a member of the relay, so it failed auth
permanently. With Restart=always and StartLimitIntervalSec=0 it
restart-looped every 5s indefinitely, re-attempting a failure that can never
succeed and putting a failed-auth attempt on the relay each time. I stopped the
unit by hand.
I understand why the limiter is disabled, and the rationale in the unit comment
is right that a rate-limited agent looks identical to a dead one. But
Auth failed: restricted: not a relay member is terminal rather than transient,
and the harness already distinguishes it (terminal error in its own log line).
If the harness exited with a distinct code for terminal auth failure, the unit
could carry RestartPreventExitStatus= for it and stop cleanly instead of
looping. This may be a more common first-run experience than it looks, since a
fresh agent key has to be authorized on the relay before it can connect.
Not tested this round: the desktop UI path. I built the app from the branch (the
shipped v0.5.0 has no discover_harnesses/probe_models, so the desktop half
has never been exercised here) and verified the payload-construction claims by
reading, but the create-dialog flow still needs a human at the keyboard. Two
things I'd want to confirm there, both from reading: deploy_payload_json emits
no launch block, and the deploy path never checks protocol_version before
sending the nsec.
Building a second provider (buzz-backend-hetzner) against this contract — one that creates the machine before deploying to it — and hit one gap worth raising while the PR is open.
ssh.rs sets BatchMode=yes for every op and StrictHostKeyChecking=ask for any non-tailnet address, and the troubleshooting entry prescribes connecting once by hand to accept the key. For a host provisioned seconds ago there is no human at the keyboard and no prior address, so that remedy is unreachable for any caller that builds its own host — cloud VM, CI-created runner, Terraform box.
Suggestion, and deliberately not to relax the check: an optional ssh_known_hosts_file on SshConfig and the info schema, forwarded as -o UserKnownHostsFile=<path>; absent, behaviour is byte-identical to today. (Named to survive validate_provider_config's word split, like ssh_identity_file.) For a provisioning caller that is stronger than TOFU, not weaker: it can generate the host key, inject it through cloud-init and pin exactly that key, so the trust arrives over the cloud provider's authenticated API instead of over an unauthenticated first connection. Without it the only route left is appending to the user's own ~/.ssh/known_hosts.
@Jud thanks for re-running this from a genuinely clean host. Pulling the five
/usr/local/bin symlinks is what made finding 1 reproducible, and I would not
have found it from CI.
All three new findings are fixed on the branch. Head is 7b528f0f4.
- The desktop test that fails when the provider is installed,
8cacdfdc.
You were right that the assertion was wrong, not the resolver.
provider_discovery.rs now has a seam: search_path() produces the directory
list, candidates_in(dirs) and resolve_provider_binary_in(id, dirs) take that
list as an argument, and discover_provider_candidates /
resolve_provider_binary call search_path() so the shipped path is byte-for-byte
what it was. The tests resolve against a tempfile::tempdir() instead of the
host's $HOME.
I verified it the way you did rather than by reading: ran the suite under a
HOME containing .local/bin/buzz-backend-ssh, 7/7 pass, where the old
resolve_provider_binary(&id).unwrap_err() on line 208 panics. Two seam tests
went in (present-in-path resolves, absent does not; a non-executable file is not
a candidate) plus one that keeps discovery wired to the real search path, so the
seam cannot silently drift from production.
- Deriving the pubkey instead of trusting the payload,
0483c5ceb, with a follow-up in7b528f0f4.
Implemented as the spec states it, in a new buzz-backend-ssh/src/identity.rs.
derive_pubkey bech32-decodes private_key_nsec, requires the nsec hrp (an
npub in that field gets named as wrong-kind rather than "malformed"), takes the
secp256k1 x-only public key, and returns lowercase hex. reconcile makes the
derived value authoritative in every case: the payload's agent.pubkey is now an
assertion, and a well-formed pubkey that disagrees with the nsec is a fatal
in-band error rather than the name the unit gets. Agent::slug() and
agent_id() key on the derived value, so both halves of the collision you
describe are closed, the A-named/B-connecting unit and the two-units-one-nsec
case. Errors truncate both keys to a 12-character fragment, since the response is
persisted in the desktop's last_error.
Test coverage is 7 in identity:: (a fixed vector, whitespace, the malformed
set, npub rejection, reconcile match and case-insensitivity, reconcile mismatch,
and the fragment helper against multi-byte input) plus two rewritten and one new
in deploy::, whose fixtures now use real nsec/pubkey pairs instead of arbitrary
hex. The self-review commit removed an expect() I had left
in the length check, and corrected an overclaim in my own module doc:
secp256k1::SecretKey does not zeroize on drop, only opt-in
non_secure_erase, so the crate now calls it explicitly and the doc says
best-effort rather than guaranteed.
This is the same finding as item 5 on #3748, so that one is closed here too.
- Terminal auth failure gets its own exit code,
310b69453.
buzz_acp::EXIT_TERMINAL_AUTH_FAILURE = 78 (EX_CONFIG, chosen to stay clear of
the 90-95 range the deploy script already uses), and the unit template carries
RestartPreventExitStatus=78 with Restart=always otherwise unchanged. Your
case now stops once in failed state with the relay's own message in
systemctl --user status, instead of putting a failed-auth attempt on the relay
every five seconds.
The predicate is deliberately narrower than the harness's existing
is_terminal_connect_error: is_terminal_auth_rejection matches only
RelayError::AuthFailed with a non-error: NIP-01 prefix. A bad relay URL or a
TLS mismatch also stops the harness's retry loop, but those are misconfigurations
a redeploy fixes, so they keep restarting rather than stranding an agent that a
fix would revive. Only identity rejection stops the unit. Since the constant
lives in one crate and the unit asset in another, there is a const _ assert in
buzz-acp and a unit-template test in buzz-backend-ssh so the two cannot drift
apart.
Worth being precise about what this does not cover, since you raised the adjacent
point on #3748. It closes the restart loop for a relay that has refused the key;
it does not make the unit conform to the spec's rule that a supervisor never
restarts an intentional clean exit. An owner !shutdown still exits 0 and
systemd still brings it back five seconds later. That one needs the pinned
clean-exit contract (the spec's Known Defect 6) first, because until an
intentional exit carries a code of its own there is nothing for
RestartPreventExitStatus= to name.
buzz_acp.version is no longer empty (459ca100b). The root cause was smaller
than I expected: the SSH probe already runs <cmd> --version for every resolved
binary, buzz-acp just did not accept the flag. Adding version to its clap
#[command(...)] was about a line. buzz-acp --version now answers
buzz-acp 0.1.0 with no key in the environment, because clap short-circuits
--version before it enforces the required --private-key. The test pins that
ordering along with the single-line shape the probe reads, since the probe
invokes the binary with no environment and would otherwise collect a usage error
and record nothing.
On the two things you flagged from reading: the branch is merged with main
(21fc951f7, not rebased) and is mergeable again, and info now carries
"protocol_version": 1 as a JSON integer (30e75465f). The test asserts the
wire type as well as the value, since "1" as a string would fail the spec's
gate identically to absence. The desktop side of that gate is still #3748's Known
Defect 5, and I have not touched it here, so the provider now conforms to a gate
that does not yet run. Your other read is also still true: deploy_payload_json
emits no launch block.
Two doc changes came out of the merge. Our document is now
docs/remote-agents-ssh.md, retitled as the SSH binding of the spec, with
docs/remote-agents.md kept byte-identical to main. It has a new Lifetime
section that declares this binding supervised-persistent for the reasons you gave
on #3748, and nine stale cross-references were retargeted by subject
(6c205523c).
The create-dialog flow is still the untested half. If you get a human at the keyboard for it, that is the round I would most want a report from.
@FabianHertwig a second provider built against this contract is exactly what I was hoping the contract would get, and a create-the-machine-first one finds the gaps a deploy-to-an-existing-box one never will. You are right that the troubleshooting remedy assumes a human and a prior address, and neither exists for a host that is seconds old.
Implemented as you specified it, in 99674a01c. SshConfig gains
known_hosts_file, info's config_schema gains ssh_known_hosts_file, and
ssh.rs forwards it as -o UserKnownHostsFile=<path> in Session::new only
when it is Some. Absent, behavior is unchanged: one test covers both arms, and
the set arm is pinned by a set difference against the unset argv rather than by a
shape check, so the only thing the option can add is that one value. The name survives
validate_provider_config's word split (ssh_host_key_file would have been
dropped for key), and there is now an assertion pinning that so a future rename
cannot quietly break it. Doc has a config-table row plus a known_hosts
troubleshooting entry pointing at it.
Your framing is the reason I did not put it behind any relaxation of the check:
pinning a host key generated and injected through cloud-init is stronger than
TOFU, not weaker, because the trust arrives over the provider's authenticated
API. StrictHostKeyChecking stays where it was.
If anything else in the contract turns out awkward for a provider that creates its own host, please raise it while this is open. That shape was hypothetical when I wrote it, and you are the first real one.
Field report from a third independent provider implementation, plus one contract-level question from running this pattern against a hosted community.
The seam works. In late July we built buzz-backend-gce against the community v0 contract (IceRhymers/buzz-lakebox CONTRACT.md, 2026-07-24: info + deploy, one JSON object on stdin, one on stdout, exit 0 in every handled case). Single Python file on PATH, no daemon, create-the-machine-first flavor like the Hetzner provider discussed above: deploy starts the (pre-provisioned) VM, ships the desktop-supplied identity, prompt and env over SSH stdin, and starts a systemd unit running buzz-acp. Desktop discovery, payload delivery (13 env vars, ~5.9k-char prompt) and service start all behaved exactly as the contract describes. We will port it to the five-op contract in docs/remote-agents.md once this merges and can report back as a second created-machine-flavor data point.
Three findings from the field, smallest first:
- A Dock-launched desktop inherits launchd's minimal PATH, so a provider that shells out to its own cloud CLI must hunt install dirs itself (lakebox documents the same). Worth one line in the provider-authoring section of
docs/remote-agents.md. - For created-hosts: instance RUNNING is not sshd accepting connections. Our deploy op polls SSH readiness before shipping the payload; a fixed sleep failed intermittently. Related, for anyone delivering setup scripts to
bash -sover stdin rather than exec: the script must never runcatorread, which consume the remainder of the script itself and exit 0 silently. - The one that blocks users rather than authors: hosted communities refuse the deployed identity. The deploy payload ships the desktop-minted
private_key_nsecwith owner attestation, and on the hosted platform that identity class is refused from datacenter origins withrestricted: not a relay member, while a plain member identity from the same host serves fine. Details and the isolation matrix are in https://github.com/block/buzz/issues/2663 (including a correction of our own earlier origin-only conclusion). The provider can do everything right and the agent still cannot connect, and the error reads like a membership problem rather than a policy one.
Given this PR's typed recovery channel, that failure mode seems worth handling explicitly for hosted communities: the user-fixable action (claim a member identity for the agent, or move to a self-hosted relay) is different from every SSH-shaped remedy in the troubleshooting doc. Even just a named entry in docs/remote-agents.md under known failure modes would save the next team the week it cost us.
Field-tested this branch (head 7b528f0f4) end to end today and it works: an agent deployed onto a VPS that had not existed twenty minutes earlier, came up under systemd --user, connected to a self-hosted relay, and answered an owner @mention in-channel and by DM.
I ran it two ways, deliberately, because they exercise different halves of the contract:
- Provider driven directly, no desktop. I hand-built the JSON for each op and piped it into the binary. Worth stating as a positive: the one-object-in/one-object-out contract is testable standalone, which made every finding below cheap to isolate.
cargo build --release -p buzz-backend-sshon macOS arm64, Rust 1.94. - Through Buzz Desktop 0.5.14 — the released build, not this branch — with only
buzz-backend-sshdropped into~/.local/bin. The shipped desktop discovers the provider, offers it in the run-destination selector, rendersProviderConfigFieldsfrom theinfoschema, and deploys without error. That means this PR's provider is exercisable against a released app, which widens who can test it.
Target in both cases: a VPS created via a hosting API minutes earlier — Debian 13 (trixie), x86_64, 1 vCPU, 4 GB, no swap, plain public IP, no Tailscale. Harness: opencode 1.18.18. discover_harnesses found it correctly over SSH, and probe_models returned a clean, specific error when I omitted harness.
Findings ordered by severity. The first three I would treat as bugs; the rest are papercuts, ordered by how much time each cost me.
1. A record without auth_tag silently loses DMs remotely, but works locally
Local spawn has a fallback the provider has no equivalent of. managed_agents/runtime.rs:
// Legacy fallback: agents created before NIP-OA lack `auth_tag`. Without
// it the harness can't resolve the owner, and owner-dependent gate modes
// would drop every event. Forwarding the workspace owner pubkey via
// BUZZ_ACP_AGENT_OWNER keeps those records functional.
if record.auth_tag.is_none() {
if let Some(owner) = owner_hex {
set.push(("BUZZ_ACP_AGENT_OWNER", owner.to_string()));
}
}
crates/buzz-backend-ssh/src/deploy.rs lists BUZZ_ACP_AGENT_OWNER in RESERVED_ENV_KEYS but never pushes it, and it could not: deploy_payload_json carries auth_tag but no owner pubkey, and the launch block that would carry owner_pubkey is Known Defect 3, specified but not yet emitted.
The result is a divergence in behaviour rather than in configuration. Same record, same harness:
| local spawn | remote deploy | |
|---|---|---|
auth_tag present |
DMs work | DMs work |
auth_tag absent |
DMs work (fallback) | every DM silently dropped |
Reproduced in both directions. Deployed with no auth_tag, the agent answered @mentions in a channel and ignored every DM. The only evidence is one DEBUG line —
inbound author gate — dropping event ... mode=allowlist is_dm=true
— plus a startup WARN that reads as advisory ("owner-based matching is unavailable") rather than "DMs will not work". Adding BUZZ_AUTH_TAG to the env file and restarting fixed it immediately, with no other change.
To be clear on scope: an agent created through the desktop has an auth_tag, it reaches the host, owner resolved from BUZZ_AUTH_TAG appears at startup, and DMs work. This affects pre-NIP-OA records and any agent provisioned outside the desktop. Given the care taken elsewhere in this series about local/remote divergence — the persona-sync commit especially — it felt like the same class of issue. Passing an owner pubkey in the payload, or landing launch, would close it.
2. Known Defect 3 is reachable from the shipped app, and presents as a dead agent
Deploying from Buzz Desktop 0.5.14 reported success and the unit came up. The agent then answered nothing. Its env file:
BUZZ_ACP_AGENT_COMMAND="/home/debian/.local/bin/opencode"
BUZZ_ACP_AGENT_ARGS=""
The command was resolved to the correct remote absolute path; the args were empty. Visible in the startup line only as a doubled space:
agent_cmd=/home/debian/.local/bin/opencode mcp_cmd= ...
So the harness launched opencode's interactive TUI rather than opencode acp. Nothing answered ACP initialize, once per pool slot:
ERROR agent initialize failed: Request timeout — agent did not respond within 60s agent=0
ERROR agent initialize failed: Request timeout — agent did not respond within 60s agent=1
Setting BUZZ_ACP_AGENT_ARGS="acp" and restarting fixed it with no other change — all slots then reported agent initialized ... name="OpenCode".
This is Known Defect 3 (agent_command/agent_args as raw record bytes, pending the resolved descriptor in launch). I am raising it because the failure surface is worse than "a field is not normative yet": the deploy succeeds, the unit is active, presence goes online, the agent reacts to a message with 👀, and then never replies. The one place the cause is visible is that doubled space.
Any harness with non-empty catalog args is affected — opencode ["acp"], goose ["acp"], grok ["agent","--always-approve","stdio"]. Rejecting a deploy whose resolved harness has known args but an empty agent_args, until launch lands, would turn this into an error at the point of action.
3. Host-key verification is unreachable for an API-provisioned host
Confirming @FabianHertwig's point with a concrete case. With the host key absent, check fails:
ssh failed (exit 255): Host key verification failed. — the server's host key is
not in your known_hosts. Connect once with `ssh` to review and accept it.
The remedy the message prescribes cannot be followed: the host was created by an API call ninety seconds earlier, has no prior address, and no human is at a keyboard. Removing the key from known_hosts and re-adding it flips check between failing and {"ok":true,"detail":"Connected"} deterministically, so it is easy to reproduce.
4. parallelism is applied to a remote host whose capacity is never probed
The desktop sent BUZZ_ACP_AGENTS="10" to a 1 vCPU / 4 GB / no-swap box. Ten opencode subprocesses put it at 3366 MB of 3975 MB, largest RSS 484 MB, and took 27 s to warm:
12:57:55 (pool starts warming on the first accepted event)
12:58:22 agent_pool_ready agents=10
Nothing was OOM-killed, so this is a sizing gap rather than a crash, and the cost is latency. Measured on the same host with the same message:
BUZZ_ACP_AGENTS |
resident | first reply |
|---|---|---|
| 10 | 3366 MB / 3975 MB | 46 s |
| 1 | 885 MB / 3975 MB | 9 s |
Worth being precise about the interaction, because it cost me an hour: after fixing #2 the agent did reply, at 46 seconds. I had already concluded it was still broken. A cold start that long is indistinguishable from a dead agent, and it made a correct fix look ineffective.
parallelism is a local default carried to a machine the desktop knows nothing about. discover_harnesses and probe_models already ask the host questions, so there is an established place to ask one more — or the provider could clamp to what it can see and report the clamp.
5. private_key_nsec must be bech32, but buzz-admin generate-key emits hex
'private_key_nsec' is not a valid bech32 Nostr private key: the agent's identity
cannot be derived from it
The error is good and leaks nothing. But the natural way to mint an agent identity is buzz-admin generate-key, which prints Public key/Secret key as hex, and that output cannot be pasted into a deploy payload. Two first-party tools that do not hand off to each other. Accepting hex, or having generate-key also print the nsec, would remove the step.
6. There is no published Linux buzz-acp binary to copy
The preflight says:
buzz-acp MISSING copy the release binary to /home/<user>/.local/bin/buzz-acp
but the releases page carries only desktop artifacts (.dmg, .AppImage, .deb, .exe). I extracted /usr/local/bin/sprig from ghcr.io/block/buzz-sprig and carried /lib/ld-musl-x86_64.so.1 across so the musl binary would run on Debian. That worked, but nobody following the docs literally would arrive there. A published buzz-acp for linux-gnu, or a line in the docs naming the sprig image as the source, would help.
7. The preflight only checks two harnesses
It reports on claude and codex only. My host had opencode installed and on PATH, and the preflight was silent about it while the provider's own discover_harnesses found it as available with the right version. Since the catalog is already shared, having the preflight iterate it would avoid the reasonable conclusion that no harness is installed.
8. The preflight enables linger rather than reporting it
loginctl linger OK enabled just now
Convenient, and I understand why given the failure mode it prevents. But a script named "preflight" mutating the host was not what I expected, and I ran it against a second machine before noticing. A --fix flag, or naming the change more loudly, would set expectations better.
Findings 1, 2 and 4 are the same shape: the desktop answering a question about a remote machine out of local assumptions. #1 is a value it cannot resolve, #2 one it failed to resolve, #4 one it resolved from the wrong machine.
One note on the positive side: the env-file escaping is right, and I proved it by getting it wrong. Appending BUZZ_AUTH_TAG by hand without escaping the JSON's quotes produced a value systemd truncated at the second ", and the failure was indistinguishable from no tag at all. render_env's replace('\\', r"\\").replace('"', "\\\"") handles exactly this, and the comment above it explains why — which is how I found my own mistake.
Host is still up with both agents running, so I am happy to test a fix for any of these, or to re-run against this branch's desktop if that is more useful than the released one.
(Edited to fold in a second round of testing through the released desktop app — findings 2 and 4 are new, the rest are unchanged.)
🤖 Thanks for the patience on this one, and for the detailed write-up. A few things have changed since August that affect where it can go:
desktop/here is now the deprecated 0.X app. New desktop features go to block/buzz-app (seeAGENTS.md, "Desktop App"). That covers most of this PR: the where-to-run dialog, the Remote servers settings section, and the provider Tauri surface. Those would need to be proposed against buzz-app.- The provider itself fits the spec.
docs/remote-agents.md(#3748) already names this PR as its systemd/SSH example of a binding that conforms to layers 1 and 2 and writes its own layer 3. One conformance gap: the unit usesRestart=always, so an owner!shutdowncomes back 5 seconds later. The spec's I5 invariant and L1 item 5 require that a supervisor never revives an intentional clean exit. - Splitting would make it reviewable. The
buzz-acpchanges (--version, the exit-78 terminal-auth path) could be one small PR. The provider crate, its docs and the preflight script could be another.
The branch also conflicts with main now, so any of these would need a rebase first.
Carl, an automated reviewer, commenting via Wes's GitHub account.