Skip to content

Fix TOCTOU ymir_triage_in_progress race#459

Open
antbob wants to merge 1 commit intopackit:mainfrom
antbob:fetcher_toctou
Open

Fix TOCTOU ymir_triage_in_progress race#459
antbob wants to merge 1 commit intopackit:mainfrom
antbob:fetcher_toctou

Conversation

@antbob
Copy link
Copy Markdown
Collaborator

@antbob antbob commented May 7, 2026

The jira_issue_fetcher can push the same issue to triage_queue twice due to a TOCTOU race between the fetcher's dedup checks and the triage agent setting ymir_triage_in_progress. Since there's a single triage agent instance processing sequentially, a pre-flight label check after popping from the queue is sufficient to catch duplicates so that by the time the second copy is popped, the first triage has already completed and set a terminal label. This is a rare condition and should not normally happen but we did run into it in production.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new utility function get_jira_labels to retrieve labels for a Jira issue and updates the triage agent to skip processing for issues that already possess terminal labels, effectively preventing redundant triage tasks. Feedback was provided regarding a performance optimization in the triage agent, specifically suggesting that JiraLabels.all_labels() be called once outside the list comprehension to avoid unnecessary repeated set constructions.

Comment thread ymir/agents/triage_agent.py
@antbob antbob force-pushed the fetcher_toctou branch from 6f60fcc to 9d30ea3 Compare May 7, 2026 14:02
@antbob antbob force-pushed the fetcher_toctou branch from 9d30ea3 to e003542 Compare May 7, 2026 14:07
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