Repository navigation
Description
Summary
Let Tasks with the same shape share one golden snapshot. A canary golden is a one-off boot that exists only to warm the shared environment and produce the golden snapshot. Anchored Tasks then start from that golden, each with its own data snapshot and per-task input supplied at runtime. A related Task clone primitive starts a new Task from the data of an existing suspended Task, using Substrate tags.
Today every Task gets its own ActorTemplate, and so its own golden boot and warmup, even when the only thing that differs between Tasks is one input value (a PR URL, an issue number). For pool-style agent workloads, that makes every Task pay a full cold start.
This RFC feeds into #433, which says "AX doesn't need golden images". The point here is that whether AX uses goldens should be decided by workloads like the one below, where most of the cost is shared setup.
Motivation: a pool of code review agents
A team wants every PR reviewed by an agent. Every review needs the same environment: the repo cloned at main, dependencies installed, linters and MCP servers ready, and review skills loaded. Only the PR differs.
Today:
sequenceDiagram
autonumber
participant GH as GitHub
participant Q as Queue (outside AX)
participant D as Dispatcher
participant AX as ax-server
participant S as Substrate
GH->>Q: PR opened webhook
Q->>D: next PR
D->>AX: CreateTask(review-pr-1234, env PR_URL)
AX->>S: CreateActorTemplate("review-pr-1234-tmpl-hash")
Note over S: New template for every task:<br/>task name and per-task env feed the name
S->>S: Golden boot in ate-golden:<br/>clone, install deps, start spec.command (see issues 427, 428)
S->>S: Golden snapshot
AX->>S: CreateActor, ResumeActor
S-->>D: Review posted
D->>AX: DeleteTask
The full setup runs on every PR, nothing is reused, and the golden boot hits the egress and command problems in #427 and #428.
Proposed:
sequenceDiagram
autonumber
participant Op as Operator
participant GH as GitHub
participant Q as Queue (outside AX)
participant D as Dispatcher
participant AX as ax-server
participant S as Substrate
participant R as Runner (in actor)
rect rgb(235, 245, 255)
Note over Op,S: Once per TaskTemplate revision (and on refresh)
Op->>AX: apply TaskTemplate "code-review-base"
AX->>S: CreateActorTemplate (named from shape, not task)
S->>S: Canary boot: clone main, install deps,<br/>start MCP servers (warmup egress allowed)
S->>S: Golden snapshot, canary actor deleted
AX-->>Op: TaskTemplate Ready (revision 3)
end
rect rgb(240, 255, 240)
Note over GH,R: Per PR
GH->>Q: PR opened webhook
Q->>D: next PR
D->>AX: CreateTask(from code-review-base, input PR_URL)
AX->>S: CreateActor(shared template), ResumeActor
S->>R: Restore golden + fresh data snapshot (seconds)
R->>AX: Fetch own Task input and credentials (actor JWT)
R->>R: git fetch PR, run review, post comments
R-->>D: Review posted
D->>AX: DeleteTask
end
The dispatcher and queue still live outside AX, but there's no per-PR setup, and nothing carries over between PRs, which matters because PR code is untrusted.
How the resources relate:
flowchart LR
TT["TaskTemplate<br/>code-review-base r3"] -->|canary boot| G[("Golden snapshot<br/>shared, read-only")]
G -->|anchored| T1["Task review-pr-1234<br/>own data snapshot"]
G -->|anchored| T2["Task review-pr-1235<br/>own data snapshot"]
G -->|anchored| T3["Task review-pr-1236<br/>own data snapshot"]
T2 -. "suspend + CreateTag" .-> Tag[("Tag")]
Tag -. "clone: from.task" .-> T4["Task review-pr-1235-retry<br/>copy of T2's data"]
Why sharing doesn't happen today
In internal/controller/reconciler.go and internal/substrate/client.go:
- The task name is in the template name.
taskTemplateNamereturns"<taskName>-tmpl-<hash>", so two identical specs still produce two templates. - Per-task data goes into the template env.
AX_TASK_YAML(which containsmetadata.name),spec.envandGEMINI_API_KEYare all template env vars, so they feed the hash and get baked into the golden. - The golden boot is implicit. The runner treats the golden boot as an ordinary first boot. It clones workspaces where egress is blocked (Workspace clones run in the golden boot, where Substrate blocks egress #427), starts
spec.command(spec.commandalso runs in the golden boot #428), and snapshots whatever state results. - Credentials are baked into the golden. Because the model key is a template env var, rotating it means rebuilding templates.
Proposal
1. Canary golden: a resource keyed on shape
A new resource, tentatively called TaskTemplate, describes the shared shape and the warmup. AX builds one Substrate ActorTemplate per TaskTemplate revision. Its name comes from the shape (image, workspaces, resources, sandbox config), never from a task.
apiVersion: ax.io/v1alpha1
kind: TaskTemplate
metadata:
name: code-review-base
spec:
image: gcr.io/acme/review-agent@sha256:…
resources:
requests: { cpu: "2", memory: 4Gi }
workspaces:
- name: acme-monorepo # cloned at main during warmup
goal: "install the Go and Node toolchains and run `make deps`"
warmup:
egress: { gateway: warmup-egress } # the canary needs network access (#427)
timeout: 20m
status:
phase: Ready # Building | Ready | Failed
revision: 3
golden:
tag: ate-golden/code-review-base-r3
builtAt: "2026-10-14T09:12:00Z"
conditions: [...]The canary boot runs workspace setup and then signals that it's ready to snapshot. It never runs a Task's spec.command (#428).
2. Anchored Tasks: shared golden, new data snapshot
apiVersion: ax.io/v1alpha1
kind: Task
metadata:
name: review-pr-1234
spec:
from:
template: code-review-base # pin with `revision: 3`, or follow the latest Ready revision
input: # supplied at runtime, never baked into a template or golden
env:
- { name: PR_URL, value: "https://github.com/acme/monorepo/pull/1234" }
command: ["review-agent", "--pr", "$(PR_URL)"]- The actor restores from the template's golden and gets its own fresh data snapshot and durable volume.
- Input is delivered at runtime. On first boot the runner fetches its Task from ax-server, authenticating with
MintActorJWT, and serves it through the metadata server. Model credentials are fetched the same way instead of being baked in. - Per-task setup, such as
git fetchof the PR branch, runs after the input arrives and beforespec.commandstarts.
3. Task clones: start from an existing Task's data
spec:
from:
task: review-pr-1234 # must be SuspendedThis maps to Substrate's CreateTag on the source actor, then CreateActor with source_tag. Uses include forking a Task whose environment was prepared by goal-driven setup, speculative branches of one task (the roadmap's "Stateful Task Branching"), and retrying from a known-good point.
Implementation sketch
| Area | Change |
|---|---|
API (ax.proto) |
TaskTemplate resource and RPCs. Add Task.spec.from (template or task) and spec.input. |
| Reconciler | Shape-keyed ActorTemplate per TaskTemplate revision. Anchored tasks call CreateActor against that template. Clones go through CreateTag and CreateActor(source_tag). Stop putting task data and credentials in the template env. |
| Runner | Tell canary boot and real boot apart. Run warmup only in the canary. Fetch input and credentials at runtime with the actor JWT. Start spec.command only on the real actor's first boot. |
| ax-server | An endpoint where a Task fetches its own input and credentials, authenticated by actor JWT. |
Open questions
- What Substrate supports, and where the limit is. A new actor's first boot from a shared golden is Substrate's default: every Actor of a template is first restored from its golden, which is a
Fullcapture that includes the golden boot's/workspace. So anchored Tasks need no Substrate change; the blockers are on the AX side. The limit is resume after suspend. WithDatasnapshots, resume cold-boots over the Task's own data:onResume.fromData: Goldenwasmicrovm-only, and AX runs on gVisor, and Remove onResume.fromData and the DATA_ON_GOLDEN restore scope agent-substrate/substrate#2105 (Task creation fails on Substrate 6a35150 and later: AX still sends the removed snapshot_config.on_resume #443) removedon_resume. Is warm resume from the golden needed for long-running Tasks, or isFullscope the answer there? (Based on the Substrate docs at the version AX pins,944abe3; to be confirmed against current Substrate.) - How does this fit Revisit the API server and Task lifecycle #433? Revisit the API server and Task lifecycle #433 proposes dropping goldens and revisiting
ActorTemplate. Is a shape-keyedTaskTemplatethe right abstraction, or should the canary be expressed as an ordinary Task that is suspended and tagged, with anchored Tasks being clones of it? - Tag scope. Can a tag be used across atespaces (
TagScope)? Can one shared base serve tasks in many atespaces? - Refresh and rollout. How does a template follow
main? Options: scheduled rebuilds,revisionpinning, and how long old revisions are kept for in-flight Tasks. Old revisions and their goldens also need a cleanup rule, for example deleting them once no Task is anchored to them. - DATA vs FULL. Clones inherit files only with DATA scope. Should
spec.from.taskallow FULL-scope clones that carry process memory, for agents that need conversational continuity? - Naming.
TaskTemplatevsGoldenvsTaskClass.
Related
- Revisit the API server and Task lifecycle #433: Revisit the API server and Task lifecycle
- Workspace clones run in the golden boot, where Substrate blocks egress #427: workspace clones run in the golden boot, where egress is blocked
spec.commandalso runs in the golden boot #428:spec.commandalso runs in the golden boot- Task creation fails on Substrate 6a35150 and later: AX still sends the removed snapshot_config.on_resume #443:
snapshot_config.on_resumewas removed in Substrate6a35150 - docs/runner.md says suspend sends SIGTERM, but suspend freezes the sandbox without any signal #451: suspend sends no signal; only
/workspacesurvives - Suspend/resume creates redundant ActorTemplates and golden snapshots #378: redundant ActorTemplates from status in
AX_TASK_YAML(closed) - Roadmap: "Stateful Task Branching"
Activity
rakyll commentedon Nov 15, 2026
I'm not sure if this issue is still relevant, we materialize Tasks from actor template. AX doesn't need its own templating system. I'm closing this issue but reopen another issue based on the latest changes.