Skip to content

examples/task.yaml gives the task an empty workspace because the Task is listed before its Workspace #450

Done

Description

@mastersingh24

examples/task.yaml lists the Task before the Workspace it uses. ax apply creates the documents in file order, so the Task is created and reconciled before its Workspace exists. fetchWorkspaces quietly skips references it can't find (internal/server/server.go:364), so the actor template is built without AX_WORKSPACES_YAML.

The runner then sets up an empty /workspace, writes its "initialized" marker, and reports ready. The Workspace created a moment later is never used. Because tasks are immutable, the only way out is to delete the task and apply again with the documents in the other order.

Example, using the same layout as the shipped example (a Task followed by a Workspace with a git entry and a files entry):

$ ax apply -f task.yaml
task.ax.io/git-task created
workspace.ax.io/git-workspace created
$ ax resume task git-task
$ ax describe task git-task
...
  Ready           True    TaskRunning    Task is running and its workspace is ready
  WorkspaceReady  True    SetupComplete  Workspace setup completed at 10.59.128.81
$ ax ssh git-task -- sh -c 'ls -A /workspace; curl -s $AX_METADATA_URL/metadata/v1alpha1/ax/workspaces'
command.log
workspace metadata not available

There's no clone and no file from files, yet the task says the workspace is ready. With the Workspace listed first, the same spec gets its files written and a clone attempted (which then hits #427, but that's a separate problem).

Suggested fix

  • Reject CreateTask when a referenced Workspace doesn't exist (FailedPrecondition naming the missing workspace), so the mistake is loud instead of silent.
  • Have ax apply create Workspaces and Models before Tasks, whatever their order in the file.
  • Put the Workspace first in examples/task.yaml and in the examples in docs/manifests.md.

Activity

  1. self-assigned this
    on Oct 13, 2026
  2. erain commented on Oct 13, 2026

    @erain
    Collaborator

    I am taking this on in two focused steps: first order the shipped example so its Workspace exists before its Task, then reject missing workspace references before saving or provisioning a Task. I will include baseline regression failures, passing controls, and captured CLI/API/runtime evidence. The general suggestion to reorder arbitrary multi-document input in ax apply will remain separately identified.

  3. rakyll commented on Nov 25, 2026

    @rakyll
    Member

    Fixed: CreateTask rejects a Task whose Workspace doesn't exist (#461); examples/task.yaml is gone.

    We are closing this as part of a cleanup after the significant changes in v0.4.0, because it is probably obsolete or out of scope now. If you think this is a mistake, please reopen it (or leave a comment if you can't reopen it).

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