Skip to content

Rework execution-provider profiles into optional, versioned execution templates #2109

Open

Description

@JAORMX

Design: converge execution-provider profiles on optional execution templates

Why this issue exists

Issue #2091, especially expected behavior point 3 on Project environment images, identifies a real need: an operator should be able to prepare an execution environment for work that is not necessarily software development. A document-processing agent might need approved PDF tools; an operations agent might need a fixed set of diagnostic binaries. Neither case calls for a built-in catalog of build systems, dependencies, package managers, or installers. The operator prepares and qualifies the environment, publishes an approved version, and an authorized caller chooses it when creating a session. A future Project could supply an optional default, but session selection must work without a first-class Project.

Proposed direction: call each operator-owned, versioned execution recipe an execution template. Converge the existing Kubernetes execution-provider profiles into this concept instead of introducing a second registry or a mapping from a new choice object onto old profiles. A template describes what the host may provision; a provider makes an allocation; tool.Environment supplies the live workspace, read ledger, and optional command runner; the private EnvironmentRef identifies the exact bound environment; a session owns a binding to it. Those are distinct objects with different lifetimes. A list row in a picker is merely a safe projection of a template, not another execution_option, execution_choice, or execution_definition resource.

This is an Architectural design issue, not an approved interface contract or claim of production readiness. It records the proposed concept convergence and seeks review of the unresolved contract choices below. The next step, if approved in principle, is the human-reviewed acceptance/interface plan and a new or superseding ADR. Alpha status permits deliberate breaking changes after a migration decision; it does not permit ignored incompatible fields, accidental authority expansion, silent loss of retained state, or editing a frozen ADR as though it never said something different.

Concept convergence

Existing concept or earlier discussion term Proposed disposition
Kubernetes execution-provider profile Becomes an execution template. Preserve its validated image, resource, storage, and execution controls.
Separate public execution_options / choices / definitions Do not introduce another managed entity. A picker row is a projection of a template.
Session tool-surface profile ("" / "no-fs") Replace its wire spelling with explicit default / none / template selection under a deliberate compatibility contract.
Runtime tool.Environment and private EnvironmentRef Keep their existing roles: live capabilities and exact durable execution identity.
Project Optional future managed grouping/defaults resource, separate from existing project-scoped trust and configuration vocabulary. Not a prerequisite for templates.

The rework is more than a rename: it adds optional discovery and per-session selection, safe descriptive extensions, and durable template revision handling. It does not create a generic dependency installer or make image-backed execution mandatory.

Verified starting point and vocabulary

The following references are pinned to baseline commit f8b2d7f5843a2c3d04dbef3e4abf2b0b1611ffa5. They describe current behavior, not the proposed API:

  • The operator's strict ProfilesFile/ProfileSpec schema already describes an image, storage class and size, CPU/memory/ephemeral storage, runtime class, pull secrets, scheduling, file and command limits, and capacity. The Helm example calls these profiles. Reuse and rename the effective recipe; do not discard its controls to rebuild an unrelated catalog.
  • The execution client provider fixes one profile at construction; Bind uses that fixed profile. Making a caller-selected versioned recipe resolvable at binding is substantive work, not a field rename. The controller rejects a missing or changed profile digest; retaining historical recipe definitions for existing allocations will require an explicit design.
  • The engine's tool.Environment is the live capability bundle, not a service locator or catalog. The private session EnvironmentRef{Kind, ID, Revision} remains the exact durable reattachment identity. A template revision identifies the selected recipe, not that live ref or a reusable allocation identifier.
  • Today CreateSessionRequest.profile means a tool-surface choice: empty selects the deployment default and no-fs removes filesystem access. It is not an execution-provider profile. Proposed wire naming must eliminate this collision and preserve explicit no-FS attenuation. GetCompatibilityInfo separates build-supported features from enabled capabilities, including whether the Shell tool is registered.
  • Server placement binding carries principal, scope, and a final binding ID, with provisional commit/rollback hooks; provider interfaces sit at the host boundary. Prompt instruction assembly is an explicit, provenance-bearing optional source, not permission to treat image or template metadata as trusted instructions.

Current native-provider documentation and deployment instructions explicitly label the native provider a draft, not released or approved for production. Existing native code and a Helm chart do not reverse that status or prove hostile multitenant isolation.

“Project” is already a name for configuration, trust, learning, and memory scope: see permission resolution and learning's project partition. It does not imply a current first-class Project CRUD entity or session ProjectID. Neither a directory nor a trust root automatically becomes a managed Project identity, and introducing that identity must not silently migrate permission, memory, or learning authority. #732 was a closed, unmerged earlier MVP with blockers, not a rejection of this need. Project entity work belongs to #2091. #1383 concerns seed/sync, #2058 session navigation, and #1856 used a mock Studio path; none proves a working execution-template selector.

Proposed ownership and optionality

One logical operator-controlled source owns each recipe initially: validated configuration loaded by the host/provider. A read-only authorized catalog projects that source for discovery. No public template CRUD, independent database copy, or second exposure registry is needed for this slice. Kubernetes is the first backend that needs session-level selection. Other hosts can keep their fixed local or file-less defaults; a filesystem-without-shell deployment and an API/MCP-only deployment should not need a catalog to start sessions. A supported future backend may implement the same trusted host selection contract using its own typed, validated configuration. A template is not synonymous with an OCI image, repository, container, or Kubernetes CRD.

The host that lists, authorizes, and binds the choice should own the selection seam; do not add mandatory engine dependencies or a universal port for hosts that never select templates. Keep tool.Environment unchanged unless a separately justified core requirement appears. Kubernetes recipe fields remain typed operator configuration. User requests contain only a safe selection ID and revision, never image names, pull secrets, storage classes, resource settings, command runners, credentials, infrastructure paths, or arbitrary effectful metadata. If a deployment needs an exposure allowlist, treat it as authorization/projection policy over the same recipe, not another authoritative recipe. Template eligibility is not permission to bypass tool governance: Deny and configured Ask still apply after binding.

Deployment example Files? Built-in Shell? Template picker? Meaning
API/MCP-only, explicit no-FS No No Not required No execution backend allocation; independently configured non-file tools may still work.
Filesystem-only host Yes No Not required Read/edit tools may exist without a command runner.
Fixed local host Yes Optional Not required An operator default works without selection infrastructure.
Kubernetes with multiple approved recipes Yes If wired for that binding Yes Eligible callers select a validated template revision; the provider provisions a private allocation.

These columns describe effective built-in capabilities, not security attestations. Absence of Shell means the built-in Shell runner is unavailable; it does not prove arbitrary code execution impossible through MCP, another tool, or a host integration. Conversely, seeing /bin/sh in an image does not make the Shell tool available. Do not infer that every backend can implement arbitrary runners or that an advertised tool has permission to run.

Selection and discovery contract to design

Replace the overloaded wire spelling profile with an explicit optional execution choice. The examples below illustrate semantics for discussion; they are not a shipped or frozen REST/protobuf contract:

POST /v1/sessions
Content-Type: application/json

{}

Omission requests the deployment default. Explicitly request no filesystem execution with:

{"execution": {"none": {}}}

Select a specific approved template revision with:

{
  "execution": {
    "template": {
      "id": "document-processing",
      "revision": "opaque-revision"
    }
  }
}

A schema with exactly one recognized variant must reject an empty execution object, multiple variants, unknown variants or fields, blank IDs, missing required revisions, and malformed selectors. In particular, an older server must not silently parse an unsupported template selection as omission and provision its broader default. Explicit none must never be widened by a later default or Project setting. The template selector neither chooses an allocation nor exposes the exact private EnvironmentRef.

An authenticated, read-only ListExecutionTemplates and perhaps GetExecutionTemplate (or HTTP GET /v1/execution-templates) would return a bounded inventory such as:

{
  "items": [
    {
      "id": "document-processing",
      "revision": "opaque-revision",
      "display_name": "Document processing",
      "description": "Tools for document inspection, conversion, and OCR.",
      "capabilities": {"filesystem": true, "shell": true},
      "metadata": {
        "extensions": {
          "example.com/catalog": {
            "schema_version": "1",
            "category": "documents"
          }
        }
      }
    }
  ],
  "next_cursor": ""
}

These are declared, validated template affordances, not a promise that a tool call will be permitted or that allocation will succeed. Create/Get session responses must separately report the effective execution capabilities of the actual binding. The two projections must use explicit, consistent semantics rather than overload model media capabilities.

Pin down Get-by-specific-revision syntax in the plan. Discovery must reflect the caller's authorized choices; define inventory revision and bounded pagination/cursor consistency so UI choices have explainable staleness. A disabled catalog, an enabled empty catalog, and an unavailable backend are distinct states. A caller who cannot enumerate a particular ID must not learn its existence from error details. Listing conveys availability at a point in time, not an irrevocable reservation. Creation reauthorizes the exact requested revision and binds against a consistent validated snapshot; deletion, deprecation, change, or eligibility loss between listing and binding fails closed with an actionable, non-disclosing error. No silent fallback to the default or a newer revision.

Build capability negotiation and operator enablement must stay separate. Names such as execution_templates_v1 (build/listener support) and execution_selection (enabled deployment capability) are illustrative. Clients gate on supported feature plus enabled capability, and old clients retain a defined default/no-FS path. If the protocol cannot reliably reject unknown JSON/protobuf fields on an old server, negotiate a new endpoint or contract version or require a feature-gated client. Never rely on a UI hiding an unsupported field as the only compatibility check. Create/Get session responses should report effective files and built-in Shell capability for that binding independently of existing media input capabilities (image, audio). Registered tool catalogs, the model-visible affordance, the server's response, and actual execution must agree. In particular, image contents and metadata do not grant tools, permission, or authority.

The initial default remains server-owned; later an authorized Project default could apply only when execution is omitted and its own contract has been approved. An explicit template outranks that default; explicit none attenuates it. Decide whether a Project default tracks a moving alias or pins an exact revision, and how a missing/unauthorized default fails. It must not silently revert to a more capable server default. This issue neither adds Project CRUD nor requires a repository to select a template.

Metadata is descriptive, never executable policy

A template can carry operator-managed, namespaced JSON metadata for clients and possibly bounded contextual display. The plan should cap bytes, nesting depth, and item count; require explicit payload versions; define unknown-namespace round-tripping; and specify strict validation and supported versions for namespaces with an installed consumer. Unknown namespaces remain bounded opaque data, not a reason to discover or download a consumer. Do not fetch schemas or plugins from the network when reading a template. Project metadata and template metadata have different owners and must not be silently combined.

Metadata cannot select an image, workspace root, provider, credential, permission rule, tool, MCP server, source repository, or command to execute. Keep secrets and secret-shaped configuration out of public responses. A consumer that interprets its owned namespace must validate it through a typed trusted host integration; unsupported metadata is inert, not an invitation to dynamically load handlers. A claimed “tool installed” label is an operator description, not provider attestation that a tool exists, is executable, or is authorized. If a model should see a description, the host explicitly chooses an allowed, size-bounded projection through the existing instruction assembly path, marks its provenance, fences untrusted text, and verifies the prompt-layer and tool-registration behavior in tests. No automatic instruction discovery from a workload image, repository contents, or arbitrary metadata.

Display-only edits need not create a new execution revision; still require a defined metadata concurrency token or ETag and a clear immutable-snapshot policy. Any field that changes allocation, authority, effective tools, limits, scheduling, or other execution behavior belongs in validated operator configuration and changes the execution revision. The acceptance plan must specify canonical hashing and version stability, including schema evolution, instead of equating a friendly label or an image tag with recipe identity.

Versioned allocations, continuity, and failure handling

A selected definition is not a reusable running instance. Each new session binding needs its own appropriate allocation and reference semantics; two sessions selecting the same template must not accidentally share writable state merely because they have the same caller or template ID. Successor/fork flows that intentionally share or isolate state need their own explicit authorization and reference protocol. Preserve existing exact reattachment and permission checks; do not promise a new remote-child capability in this issue.

Persist enough private provenance to identify the effective template definition and allocation for recovery across provider restarts, alongside the exact runtime ref. Keep old definitions accessible for retained allocations after a new version is published. Publishing a revision does not silently rewrite explicit selections: changing the default affects subsequent omitted/default selections, and an explicit old revision remains selectable only while its eligibility policy permits it. Deprecating an old version blocks new selections without automatically breaking existing sessions. Explicit revocation needs a separate policy for active runs, idle bindings, and resumed sessions, including when access is fenced and what administrator recovery requires. Pinning a recipe does not freeze or bypass current owner authorization, Deny/Ask governance, or an explicit revocation. Publishing a pinned image does not make mutable caches, network services, workspace contents, or external data reproducible. Confirm how old image artifacts and pull credentials remain available throughout a definition's supported lifetime.

Today a changed or disappeared profile digest makes the controller reject the existing allocation. Therefore a rename without durable version retention would strand sessions. The plan must specify historical-definition storage, restart loading, retention duration, administrator removal, and an actionable failure when a dependency is missing. It must never quietly create replacement storage for a lost PVC. Preserve the binding transaction: preflight and authorization before allocation where possible, idempotency by final binding ID, rollback only for definitively unpublished state, and reconciliation of ambiguous save/commit outcomes without deleting possibly published data. An unavailable backend, exhausted capacity, stale revision, failed provision, lease loss, and ambiguous commit need distinct operator diagnostics and safe caller-facing errors. Ending a session or deleting a template does not delete a retained workspace PVC by default; explicit administrative retirement/deletion rules still govern those resources. Avoid claiming the existing provider supplies a hostile-tenancy or microVM boundary.

Operator image preparation, as a proposed example

The intended administrator journey is:

  1. Prepare one shared execution-provider deployment with its identity, storage, isolation, networking, and capacity controls.
  2. Build task-specific images from the supported executor base, for example document-processing and media-processing images. Publish and verify their immutable digests.
  3. Configure one execution template per approved recipe, carrying that backend's image, storage, resource, and operation bounds. There is no second profile definition to create or synchronize.
  4. Set the deployment default and caller eligibility/exposure policy over those same templates. The server projects eligible templates through the authenticated API.
  5. Verify that Studio and mecatui discover the approved templates and that sessions receive the expected files/Shell capabilities. Run the expected utility through an actual bound session, then verify reconnect and independent-session workspace behavior.
  6. Publish a new recipe revision for an update, change the default deliberately, and retain the old recipe and artifacts for existing bindings until their explicit retirement policy permits removal.

Mecatl should publish a documented, versioned downstream base-image contract and a compatibility/qualification procedure, rather than require every operator to reverse-engineer the Dockerfile. That contract must cover executor protocol/version compatibility, supported OS/CPU architectures, required startup utilities and shell, non-root identity, filesystem/mount expectations, and fixed command environment. Operators remain responsible for the tools and libraries they add. The first slice need not support arbitrary third-party images without extending this base.

The Kubernetes route makes #2091's image goal concrete without putting package installation in the session API. An administrator prepares the shared service, runtime/storage classes, enforced network controls, mutually authenticated provider transport, caller authentication, registry pull secrets, and approved resource limits separately. They qualify the workload base image and publish a digest-pinned derivative for a task. The current workload Dockerfile sets UID 65532 and /workspace; the current controller Pod uses one executor container with a read-only root filesystem and writable workspace/tmp mounts. The command helper runs /bin/sh with a fixed PATH and environment. The release configuration publishes a ghcr.io/stacklok/mecatl/mecatl-execution-workload image path; this issue does not assert that any particular digest or platform artifact has been verified.

For example, a derived image can copy an already built, self-contained tool into a location on that fixed PATH. The following is a conceptual derivative, not a ready-to-deploy Dockerfile or a guarantee that this base digest exists on every target architecture:

ARG EXECUTION_BASE=ghcr.io/stacklok/mecatl/mecatl-execution-workload@sha256:<VERIFIED_BASE_DIGEST>
FROM ${EXECUTION_BASE}
COPY --chmod=0755 --chown=65532:65532 ./bin/document-tool /usr/local/bin/document-tool
USER 65532:65532

document-tool is an administrator-supplied binary in the build context. It must be built and qualified for the selected architecture and runtime; the image must preserve the executor protocol, /bin/sh, workspace ownership, startup behavior, and the fixed command environment. Do not assume apt, an arbitrary inherited PATH, runtime package installation, injected credentials, or a writable root filesystem. The administrator scans/signs and qualifies the derivative in CI or a controlled cluster, publishes the immutable digest, and configures it in a validated template. Authorization controls which users see that template; the selection response reports actual capabilities. A new build creates a new template revision while retained allocations continue to resolve the old one. The first slice can use the existing single-container model; init-container injection, sidecars, dynamic tool installation, and metadata-controlled security toggles are deferred and must not be advertised as guarantees.

Migration and interface review are part of the design

The word profile currently names two unrelated things. The plan should spell out protobuf/JSON field numbers, reservations, generated-client changes, and old-client behavior. Choose explicitly whether existing ""/"no-fs" session values temporarily map to default/none, or a versioned break rejects the old contract with upgrade guidance. Neither choice is made here. An unknown-field parse that treats a template request as the old default is unacceptable. Existing provider configuration may need an explicit one-time transform or clear upgrade instructions; choose one and test it. Persisted profile names/digests in allocations, CRDs, and Helm values, together with release-derived names and retained resources, need an exact migration/retention story. Do not automatically delete allocations or PVCs during a rename. A changed exported engine API triggers the engine compatibility process, API snapshots, and classified changelog; generated references must come from edited source contracts, not manual patches.

The acceptance contract must cover schedules, ACP, forks, clear/successor, and delegation. State whether each inherits the exact selection/reference with restrictions, selects a new allocation, or rejects the operation as unsupported. No operation may silently regain filesystem or Shell authority, change a selected revision, or infer a local root from a remote binding. In particular, the existing ADR 0291 decision forbids a general public placement selector. A new or superseding decision must explicitly permit bounded recipe IDs while preserving server-owned authorization/binding, absence of public paths/backend locators, and private exact environment references. Do not silently reinterpret or rewrite that frozen decision. If resource ownership, cleanup, or restart-state changes, update the maintained inventories in ADR 0027 through the approved process.

Behavioral exit criteria for the eventual acceptance plan

The plan should turn at least these situations into observable scenarios and proofs rather than relying on an API shape alone:

  1. A deployment with no catalog keeps its current omitted/default path; explicit none remains file-less without backend allocation even when a more capable default exists. A filesystem-only backend truthfully reports files without Shell. A fixed local deployment is not forced to implement template discovery.
  2. A caller sees two eligible revisions/choices and can select an exact approved revision. An unauthorized or nonexistent ID reveals no existence details. Stale list cursors and a revision/eligibility change between list and Bind fail predictably, without allocating under a different definition or leaking resources.
  3. Malformed, blank, multiply specified, unsupported, or old-server-unknown selections fail loudly. A compatible old client can still use its documented default/no-FS behavior under the chosen migration contract; no parser silently widens no-FS or an unknown template request into default.
  4. A display-metadata edit obeys bounds and concurrency policy without unexpectedly changing execution identity. Unknown metadata namespaces round-trip inertly; malicious prompt-like text cannot become trusted instructions, select roots/credentials/tools, or exceed projection limits. A validated behavior change creates a new execution revision.
  5. Files and Shell in Create/Get responses, registered tools, prompt instructions, and actual runner availability match the bound environment. Shell absence does not imply all code-execution paths are blocked. Deny and Ask retain their existing authority regardless of selection.
  6. Publishing a new revision preserves reattachment of an allocation from the prior revision across provider restart. Deprecation prevents new bindings only. An explicitly chosen revocation policy handles active and resumed runs without ambiguous privilege expansion; missing old definitions/images fail with recovery guidance rather than fabricating a fresh workspace.
  7. Capacity exhaustion, backend outage, failed provisioning, lost lease, failed session save, and ambiguous commit each leave reference and storage state recoverable. Definitively unpublished allocations roll back; possibly published ones are reconciled, not deleted on a guess. Two independent sessions selecting the same recipe cannot share writable state accidentally.
  8. Existing profile-bearing configuration and retained CRDs survive or are rejected under the explicit upgrade plan, with no hidden migration or PVC deletion. Schedules and successor flows obey documented inheritance/attenuation or fail unsupported. A real mecatui and Studio picker uses the authenticated catalog and reports disabled, empty, unavailable, stale, and capacity states rather than a mock list.
  9. A qualified derivative image runs in a controlled Kubernetes fixture with the expected protocol, user, mounts, and fixed command environment; a disallowed or incompatible derivative fails validation. The contract does not make paid live-cluster e2e a prerequisite for every host or claim production approval from an offline proof.

Prefer offline, isolated tests at the actual host/provider and wire boundaries using existing mockllm, memfs, memstore, and explicit adapter fixtures as appropriate. Keep test-owned UserModelDir even in tests with user-model features disabled. Separate controlled Kubernetes qualification for image/runtime behavior from the offline contract suite.

Questions the plan must settle

  • Which exact protobuf/HTTP union, endpoint names, feature identifiers, field reservations, and error mappings make old and new clients safe, including JSON unknown-field behavior and specific-revision Get syntax?
  • What trusted source determines per-caller template eligibility and pagination consistency? What is the default's precedence, and does a future Project default pin a revision or follow an alias?
  • Where are historical validated definitions retained across provider restart and Helm upgrades? How does the native provider route simultaneous old and new revisions: a changed per-binding provider contract, revision-scoped provider instances, or another explicit mechanism? Define capacity accounting across revisions so publishing a new version cannot accidentally multiply a template's quota or strand its old allocations. How long can old definitions be retained, when can an administrator remove them, and what policy governs active-run revocation versus new-selection deprecation?
  • Which fields enter canonical execution hashing? How is display metadata updated concurrently, and which metadata namespaces, if any, reach a model through an explicitly provenance-marked assembler?
  • Is the upgrade a one-time profile-config transform or an explicit breaking change? What happens to persisted profile/digest references, older clients, schedule requests, ACP requests, and each successor flow during rollout?
  • Which concrete filesystem-without-shell integration will establish that capabilities are truly independent, without forcing all backends to implement selection or arbitrary command runners?

Delivery boundary and related work

Start with an Architectural plan/interface PR and a new or superseding ADR that resolves these questions and the migration disposition. Human merge of that plan approves the contract, not the implementation or production status. Implement the host/provider selection and historical-definition preservation against that approved contract; then add the authorized catalog and client selection UX with truthful capability reporting, migration proofs, operator documentation, and required verification gates. The implementation PR remains subject to human review and merge. If implementation discovers contract drift, stop for an explicitly authorized amendment instead of silently expanding this issue's illustrative API.

Out of scope here: first-class Project CRUD and identity/trust migration (#2091); Project cloning, seed/sync, snapshot transfer, and credential handoff (#1383); a universal infrastructure CRD or dynamic backend plugin loader; image builds/installers at session creation; a template bundle of MCP servers, models, and permission grants; generalized elevated authority; automatic local-root inference; and any promise of remote-child or production isolation support beyond separately approved contracts. Related navigation work is #2058, while #1856 is not evidence of a live picker. The design target is an optional, operator-approved prepared environment that a session can select without making Projects or Kubernetes mandatory for every deployment.

Activity

  1. self-assigned this
    on Oct 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions