fix(task-create): handle WorkflowAlreadyStartedError gracefully - #488
Closed
alvinkam2001 wants to merge 3 commits into
Closed
fix(task-create): handle WorkflowAlreadyStartedError gracefully#488alvinkam2001 wants to merge 3 commits into
alvinkam2001 wants to merge 3 commits into
Conversation
#485) Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
|
This PR is targeting The
See |
| id=task.id, | ||
| task_queue=self._env_vars.WORKFLOW_TASK_QUEUE, | ||
| execution_timeout=execution_timeout, | ||
| id_conflict_policy=WorkflowIDConflictPolicy.USE_EXISTING, |
There was a problem hiding this comment.
Conflicting task inputs are discarded
When a second task/create request resolves to an active task ID but supplies changed agent, params, or timeout values, USE_EXISTING reports success without delivering the new CreateTaskParams to the workflow, causing the running task to retain its original inputs despite the task/create contract allowing supplied params to overwrite existing params.
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/agentex/lib/core/temporal/services/temporal_task_service.py
Line: 59
Comment:
**Conflicting task inputs are discarded**
When a second `task/create` request resolves to an active task ID but supplies changed agent, params, or timeout values, `USE_EXISTING` reports success without delivering the new `CreateTaskParams` to the workflow, causing the running task to retain its original inputs despite the task/create contract allowing supplied params to overwrite existing params.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.
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.
Greptile Summary
This PR makes duplicate Temporal task starts return the existing workflow and adds default OpenTelemetry context propagation across Temporal clients and workers.
USE_EXISTINGfor task submission.Confidence Score: 4/5
The PR should not merge until duplicate task IDs with changed inputs are rejected or reconciled instead of being reported as successful while silently retaining the old workflow inputs.
USE_EXISTINGhandles exact retries, but it also converts conflicting submissions with updated agent, params, or timeout values into apparent successes even though Temporal does not apply those new workflow-start arguments.Files Needing Attention: src/agentex/lib/core/temporal/services/temporal_task_service.py
Important Files Changed
USE_EXISTING, but silently discards changed inputs when a duplicate ID refers to an active workflow.Sequence Diagram
sequenceDiagram participant Caller participant ACP as TemporalACP participant Service as TemporalTaskService participant Temporal Caller->>ACP: task/create(task ID, params) ACP->>Service: submit_task(agent, task, params) Service->>Temporal: start_workflow(id, inputs, USE_EXISTING) alt No active workflow Temporal-->>Service: New workflow handle else Active workflow with same ID Temporal-->>Service: Existing workflow handle Note over Service,Temporal: New inputs are not delivered end Service-->>ACP: Task IDPrompt To Fix All With AI
Reviews (1): Last reviewed commit: "handle same workflow task/create gracefu..." | Re-trigger Greptile