Skip to content

profile, substrate: add Profile template resolution and snapshot Tag client support - #586

Merged
YoyinZyc merged 3 commits into
google:mainfrom
YoyinZyc:feat/ws5-substrate-tags
Nov 13, 2026
Merged

YoyinZyc merged 3 commits into
google:mainfrom
YoyinZyc:feat/ws5-substrate-tags

Conversation

@YoyinZyc

@YoyinZyc YoyinZyc commented Nov 13, 2026 •

Copy link
Copy Markdown
Collaborator

Part of #563

Prepares the Profile resolution layer and Substrate snapshot Tag client primitives for Workspace pre-warming (will wire Workspace controller change in the next PR):

  1. Profile API Semantics & Validation (pkg/apis/v1alpha1, internal/apivalidation, docs/manifests.md)

    • Enforce and document that Profile.ate_actor_template references an existing ActorTemplate directly and is mutually exclusive with image and resources.
  2. Profile Merging, Template Resolution & Tag Naming (internal/controller)

    • MergeProfile: overlays Task-level Profile overrides onto a Workspace default Profile while respecting ate_actor_template mutual exclusivity.
    • ResolveProfileTemplate: resolves an effective Profile into either the user-supplied ate_actor_template name or a deterministic ax-<hash> ActorTemplate spec (incorporating default image/resources, runnerImage, and SNAPSHOT_FIDELITY_ROOTFS).
    • WorkspaceTagName: generates deterministic, collision-free ws-<prefix>-<wsHash>-<tagHash> snapshot Tag names per (workspace, template) pair.
  3. Substrate Snapshot Tag & Actor Client (internal/substrate)

    • Add EnsureActorTemplate, EnsureActorFromTag (provisioning an Actor seeded from source_tag), and CreateTag / GetTag / ListTags / DeleteTag.
    • Unify Control API RPC retries on callWithRetry (codes.Unavailable + codes.Aborted on lease-contended mutations).
    • Extend substratetest with in-memory Tag lifecycle and source_tag checks for unit tests.

@YoyinZyc
YoyinZyc requested review from mayawang, siyuanfoundation and yongruilin and removed request for mayawang and rakyll November 13, 2026 06:31
Comment thread internal/controller/profile.go Resolved
Comment thread internal/controller/profile.go Resolved
Comment thread internal/controller/workspace.go Resolved
Comment thread pkg/apis/v1alpha1/common.proto Outdated
Comment on lines +58 to +59
// to use directly instead of generating an AX-managed template. Mutually
// exclusive with image and resources.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

iiuc, "use directly" means that the template skips what BuildActorTemplate adds right? Can we keep the seed semantics, or document what the template must provide?

My concern is that it won't get the trust bundle mount from #581,

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No it is not seed semantics. template and image are mutually exclusive. updated comment. ref #491

return
}

dst.AteActorTemplate = ""

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it mean a Task that overrides only cpu/memory on a Workspace using ateActorTemplate silently drops the template and runs the default image? Should this be an error instead?
I think it is also related to https://github.com/google/ax/pull/586/changes#r4566046898

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

right, updated the profile.go with different scenarios. Reject overriding resources alone when base(workspace) uses ate_actor_template.

@YoyinZyc
YoyinZyc force-pushed the feat/ws5-substrate-tags branch from 4dbf09e to f3fa1bd Compare November 13, 2026 17:56

@mayawang mayawang left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice groundwork. One thing to keep in mind when this gets wired in: the ax- templates are shared across tasks, so task deletion must never sweep them (same trap yongruilin caught on #552), and they'll need their own GC eventually. Today's per-task sweep doesn't match them, so fine for now.

…client support

Part of google#563

- pkg/apis/v1alpha1, internal/apivalidation, docs: enforce that Profile.ate_actor_template references an existing ActorTemplate directly and is mutually exclusive with image and resources.
- internal/controller: add MergeProfile, ResolveProfileTemplate (deterministic ax-<hash> ActorTemplate resolution incorporating runnerImage and SNAPSHOT_FIDELITY_ROOTFS), and WorkspaceTagName (ws-<prefix>-<wsHash>-<tagHash>).
- internal/substrate: add EnsureActorTemplate, EnsureActorFromTag, and CreateTag / GetTag / ListTags / DeleteTag, unify RPC retries on callWithRetry, and add substratetest Tag support.
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.

4 participants