fix: issue_claim race — verify assignee after PATCH to prevent duplicate work #830
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
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: disinto-admin/disinto#830
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Problem
issue_claim()inlib/issue-lifecycle.sh:108-150has a TOCTOU window. When two dev agents poll concurrently (e.g. dev-qwen + dev-bot, or future dev-qwen2), both can see.assignee == null, both PATCH the assignee, and Forgejo's last-write-wins leaves the loser believing it claimed successfully. Result: two agents implement the same issue and collide at the PR/branch stage.Today this is rare because the two existing dev agents mostly operate on disjoint issue tiers. Blocker for scaling to multiple llama dev agents (planned next step).
Current flow
Fix
After PATCH, re-read the assignee and confirm it matches
$me. If not, another agent won — return 1, roll back any labels this call added (e.g.in-progress), and let dev-poll pick a different issue.Acceptance criteria
issue_claimverifies assignee after PATCH; returns 1 if not selfin-progress)Affected files
lib/issue-lifecycle.sh—issue_claim()and helpersContext
Prerequisite for filing LLAMA_BOTS parametric refactor issues that follow this one. Operational goal: run N llama dev containers in parallel without duplicate work.