fix(task-create): handle WorkflowAlreadyStartedError gracefully - #489
Open
alvinkam2001 wants to merge 1 commit into
Open
fix(task-create): handle WorkflowAlreadyStartedError gracefully#489alvinkam2001 wants to merge 1 commit into
alvinkam2001 wants to merge 1 commit into
Conversation
alvinkam2001
force-pushed
the
akam/task-create-idempotency
branch
from
August 7, 2026 00:33
dbfcca6 to
58c27ea
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.
Summary
Makes
task/createidempotent in the Temporal ACP path. Duplicate submits for the same task ID (e.g. load-balanced agentex-agent replicas racing on the same notification) no longer surfaceWorkflowAlreadyStartedError, Temporal returns the existing workflow handle instead.Change
TemporalTaskService.submit_tasknow passesid_conflict_policy=WorkflowIDConflictPolicy.USE_EXISTING.TemporalClient.start_workflowaccepts anid_conflict_policyparam (defaults toUNSPECIFIED, preserving current behavior for any other caller).Why
WorkflowIDReusePolicy.ALLOW_DUPLICATE(already set) only governs reuse after a run closes — it doesn't help when a run is currently open. Workflows are mainly just noise as the workflow still runsTest plan
tests/lib/core/services/test_temporal_task_service.py:submit_taskpassesUSE_EXISTINGto the clientTemporalClient.start_workflowforwardsid_conflict_policywhen setTemporalClient.start_workflowdefaults toUNSPECIFIED(backwards-compat)TemporalTaskServicetests still passtask/createcalls with the same task ID, confirm both return 200 with the same workflow ID and no error logGreptile Summary
The PR makes Temporal-backed task creation idempotent while a workflow with the same task ID remains open.
USE_EXISTINGwhen submitting tasks.Confidence Score: 5/5
The PR appears safe to merge.
No blocking failure remains.
Important Files Changed
Reviews (2): Last reviewed commit: "handle same workflow task/create gracefu..." | Re-trigger Greptile