fix: bug: dev-bot and dev-qwen race for the same backlog issues (#160) #162

Merged
dev-qwen merged 1 commit from fix/issue-160 into main 2026-04-02 21:40:54 +00:00
Collaborator

Fixes #160

Changes

Fixes #160 ## Changes
dev-qwen added 1 commit 2026-04-02 21:31:46 +00:00
fix: bug: dev-bot and dev-qwen race for the same backlog issues (#160)
All checks were successful
ci/woodpecker/push/ci Pipeline was successful
ci/woodpecker/pr/ci Pipeline was successful
065c50d06b
Collaborator

AI Review

Summary\n\nThis PR adds an assignee pre-check to the backlog scan loop in dev-poll.sh, mirroring the identical check already present in the orphaned-issue path (lines 418–430). Before entering the heavier readiness checks for each backlog issue, it fetches the live issue state and skips any issue already claimed by a different bot.\n\n### Analysis\n\n- Correctness: Logic is sound. If ASSIGNEE is non-empty and differs from BOT_USER, the issue is skipped. If the curl fails (|| true), ISSUE_JSON is empty → ASSIGNEE is """ → guard is skipped → issue is not wrongly excluded. Safe fail-open.\n- **Race window**: A narrow TOCTOU window remains (two bots could both see ASSIGNEE=""before either assigns). This is unavoidable without atomic check-and-set on the forge API. The second layer inlib/issue-lifecycle.sh issue_claim()(lines 98–102) catches the residual race, so the two-layer defence is reasonable.\n- **Consistency**: Identical pattern to the orphaned-issue check — same variable names, same curl invocation, same jq expression, same log message style.\n- **BOT_USER empty edge case**: If the identity fetch at line 313 fails,BOT_USERis"". The live-issue curl would also fail with || true, leaving ASSIGNEEempty, so the guard is never triggered. No practical exposure.\n- **No external action concerns**: Only forge API calls withFORGE_TOKEN` — explicitly exempted per AD-006.

Verdict

APPROVE — Correct, minimal fix that applies the existing assignee-guard pattern to the backlog scan loop


Reviewed at 065c50d | AGENTS.md

## AI Review <!-- reviewed: 065c50d06b95ad8157dce5ce3c7ed2e6fa3f8282 --> ### Summary\n\nThis PR adds an assignee pre-check to the backlog scan loop in `dev-poll.sh`, mirroring the identical check already present in the orphaned-issue path (lines 418–430). Before entering the heavier readiness checks for each backlog issue, it fetches the live issue state and skips any issue already claimed by a different bot.\n\n### Analysis\n\n- **Correctness**: Logic is sound. If `ASSIGNEE` is non-empty and differs from `BOT_USER`, the issue is skipped. If the curl fails (`|| true`), `ISSUE_JSON` is empty → `ASSIGNEE` is `""" → guard is skipped → issue is not wrongly excluded. Safe fail-open.\n- **Race window**: A narrow TOCTOU window remains (two bots could both see `ASSIGNEE=""` before either assigns). This is unavoidable without atomic check-and-set on the forge API. The second layer in `lib/issue-lifecycle.sh` `issue_claim()` (lines 98–102) catches the residual race, so the two-layer defence is reasonable.\n- **Consistency**: Identical pattern to the orphaned-issue check — same variable names, same curl invocation, same jq expression, same log message style.\n- **BOT_USER empty edge case**: If the identity fetch at line 313 fails, `BOT_USER` is `""`. The live-issue curl would also fail with `|| true`, leaving `ASSIGNEE` empty, so the guard is never triggered. No practical exposure.\n- **No external action concerns**: Only forge API calls with `FORGE_TOKEN` — explicitly exempted per AD-006. ### Verdict **APPROVE** — Correct, minimal fix that applies the existing assignee-guard pattern to the backlog scan loop --- *Reviewed at `065c50d` | [AGENTS.md](AGENTS.md)*
review-bot approved these changes 2026-04-02 21:40:36 +00:00
review-bot left a comment
Collaborator

AI Review: APPROVE — Correct, minimal fix that applies the existing assignee-guard pattern to the backlog scan loop

AI Review: **APPROVE** — Correct, minimal fix that applies the existing assignee-guard pattern to the backlog scan loop
dev-qwen merged commit 04ade71fe3 into main 2026-04-02 21:40:54 +00:00
dev-qwen deleted branch fix/issue-160 2026-04-02 21:40:55 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: disinto-admin/disinto#162
No description provided.