Repository navigation
Todo
Description
Findings from a review of internal/server and cmd/ax-server.
Bugs
-templateand-template-atespaceare dead:TaskManagerstoresdefaultTemplate/defaultTemplateAtespace(internal/controller/task.go) but never reads them. Remove the flags, the startup log field, theNewTaskManagerparameters, and the args indeploy/ax-server.yaml,deploy/embed.go, andtest/e2e/manifests/ax-server.yaml.UpdateModeltreats any store error in itsdefaultMetadatacallback as "not found", so a transient read error on an existing model assigns it a new uid and createTime. Onlystore.ErrNotFoundshould mean create; other errors should returnInternal.recordFailureignores theupdateTaskerror (_ = s.updateTask(...)), so a failed write can leave a stale stored state without a log line.
Duplication
- The four List handlers unpack the request by hand;
pageStart(req.GetAtespace(), req.GetPageSize(), req.GetPageToken())is enough because proto getters are nil-safe. DeleteTask,SuspendTask, andResumeTaskrepeat the same lock,getStoredTask, and NotFound/Internal mapping; alockStoredTaskhelper would remove it.- Mapping Substrate errors to
Unavailable(transient) orInternalis written out inSuspendTask,recordFailure,DeleteWorkspace, andprepareWorkspace, with another variant indeleteTask. defaultMetadatatakes a callback thatsaveGatewayignores the arguments of,CreateWorkspacepasses as nil, andUpdateModeluses to hide the bug above. Pass the previous*ObjectMetadirectly.DeleteGatewayreads the gateway before deleting it; let the store'sDeleteGatewayreturnstore.ErrNotFound, asDeleteModelnow does. Keep its lock, which orders deletes againstsaveGateway's check-then-create.
Small things
gateway.gohard-codes"default"three times instead ofv1alpha1.DefaultAtespace.- Redundant defaulting:
clearStoredTaskStatere-defaults the atespace,DeleteTaskchecks for nil metadata,SuspendTask/ResumeTasknil-checktask.Status(the task manager already does), andCreateTaskhandles a niltask.Specafter validation. getStoredTaskis a one-line wrapper meant to keep handlers offs.storefor tasks, butdeleteTask,listTasks, andCreateTaskcall the store directly anyway. Enforce the rule or drop the wrapper.ListModelsandListGatewaysload every row and slice in memory, while tasks and workspaces page in the store.cmd/ax-server: the APIhttp.Serverhas noReadHeaderTimeout(the metrics server does);err != http.ErrServerClosedshould useerrors.Is; theADDRenv var is unprefixed unlikeAX_STORE/AX_RUNNER_VOLUME_IMAGEand missing from the-addrhelp;os.Exitin the serve goroutines skips the deferred telemetry flush.- Comments: the doubled
// --- gRPC AXServer implementation ---/// --- Tasks ---header;SuspendTaskdoes not userecordFailurelikeResumeTaskdoes, which is probably intended (a failed suspend should not fail the task) but should be stated.
To investigate
DeleteWorkspacedoes not check for tasks that still bind the Workspace, andfetchWorkspaceturns NotFound into nil, so a task relying on its Workspace's profile would resume with an empty profile. Not verified what template resolution does then.
Metadata
Metadata
Assignees
Labels
No labels
Activity
server: fix bugs and remove duplication from #749
server: fix bugs and remove duplication from #749 (#750)