fix(tasks): make duplicate sourceRef creates idempotent#749
Merged
Conversation
lilyshen0722
force-pushed
the
codex/697-task-source-ref-idempotency
branch
from
July 24, 2026 17:24
a0641f4 to
7e91adf
Compare
lilyshen0722
force-pushed
the
codex/697-task-source-ref-idempotency
branch
from
July 24, 2026 17:27
7e91adf to
ff1e222
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
POST /api/v1/tasks/:podIdread/create race when Mongo's unique partial(podId, sourceRef)index selects a concurrent winner200,alreadyExists: true) instead of a generic500keyPattern/ index name and a required follow-up lookuptaskIdE11000 is not mislabeled as sourceRef idempotency, even when the request carries a sourceRefWhy the follow-up lookup is required
E11000 identifies the database winner but does not carry the full task response. The route re-reads by the validated request scope
(podId, sourceRef)only after confirming that exact unique index caused the collision. If the row is absent, the original error is rethrown.Verification
git diff --check: passedTargeted backend ESLint is not a valid gate in the current mixed TS/CJS configuration: it cannot parse
.tsroute files and cannot resolve TS modules imported by JS tests. CI build, Tier-0/Tier-1 tests, and CodeQL remain the executable gates.Closes #697