Enable Task status updates via POST requests#174
Merged
declan-scale merged 7 commits intomainfrom Mar 30, 2026
Merged
Conversation
ebd3487 to
58d2723
Compare
PUT /tasks/{id_or_name}
Collaborator
|
any chance we can get some screenshots or video of behavior in UI? |
Collaborator
|
are these hittable from within the code? let's say from acp file or workflow file to be able to programitically stop running a task in the same way that we do with temporal? |
Collaborator
|
ideally we could do adk.task. etc etc same way we do adk.create message and all that |
danielmillerp
approved these changes
Mar 26, 2026
Collaborator
danielmillerp
left a comment
There was a problem hiding this comment.
changes in here seem fine ! mostly just other questions about expanding surface area and seeing behavior !
Collaborator
Author
af1db68 to
1556e8d
Compare
Collaborator
7d2a922 to
a27d233
Compare
a27d233 to
bea3438
Compare
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.


Updates
resolves AGX1-153
Greptile Summary
Adds dedicated POST endpoints to transition running tasks to terminal states (completed, failed, canceled, terminated, timed_out), replacing the need to use the generic PUT update endpoint for status changes. The backend uses an atomic
UPDATE ... WHERE status = expected_statuspattern to prevent race conditions on concurrent transitions, and publishestask_updatedstream events so the UI receives real-time updates. The frontend disables the prompt input when a task reaches a terminal state and updates the message pairing logic to render agent-only message groups without a preceding user message./{task_id}/complete,/fail,/cancel,/terminate,/timeout) with optional reason bodyvarsIgnorePatternfix from exact_to prefix^_Confidence Score: 4/5
This PR is safe to merge — the atomic update pattern is sound, test coverage is thorough, and the UI changes are well-scoped.
Score of 4 reflects a well-implemented feature with proper concurrency handling, comprehensive tests, and clean layer separation. Minor deduction for the pre-existing non-atomic update_mutable_fields_on_task method that now stands out as inconsistent with the new atomic pattern.
agentex/src/domain/use_cases/tasks_use_case.py — the existing update_mutable_fields_on_task method still uses a non-atomic read-then-write pattern, which contrasts with the new atomic transition approach.
Important Files Changed
Sequence Diagram
sequenceDiagram participant Client as Client (UI/API) participant Router as FastAPI Route participant UseCase as TasksUseCase participant Service as AgentTaskService participant Repo as TaskRepository participant DB as PostgreSQL participant Redis as Redis Stream Client->>Router: POST /tasks/{id}/complete Router->>UseCase: complete_task(id, reason) UseCase->>Service: get_task(id) Service->>Repo: get(id) Repo->>DB: SELECT * FROM tasks WHERE id = ? DB-->>Repo: TaskORM Repo-->>Service: TaskEntity Service-->>UseCase: TaskEntity (status=RUNNING) UseCase->>UseCase: Validate status == RUNNING UseCase->>Service: transition_task_status(id, RUNNING, COMPLETED, reason) Service->>Repo: transition_status(id, RUNNING, COMPLETED, reason) Repo->>DB: UPDATE tasks SET status='COMPLETED' WHERE id=? AND status='RUNNING' DB-->>Repo: rowcount=1 Repo->>DB: SELECT * FROM tasks WHERE id = ? DB-->>Repo: Updated TaskORM Repo-->>Service: TaskEntity (COMPLETED) Service->>Redis: publish task_updated event Redis-->>Service: OK Service-->>UseCase: TaskEntity (COMPLETED) UseCase-->>Router: TaskEntity Router-->>Client: 200 Task (COMPLETED)Prompt To Fix All With AI
Reviews (8): Last reviewed commit: "Add task status type to FE, null guard" | Re-trigger Greptile