Repository navigation
Environment protocol v4 and a simpler environment model - #124
Merged
Merged
Conversation
lukebuehler
enabled auto-merge (squash)
October 28, 2026 12:12
rustix 1.x exposes statx's stx_mask as a raw u32, so wrap it in StatxFlags before testing for BTIME. The path only compiles on Linux, which local macOS checks never exercised. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
This PR moves the environment stack to protocol version 4 and simplifies the environment model: Lightspeed keeps the inventory and decides when environments are created and closed, and providers own everything that happens while a machine runs. It is a breaking change. Databases need a reset, and envd, providers and the runtime must be upgraded together (see Deployment).
Protocol and envd
data.kind), and retryability follows from the kind.initializeis enforced first on every socket, and decoding is strict.crates/environment-protocol/contract/) and per-method fixtures.registration/challenge, and the signature binds the gateway origin.registration/openStreamreplacesdataUrl, so daemons derive the data URL from the gateway they dialed.registration/goodbyeandregistration/closed {superseded | environmentClosed}.returnOn, an optionalack, and the daemon-owned cursor kept as the default.terminatewith escalation.fs/writeFilewithifMatch, and a newfs/rename.fs/scanresults reported per root.transfer/*split into separate methods with afailedphase..git;fs/copy,fs/capture,fs/materialize, job artifacts,job/list,process/resize, and thehttp/stdio/sshtransports.Environment model
state(provisioning, open, closing, closed, failed) with aclose_reasonreplaces the 10-value status. The display status (paused, away, booting, …) is derived. The incarnation table is gone.Retry-After, 410, 409).environments/power/putandenvironments/ingress/putare synchronous pass-throughs.LIGHTSPEED_ENVIRONMENT_REGISTRATION_URLS).--on-closed=exit|parkand an opt-in for plainws://.env/getIdle, wakes on dial, takes an optionalcredentialFile, and names resources per universe.provisionattachment was prototyped and dropped again: attachments stayenvironmentId | inherit.UI, API and docs
environments/idle-policy/putanddeployment/environments/adopt; addedenvironments/update,registration-keys/updateandregistration-keys/rotate. The API contract and the TypeScript clients are regenerated.main), showing state, lifecycle messages and provider observations.reference/environment-protocol.md, the normative spec for provider authors, andenvironments/registered-daemons.md, with StatefulSet, Deployment and systemd examples.reference/environment-variables.md.scripts/dev/env.shexportsLIGHTSPEED_MCP_PRIVATE_NETWORKS(loopback).runs_liveassertions now hold despite the core blob tools; they were already failing before this branch.Deployment
store-pg/migrations/005_environments.sqlis rewritten in place, and the schema revision stays 11. A database migrated frommainfails the checksum check. Reset it (./dev.sh reset), or purge the environment tables and remigrate.EnvironmentJobWorkflowruns: their history types changed.LIGHTSPEED_ENVIRONMENT_PUBLIC_URLis removed.environment-gatewayon a non-loopback bind needsLIGHTSPEED_PUBLIC_BASE_URL, which is the signed registration origin, orLIGHTSPEED_ENVIRONMENT_REGISTRATION_URLS.environment-gatewayreplica. API gateways can still scale.incarnationIdis gone), and third-party providers must move to controller protocol 4.Testing
cargo test --workspace: 2,609 passed, 0 failed.-D warnings),cargo fmt --check,npm run typecheck, the web tests (960), the web and demo builds,check:docsandverify-metadata.share all clean.store-pg;runs_live(9/9, twice).incus_live(it needs a real Incus server) andruns_live_slow.Known gaps
004_auth.sql(mcp_servers_auth_grant_fk,auth_providers_credential_secret_fk) may still block deleting a universe. This predates this branch.--nocaptureto see the message.