Skip to content

Don't split Workspace into its own actor; apply workspace config when the task starts #696

Open

Description

@rakyll

Summary

A Workspace should not become its own Substrate actor with its own lifecycle that tasks attach to. A workspace is metadata the runner uses when a task starts. Users who want a long-lived environment to branch from can run a task and fork other tasks from it.

What a Workspace is for

A Workspace describes what a task needs to start, for example:

  • which MCP servers to fetch from a registry
  • which skills to download
  • which repositories to clone, which inline files to write, and which setup commands to run

All of this is task startup configuration. ax-runner should read and apply it when it starts the task, inside that task's own actor. A separate actor for the workspace isn't needed.

Workspace metadata is time sensitive

What a workspace resolves to depends on when it is resolved:

  • Registries change. The MCP servers a registry returns, their endpoints, and their versions can change at any time. If you resolve them once when the workspace is created, every task that starts later gets whatever was current back then.
  • Skills and repositories move. A skill's latest version and a branch's head commit change all the time. If setup is baked in ahead of time, tasks run against stale content without anyone noticing.
  • Policy can change. If an admin removes an MCP server from the registry or revokes a skill, the change should apply to the next task that starts. It shouldn't wait for someone to rebuild the workspace.

Because of this, the runner should resolve workspace metadata when each task starts, so every task gets the current state. A separate workspace actor would freeze the metadata at the time the workspace was set up and copy that frozen state into every task that uses it. If a user really does want a frozen setup, they can say so explicitly by forking from a tagged task. That way it's a choice the user makes, not the default.

Why not a separate actor

  • Two lifecycles. A workspace actor has to be provisioned, suspended, resumed, garbage-collected and authorized separately from the tasks that use it. That's more state in the reconciler and the store, and more ways for the two to get out of sync. ax suspend of a large workspace can lose the workspace while every command reports success #453 already shows how hard it is to keep workspace state correct inside one task.
  • Substrate already covers the use cases. Shared state between tasks is better served by primitives that already exist or are planned:
    • Shared volumes for data several tasks read or write at the same time.
    • Tagging and forking for "set up once, branch many times": start a task, let its setup finish, tag it, and fork new tasks from that point. You get the pre-warmed behavior without a new resource type.
  • Simpler mental model. One task, one actor. The workspace is just the startup configuration of that actor.

Proposal

  • Keep Workspace as a declarative config resource that tasks reference. Don't back it with an actor.
  • ax-runner resolves and applies workspace config (MCP servers, skills, clones, files, commands) every time a task starts, against the current state of registries and sources.
  • Document forking from a tagged task as the way to reuse an expensive setup, and shared volumes as the way to share data between tasks that are running at the same time.
  • Remove or drop any existing or planned code paths that give a workspace its own actor.

Related

cc @yongruilin @YoyinZyc thoughts?

Activity

  1. added this to the v0.4.0 milestone on Nov 21, 2026
  2. yongruilin commented on Nov 22, 2026

    @yongruilin
    Collaborator

    Makes sense to me. I think it feels cleaner and keeps the lifecycle much simpler

    Two things:

    1. spec.setup.gateway was there so setup could clone a private repo without giving the running agent those creds. If setup runs in the Task's actor, the Task's Gateway has to carry that access for the whole run — do we want this separation? Maybe we can let a forked task switch to a narrower spec.gateway to keep this credential separation?
    2. ax fork is not there yet.
  3. modified the milestones: v0.4.0, v0.5.0 on Nov 23, 2026
  4. YoyinZyc commented on Nov 23, 2026

    @YoyinZyc
    Collaborator

    Off the top of my head, some trade-off:

    Pros:

    1. Agree the mental model is simpler. The concept of Task aligns with Actor. The snapshot, tag, profile are kind of the propagation of Task
    2. No more snapshot management. With the current Workspace, we have to manage or refresh the workspace snapshot to avoid its staleness.

    Cons:

    1. As Yongrui mentioned, the task itself now needs to be granted setup privileges. Not sure if we could grant those tasks some time-sensitive permission or just one-time permission to restrict the setup privileges as much as possible.

    Open questions:

    1. Do we want to do lazy snapshot cache? If two tasks under same workspace share the same profiles, do we want the later task starts from the warmed snapshot even if it does not fork from the previous task? Or just restrict the prewarm to fork?
    2. Seems that the only api change is to remove the workspace status. Other fields can still live under workspace resource but are resolved along with task lifecycle?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions