feat: cmd/sandbox-e2b, the e2b surface on a sandboxd mesh with no Kubernetes - #57
Merged
Merged
Conversation
…ernetes sandbox-e2b builds the mesh inventory source over the seeds, one store with claim routing over it, and serves the e2b surface from that store; with --envd-proxy-bind-address the envd data plane shares the same poller, store and index in the process. The --e2b-* flag block and the listener start and drain move into e2bcompat (Flags, ServerOptions, Server.Serve), the proxy's listener flags and serve loop into envdproxy (Flags with a name prefix, Flags.Serve), and the token-file read into sandboxd.TokenFrom, so the three mains share one definition of each. The binary is registered in make, goreleaser, the docker and build workflows, and the README and docs, with a mesh-mode section in the e2b guide and the redirect hop in the scaling design.
A delivered redirect hop left no trace, so an operator could not tell a hop from a direct warm hit.
…s start log, mesh docs match the code Serve moves from flags.go to server.go with its timeouts; the hoist had dropped domain from the envd-proxy log; the mesh section quotes the real advertise_addr error, names the unnamed-peer drop, and routes claims rather than serving them from the snapshot; --e2b-domain help reads for both binaries.
CMGS
added a commit
that referenced
this pull request
Sep 27, 2026
Repository-scope review round at the end of phase A (#50 to #57). Fixes with regression tests: the fleet HTTP client dials with a one-second timeout so a dead node is a capacity miss instead of a ten-second 500; AddressIPs cuts a client origin's scheme; an unnamed mesh member leaves only after MaxStale silent ticks so a graceful restart no longer hides a node, with the fewest-fails publish and seed-wins dedupe rules pinned; the chart passes the template alias file; the v2 page cursor keys on the raw claim time; the alias lookup answers for an image the fleet advertises. Simplifications: one logs handler, warmByKey over PoolCapacity, the list paths trimmed, two tests reuse pageOfList. Comments cut to one line each in the driver, the client and the mains. The flag is --e2b-template-alias-file. Docs: snapshot-placement follows #52, the package doc names both inventory sources, the mesh section states the corrected membership rule, reconnect by id needs SDK 2.6. Prod lines net -42, comments +33/-82, all gates green on darwin and linux.
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.
Summary
PR 5 of 5 for mesh mode:
cmd/sandbox-e2bserves the e2b surface on a sandboxd mesh with no Kubernetes. That means no kubeconfig, noNodeInventoryand no APIService.Wiring.
meshinventory.Newruns over the seeds, dialing sandboxd clients that share one HTTP client.--envd-proxy-bind-address, the envd data plane runs in the same process. It shares the poller, the store and the index, and its domain is--e2b-domain.Flags:
--sandboxd-seeds--sandboxd-token,--sandboxd-token-file--inventory-poll10s--e2b-*--envd-proxy-bind-address--envd-proxy-tls-cert-file,--envd-proxy-tls-private-key-file,--envd-proxy-guest-http2Shared pieces, so the three mains share one definition of each.
e2bcompat:Flagsholds the--e2b-*block, including--e2b-template-aliases.ServerOptions(inv)reads the key and alias files.Server.Serve(ctx, addr)covers the listener start and drain, moved from the apiserver main.envdproxy:Flagsholds the listener options, andAddFlags(fs, prefix)registers them. The envd-proxy binary keeps its names with prefix"", andsandbox-e2busesenvd-proxy-.Flags.Serve(ctx, ln, h)is moved from the envd-proxy main, and its drain test moves with it.sandboxd.TokenFrom(literal, file): the token-file read used by the apiserver andsandbox-e2b.The store logs a followed claim redirect at debug:
claim followed a redirect from=<node> node=<node> id=<claim>. The line sits on the hop, not on the warm hit.Registration: the Makefile
BINARIES,.goreleaser.yml(a build plus versioned and unversioned archives,goreleaser checkok), thedocker.ymlimage matrix, thebuild.ymlartifacts, the README, anddocs/index.md(plus the two inventory packages).Docs:
docs/e2b-compat.mdgains a mesh-mode section. It covers the flags, and that the node key is/v1/info advertise_addr, which is the client origin whenclient_advertiseis set. It names the minimum sandboxd as the first release carrying that field (sandbox mainacfca8btoday). It also covers startup failures, the silent-node and unnamed-peer rules, warm pools throughSetPoolsClusteror sandboxd config, and redirects.docs/scaling-design.mddescribes the redirect hop on the claim path.Closure and budget
Head to merge:
595780eba5b3273f2a26d6e39523e8a0ccf5b850, on master2ef6a7c.New exported identifiers and their consumers:
e2bcompat.Flags,NewFlags,AddFlags,ServerOptionscmd/sandbox-apiserver,cmd/sandbox-e2be2bcompat.Server.Serveenvdproxy.Flags,AddFlags,Flags.Servecmd/sandbox-envd-proxy,cmd/sandbox-e2bsandboxd.TokenFromcmd/sandbox-apiserver,cmd/sandbox-e2bRemoved from the mains:
startE2BServer's listener code,e2bFileLines,resolveSandboxdToken,serveOn, and their consts.Comment lines per file (added / removed):
shutdownTimeout. It moved with the const from the envd-proxy main, which drops two lines for it.Boundaries
GOWORK=off go list -f '{{join .Imports "\n"}}', cocoonstack and pflag imports only:e2bcompatimports neitherenvdproxynor anycmd.cmd/sandbox-e2bnever importskubeinventory.Acceptance 1:
go list -deps ./cmd/sandbox-e2b | grep -E 'sigs.k8s.io/controller-runtime|k8s.io/client-go|kubeinventory'prints nothing (rc 1)../cmd/sandbox-apiservercounts 387.Hot path
Serve, still before any request.Hardware
Setup:
acfca8bon both mesh nodes, joined by memberlist, with ane2b-rt:24.04pool.8aaf421. This head differs from8aaf421only in thedocs/e2b-compat.mdminimum-sandboxd wording.sandbox-e2be2b listener and its embedded envd-proxy listener. Python andcurlran on the node.Acceptance 5, mesh mode.
sandbox-e2bwas seeded with node A only and poll 10s, with the key and alias files.sdk-run: create, commands, files, info, list after the poll, pause, connect from a fresh handle, exec after resume, second key refused, default lane, network rules 400, kill)page-run, pages of 2 over 5)alias-run:Sandbox.create()→base→ e2b-rt;templateId= image,name=base; alias check)py-resume)sandbox logsM5-01 in detail:
sandbox-e2brestarted with poll 60s while A was warm and B cold. B was then filled and A drained within the window, so the snapshot still named only A warm.clientID=<B>:27777,templateID= the e2b-rt image andalias=base.sandboxd_claims_totalstayed flat atwarm=14 clone=0 cold=0, and B's warm tier went from 19 to 20.Acceptance 6, kube regression on the PR5
sandbox-apiserverandsandbox-envd-proxy.Review and gates
/simplify, all four lenses:
stderrIsTerminaland the log setup. Sharing them would take a package for trivial code.sandbox-e2b, one for mesh polls and one for claim routing, so the poll burst never touches the claim path's connections.review::Server.Servemoves besideHandler.domainagain.advertise_addrerror, name the unnamed-peer drop, say claims are routed from the snapshot, and name no unreleased tag.--e2b-domainhelp reads for both binaries./code, every touched file read in full:
TokenFromabove theClientmethods, because methods precede standalone functions.Gates:
make lint: 8/80 issues.on darwin and on linux.make fmt-check: ok.make vet: ok, with the three tagged harnesses.make build: builds all three binaries.asl: 0 findings on both platforms.go mod tidy -diff: clean.go test -race: ok.