Repository navigation
Outbound agents: machines connect to the hub, no inbound SSH on machines - #3
Merged
Merged
Conversation
M6 design: dispatcher serve mode over newline-delimited JSON frames, the switchboard-connect connector with a pinned hub host key and capped jittered backoff, the sbrelay relay account whose per-key forced command names the machine, the 2750 vcm:sbrelay socket directory with an SO_PEERCRED check, newest-connection-wins replacement, heartbeats and timeouts, the agent transport config, status and remote-check through a control socket, setup and migration outline, threat model rows and tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011moV3EPNNknRWZQ686AChh
Machines behind NAT (a WSL box, laptops, LAN machines) can now connect out to the hub instead of the hub SSHing into them (transport "agent"). - Dispatcher 0.6.0: --serve, newline-delimited JSON frames on stdin and stdout; every request runs through the same run_request as a forced command, so validation and refusals are identical; the policy comes only from the machine's own argv; refused under sshd; size limits, busy, duplicate ids, cancel of usage streams, one-at-a-time sends, heartbeat answers, exit codes 0/75/76. - switchboard-connect (stdlib, byte-identical in remote/connector.py): hardened ssh (pinned host key under HostKeyAlias=switchboard-hub, no agent, no forwarding, -F /dev/null) cross-wired with the dispatcher, capped jittered backoff, long waits after replaced/refused/auth/ host_key, per-user lock, example systemd --user unit. - Relay (stdlib, forced command of the dedicated sbrelay account): the machine name only from --machine of the per-key command=, socket ownership checks, 5 MiB frame cap, fixed stderr lines; agent-relay CLI. - Hub: AgentHub on a 2750 vcm:sbrelay socket directory with SO_PEERCRED, strict preamble/hello, one live connection per machine (newer replaces older, read verbs retried once, sends unknown), heartbeats, AgentTransport for every tool, control socket for status and remote-check, authorized_keys lint, "laptop is not connected right now". - Config remote.agents and transport agent; deploy/relay files, hub units ReadWritePaths, opt-in VCM_AGENT_RELAY in setup.sh. - Docs: SETUP-AGENTS.md guide, REFERENCE, DESIGN, SWITCHBOARD (M6 implemented with deviations); tests for serve mode (forced-mode parity corpus), relay, hub, every tool over the real chain, connector with a fake ssh, config and deploy files. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…er-only relay hub - AgentConnection.send waits at most 5 s (WRITE_STALL_SECONDS) for the write lock and the drain; a machine that stops reading its channel is closed as write_stalled (aborted, not flushed), so pending calls end as disconnected. The heartbeat's ping uses the same bounded write; the cancel after a deadline (and after an oversize answer) goes out in the background, so the caller gets its timeout at the deadline. - At most 2 unfinished handshakes per machine, so one machine key cannot hold every connection slot. - The relay socket is bound, chmod-ed, then listened on; the process umask is no longer changed. - busy from the dispatcher is spoken "it is busy, try again in a moment". - The connector gives the dispatcher 1 s to exit after ssh ends, so a bye forwarded just before the relay exits keeps its exit code (75/76). - voice-coding-mcp usage does not read agent machines (only the hub holds their connections): cached records with a note, not counted toward exit 1. - Docs: the hub side of agent mode needs the server layout (the WSL hub's venv is in a mode 700 home and its sshd is loopback only); the WSL unit no longer claims the relay directory. setup.sh and the guide set sbrelay's password field to '*'; restart-after-directory, AcceptEnv check, troubleshooting rows; threat-model row for stuck connections rewritten with what is left. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011moV3EPNNknRWZQ686AChh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Machines (a WSL box behind NAT, LAN machines) now connect OUT to the hub instead of the hub SSHing into them.
switchboard-remote --servespeaks newline-delimited JSON on stdio and runs the same verbs with the same validation; the policy (sessions, usage, send, permission answers) comes only from the machine's own command line.switchboard-connectrunsssh -Tto a relay user on the hub (pinned hub host key, dedicated key, no forwarding, no agent), with capped, jittered reconnects; systemd --user unit example.voice_coding_mcp.remote.relay --machine <name>: identity comes only from which key connected. The relay talks to the service through a Unix socket in a 2750 vcm:sbrelay directory (SO_PEERCRED checked). Newest connection wins; in-flight sends on a replaced connection are never retried. Frame caps, 4 requests in flight, heartbeats, bounded writes.agent; every remote tool works over it (list, status, pending_input, send/keys/resize with the two-step confirmation, usage, watcher). Offline: "carbi is not connected right now".status/remote-checkshow connected machines, since when, dispatcher version, peer.Reviews: security + correctness (end-to-end with the real connector, relay, hub and dispatcher on an isolated tmux server: 29/30 checks, the one miss was the reviewer's own assertion). Gate: pytest 1773 passed, 9 skipped; ruff, format and mypy --strict clean.
🤖 Generated with Claude Code
https://claude.ai/code/session_011moV3EPNNknRWZQ686AChh