Skip to content

workspace: align v1alpha1 schema, enforce immutability, and materialize spec.setup - #580

Merged
YoyinZyc merged 2 commits into
google:mainfrom
YoyinZyc:feat/ws5-workspace-api
Nov 12, 2026
Merged

YoyinZyc merged 2 commits into
google:mainfrom
YoyinZyc:feat/ws5-workspace-api

Conversation

@YoyinZyc

@YoyinZyc YoyinZyc commented Nov 12, 2026 •

Copy link
Copy Markdown
Collaborator

Aligns the v1alpha1 Workspace API schema for snapshot-based workspace setup, makes Workspace immutable, and materializes spec.setup inside the sandbox.

  • API (pkg/apis/v1alpha1): Add shared Profile (common.proto), drop ResourcesSpec.requests, move build-time steps under WorkspaceSpec.setup (git with ref, files, skills, commands, gateway), add spec.profile and WorkspaceStatus, replace UpdateWorkspace with CreateWorkspace, and add limit/offset pagination to ListWorkspaces.
  • Validation & Server (internal/apivalidation, internal/server, internal/store): Validate Profile, spec.setup, and gateway references; make CreateWorkspace idempotent on identical specs and reject mutations with FailedPrecondition; reject unserved gateway bindings with Unimplemented.
  • Sandbox Setup (internal/workspace): Split git operations into git.go and execute spec.setup in order (git branch/tag/SHA checkout -> files -> skills -> commands).
  • CLI & Docs (cmd/ax, docs/manifests.md, test/e2e): Extract cmd/ax/workspace.go and update CLI commands, docs, examples, and E2E tests for the new schema.

There are some todo that will be handled in following pr after integration with task and gateway. The pr does not do warm snapshot or setup actor yet.

issue: #563

…ze spec.setup

- pkg/apis/v1alpha1: add shared Profile, drop ResourcesSpec.requests, group build-time steps under WorkspaceSpec.setup (git with ref, files, skills, commands, gateway), add spec.profile and WorkspaceStatus, replace UpdateWorkspace with CreateWorkspace, and add pagination to ListWorkspaces.
- internal/apivalidation: validate Workspace profile, setup (git, files, skills, commands), and gateway references.
- internal/store & internal/server: add pagination to ListWorkspaces, enforce idempotent/immutable CreateWorkspace, and reject unserved gateway bindings with codes.Unimplemented.
- internal/workspace: split git helpers into git.go and materialize spec.setup (git branch/tag/SHA checkout, inline files, skills dir, and sequential setup commands).
- cmd/ax, test/e2e, docs: extract cmd/ax/workspace.go and update CLI, manifests, and E2E tests for CreateWorkspace and spec.setup.

@yongruilin yongruilin 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.

Thanks for the PR! Looks good in general, left some comments.

Comment thread pkg/apis/v1alpha1/workspace.proto Resolved
Comment thread internal/server/workspace.go Resolved
Comment thread internal/server/workspace.go Resolved
Comment thread internal/workspace/setup.go Resolved

@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, this lines up well with the warm workspace plan. Two non-blocking notes: this breaks existing Workspace manifests (git/files move under setup), so worth a migration line in the next release notes. And setup commands have no timeout, so a hanging one leaves the workspace never ready, maybe a per-command timeout in a follow-up?

- pkg/apis/v1alpha1: drop MCPServer.gateway (egress and credential injection are configured on the Task's Gateway).
- internal/server: also reject spec.profile with codes.Unimplemented until snapshot pre-warming is wired, and simplify the TODO comment.
- internal/workspace: apply a 5m per-command timeout to spec.setup.commands (killing the command's process group on timeout) so hung commands cannot leave a workspace unready indefinitely.
- runner: return SetupWorkspace errors directly from Run instead of starting spec.command in a failed workspace.
@YoyinZyc

Copy link
Copy Markdown
Collaborator Author

Nice, this lines up well with the warm workspace plan. Two non-blocking notes: this breaks existing Workspace manifests (git/files move under setup), so worth a migration line in the next release notes. And setup commands have no timeout, so a hanging one leaves the workspace never ready, maybe a per-command timeout in a follow-up?

sure, I added the timeout for setup command.

@YoyinZyc
YoyinZyc merged commit dd66b7f into google:main Nov 12, 2026
10 checks passed
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.

3 participants