Repository navigation
server: simplify CreateTask retries and model handlers - #748
Merged
Merged
Conversation
yongruilin
reviewed
Nov 24, 2026
yongruilin
approved these changes
Nov 24, 2026
Fixes #744. Fixes #718. - CreateTask no longer compares the incoming spec on a Queued retry: the retry runs the stored task, since its actor may already exist from the stored spec. - UpdateModel and DeleteModel no longer take a lock: a Model has no Substrate side effects to serialize. - DeleteModel no longer reads the model first: the store's DeleteModel returns ErrNotFound for a missing model.
rakyll
force-pushed
the
taskSpecMatchesExisting
branch
from
November 24, 2026 21:01
b20abfa to
fe66512
Compare
Keep rejecting CreateTask retries of a Queued task whose incoming spec differs from the stored spec, rather than silently running the stored spec. Removing the retry path altogether belongs with #698.
rakyll
added a commit
that referenced
this pull request
Nov 24, 2026
Part of #749: the bugs and the duplication. The small things are left for a follow-up. Stacked on #748; once it merges, this PR retargets to `main`. ## Bugs - `-template` and `-template-atespace` are removed: `TaskManager` stored them but never read them. This also removes them from `NewTaskManager`, the `deploy/ax-server.yaml` args, the namespace rewrite in `deploy/embed.go`, and `test/e2e/manifests/ax-server.yaml`. A new `ax-server` started with an old manifest that still passes `--template` fails with "flag provided but not defined"; manifests rendered by the matching CLI are fine. - `UpdateModel` treats only `store.ErrNotFound` as a new model. Before, any store error gave an existing model a new uid and createTime. `TestUpdateModel_StoreError` covers it. - `recordFailure` logs a failed status write instead of ignoring it. ## Duplication - `lockStoredTask` replaces the lock, load, and NotFound/Internal mapping copied into `DeleteTask`, `SuspendTask`, and `ResumeTask`. - `substrateError` maps a Substrate error to `Unavailable` (transient) or `Internal` for `SuspendTask`, `recordFailure`, and `DeleteWorkspace`. `deleteTask` (passes Substrate's gRPC codes through) and `prepareWorkspace` (`FailedPrecondition` with the setup error) keep their own mapping. - `defaultMetadata(meta, prev)` takes the stored metadata instead of a callback. - `atespaceOrDefault` replaces the repeated defaulting, including the three hard-coded `"default"` in `gateway.go`. - The List handlers read the request with nil-safe getters. `DeleteGateway` still reads the gateway before deleting it; the store is unchanged. `make verify`, `go build`, and `go test ./...` pass locally. The E2E and local install tiers were not run.
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.
Fixes #744. Fixes #718.
CreateTaskdropstaskSpecMatchesExisting. A retry of a Queued task with no template runs the stored task and ignores the incoming spec, because the actor may already exist from the stored spec (TaskManager.Suspendrestores the previous status whenSuspendActorfails). Re-applying a Queued task with a different spec used to fail withFailedPrecondition; it now retries the stored task. Already provisioned tasks are still rejected as immutable.UpdateModelandDeleteModelno longer take themodellock. A Model has no Substrate side effects, andUpdateModelread the existing metadata before taking the lock anyway.DeleteModelno longer reads the model before deleting it. The store'sDeleteModel(memory and Postgres) now returnsstore.ErrNotFoundwhen nothing is deleted, which the handler maps toNotFound. Deleting tasks, workspaces and gateways is unchanged.TestServer_TransientSubstrateUnavailableRecoverychecks that a retry keeps the stored spec, and a newTestDeleteModelin both store packages covers deleting a missing model.make verify,go build,go test ./...and the Postgres store tests (postgres:17-alpine) pass locally.