Skip to content

fix(linear): prevent duplicate Linear issues on batch retry - #26

Draft
cursor[bot] wants to merge 1 commit into
mainfrom
cursor/critical-bug-investigation-ec3d
Draft

fix(linear): prevent duplicate Linear issues on batch retry#26
cursor[bot] wants to merge 1 commit into
mainfrom
cursor/critical-bug-investigation-ec3d

Conversation

@cursor

@cursor cursor Bot commented Jul 6, 2026

Copy link
Copy Markdown

Summary

  • add an idempotency pre-check in Tracker.BatchPush before batching unique-title creates
  • if a marker already exists in Linear, reuse that issue URL instead of sending a new issueBatchCreate mutation
  • add a regression test covering retry of an unlinked local issue to ensure the second push reuses the existing remote issue

Bug and impact

A successful batch create can leave a local issue unlinked if external_ref write-back fails locally. On the next sync, the same issue is treated as new and re-batch-created, producing duplicate Linear issues.

Root cause

Batch create path appended idempotency markers but did not check for existing markers before issuing new batch creates. Dedup checks existed for single-create but not for unique-title batch-create retries.

Fix

Perform FindIssueByDescriptionContains(marker) for each batch-create candidate:

  • on hit: treat as created/deduped and reuse existing URL
  • on miss: include in batch mutation as before
  • on lookup error: record a per-issue error and continue safely

Validation

  • go test -tags gms_pure_go ./internal/linear -run 'TestBatchPush_BatchCreateRetryUsesIdempotencySearch|TestBatchPush_AmbiguousBatchFailureSearchesMarkers|TestBatchPush_DuplicateTitlesFallbackToSingleCreate'
  • go test -tags gms_pure_go ./internal/linear
  • make test (fails in unrelated existing tests: cmd/bd TestTestServerConnection/unreachable_host and internal/storage/dolt TestPullWithAutoResolve_BranchTrackingFallbackSuccess due missing dolt executable in this environment)
Open in Web View Automation 

Co-authored-by: Medhaug <Medhaug@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant