Repository navigation
Reject a Task whose bound Workspace does not exist - #461
Merged
Merged
Conversation
Reject missing workspace references before a Task is persisted or provisioned. Report backend lookup failures and reuse the resolved workspaces in binding order.
Main now binds at most one Workspace per Task (spec.workspace) and the server takes a concrete TaskReconciler, so the earlier change no longer applied. CreateTask now resolves the one bound Workspace before saving: a missing Workspace fails with FailedPrecondition and a store error with Internal, and nothing is saved or provisioned in either case. Replace the separate admission test with a table-driven test in server_test.go that runs against the in-process Substrate fake and checks that an accepted Task's template carries AX_WORKSPACE_YAML. examples/task.yaml listed its Task before its Workspace, which `ax apply` would now reject, so list the Task last. Document the ordering requirement in docs/manifests.md.
erain
marked this pull request as ready for review
October 29, 2026 21:49
rakyll
approved these changes
Oct 29, 2026
Merged
Member
|
We should be able to fix the merge conflicts and merge this, right? |
Main replaced Reconcile with explicit Suspend and Resume, so CreateTask now passes the Workspace it resolved before saving to Suspend instead of fetching it again. Main also removed examples/task.yaml, so the reordering of that example is dropped. The remaining examples already list the Workspace before the Task that binds it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Creating a Task that binds a Workspace that does not exist now fails with
FailedPreconditionnaming the Workspace and atespace, and nothing is saved or provisioned. Before this change,CreateTasklooked the Workspace up after saving the Task and dropped any lookup error. Because Tasks are immutable, a Task created before its Workspace kept an empty/workspaceuntil it was deleted and applied again. A store error during the lookup now fails withInternal.Changes:
internal/server/server.go:CreateTaskresolvesspec.workspacebefore saving and passes the resolved Workspace toSuspend.SuspendTaskandResumeTaskare unchanged.docs/manifests.md: documents that the bound Workspace must exist first, and thatax applycreates documents in file order.The examples on
main(examples/claude-code/task.yaml, the README,demo.sh, and the E2E manifests) already list the Workspace before the Task that binds it.examples/task.yaml, which this PR previously reordered, was removed onmain, so #460 no longer applies.Refs #450. This PR does not reorder documents in
ax apply; that remains open in the issue.Testing (Go 1.27.1, linux/amd64):
TestCreateTask_RequiresBoundWorkspace(table-driven, real memory store, in-process Substrate fake). It covers a missing Workspace, a Workspace in another atespace, a wrappedErrNotFound, a store error, a present Workspace in the default and a named atespace, and a Task with no binding. Rejected Tasks must leave no stored record and no actor. Accepted Tasks with a binding must getAX_WORKSPACE_YAMLin their actor template.main(explicitSuspend/Resumefrom controller: replace Reconcile with explicit Suspend and Resume #536):go mod tidy && git diff --exit-code go.mod go.sum,go build ./cmd/ax ./cmd/ax-server ./cmd/ax-task-runner,go test -count=1 ./...,go vet ./...,gofmt -l .all pass. Postgres and E2E tiers were not run (no store or E2E changes).Prepared with an AI coding assistant; I reviewed and tested every change.