Repository navigation
Run Together tasks over the Hurdle socket - #3
technillogue wants to merge 14 commits into
Conversation
Bartender's Hurdle API gives the controller one WebSocket to a fresh sandbox and nothing else: no exec, no sandbox token. Closing it terminates the sandbox. When HURDLE_TOGETHER_RUN_URL is set, hurdle writes the task inputs over that socket, runs each task step inside the sandbox, and reads the sealed results back. The Agent's egress reaches the Guardian on the same socket, and the Guardian CA crosses in X-Sandbox-CA. A server baked into the snapshot runs the steps with the existing staging, launch, sealing and trust code, against its own processes, so the E2B and sandbox API paths keep a single copy of that logic. Readiness skips the sandbox API check in this mode, since Bartender refuses a bad key when the run connects. HURDLE_TOGETHER_API_URL points the sandbox API at a local control plane such as devbox.
Bartender now starts Hurdle sandboxes without internet access, DNS included. Setup resolved each capture host in the sandbox to drop direct routes to it, so any suite with capture hosts failed there. Those routes are already refused by the node, so the in-sandbox setup skips that step. installWorkloadTrust keeps it by default, so E2B and the sandbox API path are unchanged.
With every host intercepted, the Guardian dials upstream from the machine running Hurdle. Nothing stopped an Agent from naming that machine's loopback, its network, or a cloud metadata address, so a CONNECT to 127.0.0.1 or 169.254.169.254 reached it. Both the CONNECT hook and absolute-form plaintext requests now refuse a destination that is a non-public address or resolves to one. Names that do not resolve are left alone, which keeps the reserved control and preflight names working. Only the intercept-all Guardian is affected: the capture-only Guardian never dials anything but capture hosts. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The Agent runner starts the Agent in a process group of its own, so the local workload's SIGKILL to the shell's group ended the shell and the runner but not the Agent. The Agent kept the stdout and stderr pipes, the child's close event never fired, and the agent step hung until the controller's grace timer tore down the socket: a timed-out Agent lost its whole run, artifacts and evidence included. Stop now sends SIGTERM to the group first, which the runner forwards to the Agent's group, and SIGKILL a second later. Once the shell has exited, the pipes are given a second to drain and then destroyed, so whatever survived the group cannot hold the result. The step then returns a timedOut fact and the process census kills what is left. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
A Hurdle sandbox holds no secrets: the Guardian on this machine keeps every real credential and swaps surrogates for them on egress. A task credential declared with environment delivery, which is the default, would have put the real value into the Agent's environment over the socket, defeating that. The socket provider now declares itself sealed-only, and the Together environment refuses such an envelope before the Guardian or a sandbox is started, naming the credentials to redeclare with captured-http- header delivery. The sandbox-API provider is unchanged. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
A Together Runtime needed a snapshot alias, and setup built one with the sandbox API before anything could run. The Hurdle API needs none of that: Together boots its own Hurdle image for every connection. An environment variable selected it, which left the path that needs no setup as the one that needed an extra step. A snapshot alias is now what selects the sandbox API; a Runtime without one runs on the Hurdle socket, at the production URL unless HURDLE_TOGETHER_RUN_URL names another control plane. Setup without --snapshot installs the Guardian and writes the Runtime, building nothing; a project that built a Hurdle snapshot before keeps it. Runtime initialization, readiness, dependency checks and the runtime summary follow: the sandbox SDK is required, and the key verified against it, only when an alias is set. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The socket multiplexed its streams with a kind byte and a channel id, and relied on WebSocket message boundaries to delimit frames. Two things followed. A flow the Agent stopped reading was buffered in the server without bound, since one shared socket cannot pause one flow. And a relay in the path that fragments or coalesces messages, which any relay may, broke the framing. The streams now ride one yamux session (hashicorp/yamux wire format, version 0): the controller is the yamux client, the server opens a stream per egress connection, and ops on the control stream name the streams that carry their bytes. Each stream has its own window, so a slow reader holds back only its own sender and buffers at most one window; frames are reassembled from the byte stream whatever the chunking. The op layer (setup, stage, agent, collect, metadata) and every test of it are unchanged. The multiplexer is a small module of its own rather than a package: the one available drops bytes of a frame split across chunks, acknowledges a peer's stream only once it has data to send, and grants window as data arrives rather than as it is read. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
One page for the contract between the controller, the server inside the sandbox and Together's relay: what the node and the server each enforce so the socket is the sandbox's only way in or out, the upgrade, the yamux framing and the op mapping on top of it, how egress is carried, and what Together runs. Linked from the Together sandbox setup section. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Broly Security ScanNote Summary 1 actionable finding(s) in this PR
Main table: 1 shown, 0 omitted of 1 actionable finding(s) above the reporting threshold. See the repository Security tab for the full set. No finding is at or above
Dismiss false positivesTick a box to dismiss the finding; untick it to bring the finding back. That is the same as replying
Note Re-scan this PR anytime with
|
Llama 3.3 70B Turbo is no longer served on Together's shared endpoints, so the example's completion call returned 400 model_not_available for every key tried and the run could not pass. The fixture now asks gpt-oss-120b, which is serverless, with 256 tokens so its reasoning leaves room for the one-sentence reply the checks look for. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
PID 1 in Together's Hurdle image is Pint, which does not reap orphans, so a child a killed Agent left behind stays a zombie forever. The census counted it, the cleanup could not kill it, and the run was declared not quiescent with its artifacts dropped. Every timed-out run and every Agent command that orphaned a process hit this on staging. A zombie holds no code and can do nothing, so the census skips state Z the way it already skips kernel threads. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Authoring declares captured-http-header delivery for a Suite's API credential only when a check requires trusted egress. The shipped Together suites use advisory checks, so their key stayed on environment delivery and the socket's sealed-only rule refused every one of them before the Guardian started, with the reason scrubbed from the record. On the socket, such a credential is now delivered the way a required check would have declared it: swapped into the Authorization header on the Suite's own API hosts, which the envelope already names. Only a Suite with no API hosts is still refused, and that refusal now carries an operator reason. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Throughput per stream is one window per round trip to the Guardian, and the protocol's 256 KiB initial window over the 150 ms relay path measured 0.75 MB/s. Each side now grants its full 2 MiB window when a stream opens, as the reference implementation does for a configured window, and replenishes it as the reader consumes. Two in-flight megabytes per stream is what the sandbox buffers for a flow whose reader has stopped. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
a1ccfe7 to
aeeae68
Compare
Together's Hurdle API hands Hurdle one WebSocket to a fresh sandbox and nothing else. Task inputs, each step, sealed results, and every connection the Agent opens travel over that socket to the Guardian on the user's machine. Closing it ends the sandbox.
docs/together-socket.mdis the contract.Joji's host Guardian and Fernando's socket server, as written, plus:
Tested against
hurdle.codesandbox.streamwith the image built from this branch: both examples, an advisory-only suite, a timeout, a 100 MiB transfer, a 20-minute idle socket, six concurrent cells, and the property probed from inside and outside the sandbox.Needed on the platform side before a customer can run this: a production endpoint, the default
hurdlesnapshot built from this branch (npm run together:bartender-context, no nydus), and nodes running runsb with both network commits, since the inbound allowlist is what keeps a port the Agent opens unreachable.🤖 Generated with Claude Code