Repository navigation
store, server: delete TaskApplier - #719
Merged
Merged
Conversation
Task handlers in internal/server/server.go already serialize mutations per task under s.locker.Lock. Remove the redundant TaskApplier write path and have server.go persist task state directly through store.Store helpers. - Remove TaskApplier, TaskVersion, TaskKey, ApplyFunc, DeleteTaskVersion, PrepareTaskVersionForApply, and OverlayTaskGeneration from internal/store, internal/store/memory, and internal/store/postgres. - Move store.StoredStatus into internal/store/store.go (with unit tests in internal/store/store_test.go). - Drop the TASK_STATE_UNSPECIFIED -> TASK_STATE_QUEUED coercion in SaveTask (memory and postgres) so saving after clearing metadata.delete_time preserves TASK_STATE_UNSPECIFIED. - Remove the unused tasks.generation column migration from internal/store/postgres/schema.sql. - Remove internal/server/task_applier.go, server.Options.TaskApplier, and its wiring in cmd/ax-server/main.go; update task handlers to use saveTask, updateTask, getStoredTask, and s.store.DeleteTask directly. - Update AGENTS.md and DESIGN.md. Fixes #714
yongruilin
reviewed
Nov 23, 2026
yongruilin
left a comment
Collaborator
There was a problem hiding this comment.
Nothing really blocking, feel free to either fix it now or follow up before 1.0 .
- Drop TaskStatus.generation from the API; nothing reads it. - Move StoredStatus into internal/server as the unexported storedStatus, next to saveTask and updateTask. - Postgres SaveTask keeps saved_at when replacing a task, so setting or clearing delete_time no longer moves the task to the top of 'ax get tasks'. Workspaces, gateways, and models are unchanged.
yongruilin
approved these changes
Nov 23, 2026
JeffLuoo
added a commit
to JeffLuoo/ax
that referenced
this pull request
Nov 24, 2026
Cost attribution and task timelines need a record of each change of task phase that joins with the actor events of Agent Substrate. The first version of this change wrapped store.TaskApplier, which google#719 deleted. Now the task write helpers in internal/server emit the event. saveTask, updateTask, and deleteTask read the stored task before they write it. The caller holds the per-task lock, so that read gives the previous phase. After a successful write that changes the phase, the helper emits the event through the new telemetry.EmitAt, with the time at which the write finished. The event carries ax.task.name, ate.atespace, ax.task.id, ax.task.phase, and ax.task.previous_phase. The store does not hold the actor UID, so the helper reads ate.actor.uid from Substrate when the phase becomes Provisioned. Main has no row generation and no TaskResult, so the event has no generation, outcome, or exit code. A failed write, or a write that keeps the phase, emits nothing.
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.
AX is a simple CRUD system over Agent Substrate: Task/Actor provisioning and lifecycle are handled imperatively (under the per-task lock, returning Substrate failures directly to the client), while task execution is declarative. Because of that, we do not need a transactional
TaskApplierstate machine alongsidestore.Store.This PR removes
TaskApplierand hasinternal/server/server.goread and write tasks directly throughstore.Storeunders.locker.Lock.Summary
TaskApplier,TaskVersion,TaskKey,ApplyFunc,DeleteTaskVersion,PrepareTaskVersionForApply, andOverlayTaskGeneration(internal/store/task_apply.go,internal/store/task_version_normalize.go,internal/store/task_apply_test.go,internal/store/memory/task_apply.go,internal/store/postgres/task_apply.go) and removedTestTaskApplier*.store.StoredStatusintointernal/store/store.gowith unit tests ininternal/store/store_test.go.MemoryStore.tasksback tomap[string]*v1alpha1.Taskand dropped theTASK_STATE_UNSPECIFIED -> TASK_STATE_QUEUEDcoercion inSaveTask(memory and postgres) so saving after clearingmetadata.delete_timepreservesTASK_STATE_UNSPECIFIED.tasks.generationcolumn migration frominternal/store/postgres/schema.sql.internal/server/task_applier.go,server.Options.TaskApplier, and its wiring incmd/ax-server/main.go.CreateTask,DeleteTask,SuspendTask,ResumeTask,clearStoredTaskState,recordFailure, anddeleteTaskto write throughsaveTask,updateTask,getStoredTask, ands.store.DeleteTask.failApplyTaskApplierwith astore.Storewrapper ininternal/server/server_test.goand addedTestServer_ResumeAfterFailedDeleteClearsDeleteTime.AGENTS.mdandDESIGN.md.Verification
make verify(0 issues, no diff)go build ./cmd/ax ./cmd/ax-server ./cmd/ax-runnergo test ./...go test -race -count=1 ./internal/store/... ./internal/server/... ./cmd/ax-server/...internal/store/postgresrun in CI.Fixes #714