Repository navigation
Description
Problem
Actor has no field for per-actor environment variables or configuration overrides.Container.env is defined only on ActorTemplate (api/ateapi/v1/ateapi.proto).
Workloads often share an ActorTemplate (same container image, resource limits, and volume layout) while needing distinct non-secret configuration per Actor, such as a session ID, tenant or project name, model name, or feature flags. Today, varying any environment variable across actors requires creating a separate ActorTemplate per actor, which duplicates template records and golden snapshot builds.
Constraint: SNAPSHOT_FIDELITY_MEMORY snapshots
As noted in docs/reference/api-guide.md (SystemInfo Volumes) and #1449:
- When a container starts during golden snapshot initialization, its process environment (
envp) is copied into the process address space and cached by the language runtime (os.Environ,process.env,os.environ). - When an actor restores from a
SNAPSHOT_FIDELITY_MEMORYsnapshot (the default for golden snapshots andsource_tagclones), bothateworker-gvisor(runsc restore) andateworker-microvm(restoreMemoryFidelity) resume the checkpointed process memory directly. No new container process is spawned, so changes to the OCI bundle'sprocess.envhave no effect on already-running processes.
By contrast, cold boots (GOLDEN_SNAPSHOT_MODE_DISABLED) and SNAPSHOT_FIDELITY_VOLUMES or SNAPSHOT_FIDELITY_ROOTFS restores start fresh container processes from the OCI spec built by atelet (prepareOCIBundles -> ocispec.Build).
Options to explore
Option 1: Per-actor env overrides for cold-boot and non-memory restores
Allow Actor to specify per-container EnvVar overrides that workloadSpecFromActorTemplate (cmd/ateapi/internal/controlapi/workload_spec.go) merges over ActorTemplate.containers[].env (with actor values taking precedence over template values, which take precedence over the image ENV in resolveActorEnv).
Open question on SNAPSHOT_FIDELITY_MEMORY interactions:
- Reject actor-level
envonCreateActorif the actor initializes from aSNAPSHOT_FIDELITY_MEMORYgolden snapshot orsource_tag? - Or automatically downgrade the initial restore of a golden snapshot /
source_tagfromSNAPSHOT_FIDELITY_MEMORYtoSNAPSHOT_FIDELITY_ROOTFSwhen actorenvoverrides are set, preserving the warmed rootfs while starting fresh container processes with the actor's environment?
Option 2: Project per-actor key-value configuration via SystemInfoVolumeSource
SystemInfoVolumeSource files are regenerated on the host by atelet on every Run and Restore and excluded from checkpoints (#802). Extending Actor with a bounded key-value map (or building on annotations in #3617) and projecting those entries into the systemInfo volume (for example as individual files or a dotenv file under /run/ate/...) works across SNAPSHOT_FIDELITY_MEMORY restores without losing memory restore speed.
Workloads that read /run/ate/... on wakeup (or via a PostResume hook from #450, or a guest process runner like ate-env before spawning child processes) can load per-actor configuration after a memory restore.
Related issues
- Add a SystemInfo volume source to ActorTemplate for delivering per-actor generated files #802 (
SystemInfovolume source) - Golden snapshot state pollution - general problem #1449 (Golden snapshot state pollution)
- Per-actor, restore-time credential projection (SystemInfo credential data source) that never enters snapshots #2335 (Per-actor restore-time credential projection via
SystemInfo) - Support decorative, non-queryable metadata (annotations) on Actor and ActorTemplate #3617 (Annotations on
ActorandActorTemplate) - Actor -> ActorTemplate relationship #1051 (
Actor->ActorTemplaterelationship) - Actor lifecycle hooks #450 (Actor lifecycle hooks)
Activity
brandonroyal commentedon Nov 16, 2026
Maya Wang (@mayawang) PTAL
juli4n commentedon Nov 17, 2026
I think we need to think about this more generally. We need per-actor envs here, but we had many asks before about other fields (e.g #553 for images, #3866 for volume mounts, #2548 for network bandwith limits.
If we add overrides one field at a time, each one needs its own inherit rules. I suspect the API will also be very subtle wrt not set values vs zero values, etc. We will also need rules about whether a change invalidates a golden snapshot or not.
Maybe we need to re-consider the idea of just allowing the
Actorresource to inline the template (usingunionMemberfields). When an actor is created, you can either specify theObjectRefto theActorTemplateor inline the template (it wouldn't be theActorTemplateresource message proto but an equivalent).We discussed this in the past, the main concern was the
Actorresource growing too much and degrading ate-apiserver. We could use Isolate to see how bad this is though.cc Zoe Zhao (@zoez7) Tim Hockin (@thockin)
BenTheElder commentedon Nov 18, 2026
I would also nudge this toward the system info mount if possible, this pattern doesn't require throwing away memory and that's a big reason we already shipped it.
mayawang commentedon Nov 18, 2026
Thanks for writing this up! For sandboxes that only need their own identity after resuming from a shared golden snapshot, the existing system info volume already works today, so I'd lean the same way as Ben.
Tested on microVM with golden snapshots enabled: two actors resumed from the same golden snapshot each read their own name and UID from the system info mount, and that held across a later suspend and resume. A value the process cached at startup still showed the golden actor's value, matching the environment constraint in the issue.
So identity on its own needs no API change, just the workload reading the mount after resume. Beyond identity, orchestrators that share one warm template across many sessions already need to pass per-actor settings, like a session ID. Projecting a small key-value map, or the #3617 annotations, into the system info volume seems like the smallest step for v1.1, with #450 if a guest needs a resume hook. That doesn't rule out Julian Gutierrez Oschmann (@juli4n)'s inlining idea for images and mounts, it just keeps memory snapshots working for the config case.
mayawang commentedon Nov 24, 2026
Adding a concrete end-to-end CUJ from
google/axto help scope this forv1.2(building on theSystemInfocheck above, for discussion at the next community meeting).End-to-end AX flow
In
google/ax, many tasks share one warmActorTemplateper profile (same container image and resource limits). What differs per task is a small set of non-secret runtime inputs: goal text, JSON config, MCP server list, optional session ID, workspace setup config (see google/ax#696), and task-level env values.ActorTemplatedeclares the base image, limits, and volume layout (with an optional golden memory snapshot).ax-serverreferences that shared template and needs to attach a small, bounded map of per-actor inputs (non-secret; API keys stay outside the sandbox in the egress gateway). To support upgrading a task in place across resumes (Tasks should be upgradable google/ax#742), callers also need a clean way to update those values when resuming or modifying an existing actor.ROOTFSrestore starts a fresh process, where normal env vars would work.MEMORYrestore resumes an already-running process (execvealready ran), soenvpcannot be updated. Writing per-actor entries into the host-generated read-onlySystemInfomount (/run/ate/...) works across both cold boots and memory restores without discarding the memory snapshot.templateReplacedinateapi, downgrading the first restore toSNAPSHOT_FIDELITY_VOLUMESand dropping installed tooling outside the workspace volume.ax-serverrelies on an in-guest runner and pushes YAML over an HTTP port (POST /runner/v1alpha1/task; see all: push tasks to runners and remove the runner pull protocol google/ax#688 and runner: reply to a push only when the pushed work is complete, and delete the pushes channel google/ax#741). Moving per-actor config projection into Substrate core lets AX drop that temporary push path and run custom OCI images with minimal glue.Proposed minimal scope for
v1.2SystemInfomount onRunandRestore(excluded from checkpoints, matching how actor identity already works).PostResume) if an already-running process needs a signal to reload updated files.Happy to walk through this briefly at the next community meeting to confirm the
v1.2direction and align on an implementation owner.cc Tim Hockin (@thockin) Benjamin Elder (@BenTheElder) Dmitry Berkovich (@dberkov) Jaana Dogan (@rakyll)
rakyll commentedon Nov 24, 2026
Per actor environment would also simplify a significant number of BYOS integrations where actors have to be resumed with a new "work id" at resumption time. Today, we write a custom wrapper server around the actual worker binaries just to be able to pipe the dynamic variables.
HavenXia commentedon Nov 25, 2026
Is it better to use per-actor config or per-tenant (atespace?) config?
thockin commentedon Nov 26, 2026
It is noted here, but sort of buried: There is no way to set an env on a running process from outside of that process. The practical implication is that setting a per-actor env var means you CANNOT use golden snapshots.
To me, that seems like a high price to pay.
Projected volumes exist BECAUSE of this limitation. But files in projected volumes represent fields in the API (e.g. the Actor's
.metadata.name). If we want to add more projections, what field are we going to put them in? Annotations (#3617) seems plausible - is there something better?