Skip to content

feat(burst): reach machines over the caller's tailnet, and detach lanes (0.70.0) - #90

Open
indykish wants to merge 4 commits into
mainfrom
feat/burst-tailnet
Open

indykish wants to merge 4 commits into
mainfrom
feat/burst-tailnet

Conversation

@indykish

Copy link
Copy Markdown
Contributor

Why

orly burst admitted SSH only from the caller's public IPv4 and ran each lane inside one SSH session. When the caller's network changed mid-run (a Wi-Fi drop that brings a new public IP), the session died, reconnecting was refused, and the lane was marked interrupted and its VM deleted. Seen live: a lane admitted from one address lost its session 17 minutes in after the caller's address changed.

What changes (0.70.0)

  • Tailnet only. The caller must be on a Tailscale tailnet. Each VM joins it at first boot with its own auth key: ephemeral, preauthorized, single use, 10-minute expiry, tagged exactly tag:orly-burst, minted from an OAuth trust credential whose only tag is tag:orly-burst. The key is deleted once the VM has joined, and on every failure. SSH goes to the VM's tailnet address. No security group opens port 22. The AWS group has no inbound rule; TIR's has UDP 41641 only, Tailscale's direct-connection port, because TIR refuses an empty group.
  • Boot. AWS passes the join through EC2 user data. E2E Networks TIR has no user data, so each VM gets its own start script, deleted with the VM.
  • Detached lane. The job runs under setsid/nohup, writing its log and exit code to /run/orly-burst. orly follows the log by byte offset. When the session drops, it reconnects within the existing machine-wait window, never past the job deadline, and resumes where the log left off. The exit-code file decides the result.
  • Teardown. Nodes log out before their VM is deleted. A warm-up wipes Tailscale state and cloud-init before it is imaged, so no snapshot carries a node identity.

Security review (independent, then re-reviewed)

Fixed:

  • A peer must carry tag:orly-burst, and only one may match.
  • burst.secrets refuses TS_OAUTH_*, E2E_* and AWS_*.
  • The snapshot is wiped before imaging.
  • A truncated upload is refused by byte count.
  • A refused TIR start script is reported by HTTP status only.
  • A node that joins late is still logged out, and orphaned start scripts are reaped by age.
  • docs/BURST.md warns that tag:orly-burst must appear in no rule's src, and that a tailnet's default allow-all grant lets burst VMs reach every device.

Open for the owner: resolveSecrets still sends any preset caller environment value a repository's burst.secrets names. That behaviour predates this change.

Evidence

  • make audit: 615 pass, 0 fail (615 tests, 51 files).
  • orly gate verify: repo.config, docs.language and typecheck all green.
  • gitleaks git over these 4 commits and gitleaks dir over the tree: no leaks found. Outgoing commits and messages were also checked against the real credential values and for vault paths: none present.
  • All tests run on fakes (fake TIR, fake SSH, fake Tailscale API); no live cloud or Tailscale calls. The first live burst proves the TIR start-script path and tailscale up --auth-key=file:.

Do not merge until the owner has reviewed it.

🤖 Generated with Claude Code

indykish and others added 4 commits November 22, 2026 22:30
…es (0.70.0)

A caller whose public address changed mid-run lost its SSH session, could
never reconnect because the security group admitted the old address only,
and the lane ended interrupted with its machine deleted.

Tailscale is now required. orly refuses to start unless the caller's
`tailscale status` is running and online, then mints one single-use,
ephemeral, preauthorized key tagged exactly tag:orly-burst per machine
through the OAuth credential in TS_OAUTH_CLIENT_ID and
TS_OAUTH_CLIENT_SECRET. The key reaches the machine only in its boot
script, through EC2 user data or a TIR start script, and is deleted once
the machine has joined or failed to. No security group opens port 22, and
the caller-address check is gone.

The job runs detached on the machine, writing its log and exit code under
/run. orly follows the log by byte offset; a lost session is reconnected
for up to 10 minutes since the log last grew, never past the deadline, and
the lane's result is the exit code the machine wrote. Nodes log out before
their machine is deleted, and a warm-up leaves the tailnet before it is
imaged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- A node counts only when it carries tag:orly-burst, and two tagged nodes
  of one name are refused, so no device can stand in by claiming a name.
- burst.secrets may not name OP_SERVICE_ACCOUNT_TOKEN or a TS_OAUTH_, E2E_
  or AWS_ variable, since a value already in the caller's environment is
  sent to the machine as it is.
- A warm-up about to be imaged also runs cloud-init clean, stops tailscaled
  and removes its state file, so no snapshot carries its node or user data.
- The launcher is told the job script's size and discards a short upload,
  so a session lost mid-upload never starts a truncated job.
- A refused TIR start script is reported by status alone, since TIR's
  errors may quote the script, and its key, back.
- A node that joined after the run stopped waiting is found and logged out
  at release. Start scripts are named by run, and teardown deletes this
  run's by name and any left by a run that began over 25 hours ago.
- docs/BURST.md warns that tag:orly-burst must be in no rule's src and the
  default allow-all grant must go.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
macOS answers EPERM to a signal for a process group whose members have all
exited but are not yet reaped. A session that ended just as its deadline
came threw that from the deadline timer; the reconnect loop's short
sessions made the race likely.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- docs/BURST.md: a killed run's nodes leave once their machines are
  deleted or go offline; the two warnings merge into one, and the key's
  deletion is said once. llms.txt names 0.70.0.
- stopOwnedGroup treats EPERM, a group of unreaped exits, as stopped for
  every caller, and burst's own wrapper goes.
- One run-id helper set in types.ts builds a run id, its tail and when it
  began; node and start-script names use it.
- A warm-up's machine is typed as joined, and is not imaged when it cannot
  be logged out.
- The tailnet address check reuses the shared IPv4 pattern.
- The boot script hands tailscale its key through a 0600 file in /run,
  removed on exit, instead of an argument, and asks `tailscale status`
  whether the node is up.
- An orphaned start script is one older than the longest deadline plus an
  hour, and one a VM still uses is reported as such, not for hand deletion.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 94.64945% with 29 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/burst/fake_tailscale.ts 82.07% 19 Missing ⚠️
src/burst/ssh.ts 94.93% 4 Missing ⚠️
src/burst/e2e.ts 90.62% 3 Missing ⚠️
src/burst/process.ts 93.33% 2 Missing ⚠️
src/burst/tailnet.ts 99.01% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

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.

2 participants