Repository navigation
Server lifecycle suspend resume - #639
Conversation
| // common path. | ||
| func (r *TaskReconciler) IsMemoryFidelityTemplate(ctx context.Context, atespace, templateName string) bool { | ||
| if templateName == "" || strings.HasPrefix(templateName, "ax-") { | ||
| return DefaultProfileSnapshotFidelity == ateapipb.SnapshotFidelity_SNAPSHOT_FIDELITY_MEMORY |
There was a problem hiding this comment.
is there guarantee that ax- is reserved for ax created template?
There was a problem hiding this comment.
Removed the ax- prefix shortcut and now query GetActorTemplate directly whenever a template is set.
| return nil, status.Errorf(codes.Internal, "updating task before suspend: %v", err) | ||
| } | ||
|
|
||
| if err := s.reconciler.Suspend(ctx, task, s.fetchWorkspace(ctx, atespace, task), s.fetchGateway(ctx, atespace, task)); err != nil { |
There was a problem hiding this comment.
Suspend happens after committing clearing the ActiveRunID and etc, could be problematic if Suspend fails.
There was a problem hiding this comment.
Updated, pre-suspend now only sets Runnable = false, and ActiveRunID / runner token state are only cleared after reconciler.Suspend succeeds.
115be51 to
eacd4c8
Compare
…te E2E template check
…ace, and E2E expectations
mayawang
left a comment
There was a problem hiding this comment.
Nice work Simran, the token reset and terminal-state guards look great, and awesome to see E2E green.
Before merge: shouldDropPrivileges() (runner/pull.go:540) now skips the uid 1000 drop when CAP_SETUID/CAP_SETGID are missing, so the agent runs as root and can read /var/lib/ax/runner_token and report its own completion. Can we keep the default failing closed, and only allow root via an explicit DropPrivileges=false? If Kind E2E needed the fallback because the pod drops those caps, either adding them in the template or setting DropPrivileges=false just for E2E works for me.
Non-blocking, fine as follow-up issues:
- SuspendTask treats a failed template lookup as non-MEMORY and clears the active run, so a transient Substrate error during suspend kills an in-flight MEMORY task on resume. Returning Unavailable there would be safer.
- This turns on
profile.ateTemplatewith cross-atespace refs. Let's limit it to the task's own atespace for now, since cross-atespace sharing isn't settled on the Substrate side yet.
Happy to approve as soon as the privilege check is sorted.
mayawang
left a comment
There was a problem hiding this comment.
Thanks Simran, LGTM! Privilege drop fails closed again and the suspend path looks good. Please file the cross-atespace ateTemplate follow-up as an issue so it doesn't get lost
|
Heads up, PureImageLauncher is failing on e297e49 (task ends FAILED). Let's get that green before merging |
|
E2E is green now and filed #650 to follow-up. |
Summary
internal/controller/reconciler.go):ax-*profile templates (ensureProfileTemplate), look up pre-warmed workspace snapshot tags (WorkspaceManager.EnsureSnapshotTag), create actors viaEnsureActorFromTag, and markWorkspaceReady=Truewhen seeded.substrate.RunnerEgressRuleinbindGatewayso task actors can reach:8081even without a userGateway.IsMemoryFidelityTemplatehelper.internal/server/server.go,internal/server/task_applier.go)::8080CreateTask,SuspendTask,ResumeTask, andDeleteTaskontostore.TaskApplier(withTaskApplierForStoreadapter forstore.Storetest doubles).spec.profile.ateActorTemplate(keepspec.retryrejected asUnimplemented).row.ActorUIDinfinalizeReconciledRowand resetRunnerTokenHash/RunnerTokenConfirmed/ClaimNonceonActorUIDchange.ResumeTask: rejectlifecycle.IsExecutionTerminaltasks, setRunnable=truebeforeResumeActor, and preserve concurrent:8081terminal completions.SuspendTask: rejectlifecycle.IsExecutionTerminaltasks, setRunnable=false, clearActiveRunIDand runner token state on non-MEMORYfidelity templates (preserving them onMEMORYtemplates, and rolling back ifSuspendActorfails while the actor is still running).cmd/ax-server/main.go):RunnerEndpoint,RunnerAudience,GatewayStore,WorkspaceManager, andTaskApplier.Test plan
go test -count=1 ./...go build ./cmd/ax ./cmd/ax-server ./cmd/ax-task-runnergolangci-lint run ./...(0 issues)