Skip to content

Run Together tasks over the Hurdle socket - #3

Draft
technillogue wants to merge 14 commits into
mainfrom
together-socket
Draft

technillogue wants to merge 14 commits into
mainfrom
together-socket

Conversation

@technillogue

@technillogue technillogue commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

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.md is the contract.

Joji's host Guardian and Fernando's socket server, as written, plus:

  • yamux as the transport, with a 2 MiB window. Per-stream flow control; frames survive any relay. Own module, since the available package drops split frames and has no backpressure.
  • The sandbox never receives a real credential. A credential declared for environment delivery is delivered through the Guardian on the Suite's API hosts; a Suite with no API hosts is refused with a reason.
  • Together's Hurdle image is the default. No snapshot alias means the socket; an alias still selects the sandbox API.
  • The Guardian refuses non-public destinations, so the Agent cannot reach the user's machine or network through it.
  • Timed-out Agents return a record; zombies no longer make a run non-quiescent (Pint as PID 1 reaps nothing).
  • The Together API example uses a serverless model.

Tested against hurdle.codesandbox.stream with 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 hurdle snapshot 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

mojojoji and others added 10 commits October 21, 2026 23:21
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-code-security-scanner

broly-code-security-scanner Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Broly Security Scan

Note

Summary

1 actionable finding(s) in this PR
12 total in scan · 11 dismissed false positives

  • 🟡 1 medium

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 high, so this check is not blocking. The findings above are still tracked and reported.

Severity Scanner Issue Location Dismiss Verdict
🟡 MEDIUM SAST Unbounded buffering of an incomplete data frame in
Session._write, enabling remote memory-exhau...
harness/lib/execution-environments/yamux.mjs:256 d4 🔺 TRUE_POSITIVE · Confidence: HIGH

Dismiss false positives

Tick a box to dismiss the finding; untick it to bring the finding back. That is the same as replying /broly dismiss d1 and /broly undismiss d1. To record why it is a false positive, reply with /broly dismiss d1: your reason instead — Broly reuses those reasons to triage similar findings across the org.

  • d4 · 🟡 MEDIUM   · harness/lib/execution-environments/yamux.mjs:256 · Unbounded buffering of an incomplete data frame in Session._write, enabling...

Note

Re-scan this PR anytime with /broly scan — useful after /broly undismiss, or to refresh findings without a new push.

Broly — SAST (GLM-5.3-Flash) · Secrets · SCA · IaC · GH Actions · Base Images · Supply Chain Threats · Attack Hypotheses · Adversarial Verification

We're continuously improving Broly's accuracy and finding quality — your feedback is valuable. False positives, missed findings, bugs, and feature requests all welcome.

Ask in #security-engineering   Powered by Together AI

technillogue and others added 4 commits October 24, 2026 19:34
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants