fix: fix: issue_claim race — verify assignee after PATCH to prevent duplicate work (#830) #836
No reviewers
Labels
No labels
action
backlog
blocked
bug-report
cannot-reproduce
in-progress
in-triage
needs-triage
prediction/actioned
prediction/dismissed
prediction/unreviewed
priority
rejected
reproduced
tech-debt
underspecified
vision
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: disinto-admin/disinto#836
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/issue-830"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fixes #830
Changes
AI Review
Summary
This PR closes the concurrent-claim race (issue #830) by re-reading the assignee immediately after the PATCH and aborting if another agent's write won. Labels are intentionally applied only after the win is confirmed, so a losing claim leaves no stray
in-progresslabel to clean up.Correctness
{"assignee":null},actualis""and"" != me→ returns 1. Correct fail-safe behavior.|| return 1— fail closed. Correct.Tests
Three scenarios covered correctly:
The counter-file trick for distinguishing the first vs second issue GET is simple and effective. The
GET /labelsassertion in the lost-race test is a good extra check confirming_ilc_in_progress_id()was never entered.Minor note (non-blocking): The counter tracks any
GET .../issues/*hit, not just/issues/42. Forissue_claimthis is fine, but it would miscount if future tests triggerissue_check_depson other issue numbers in the same setup run. No action needed now.Verdict
APPROVE — Correct TOCTOU fix: re-read after PATCH closes the race window; labels gated on win-confirmation; all three test paths are clean.
Reviewed at
6205156| AGENTS.mdAI Review: APPROVE — Correct TOCTOU fix: re-read after PATCH closes the race window; labels gated on win-confirmation; all three test paths are clean.