Skip to content

fix: make GitHub PR-description ticket selection deterministic#3

Open
dellch wants to merge 1 commit into
mainfrom
fix/github-ticket-extraction-deterministic
Open

fix: make GitHub PR-description ticket selection deterministic#3
dellch wants to merge 1 commit into
mainfrom
fix/github-ticket-extraction-deterministic

Conversation

@dellch

@dellch dellch commented Jun 2, 2026

Copy link
Copy Markdown
Owner

Preview on my fork before raising upstream. Split out of the Jira ticket-context PR (The-PR-Agent#2420) because it is a pre-existing bug unrelated to Jira.

Summary

extract_ticket_links_from_pr_description() accumulates GitHub issue URLs in a set, then enforces the 3-ticket cap by slicing list(github_tickets)[:3]. Because sets are unordered, the chosen subset can differ between runs, so which tickets get used for review context is nondeterministic when a PR description references more than 3 issues.

Fix

Track URLs in first-seen order while de-duplicating (a seen set plus an ordered list), then apply the cap by slicing the ordered list. Selection is now stable and predictable.

Notes

Test plan

  • pytest tests/unittest/test_extract_issue_from_branch.py
  • Added tests for first-seen order and deterministic cap selection

Co-Authored-By: Claude

extract_ticket_links_from_pr_description() accumulated issue URLs in a set,
then applied the MAX_TICKETS cap by slicing list(set), which picks an
arbitrary subset that can vary between runs.

Track URLs in first-seen order while de-duplicating (mirroring
find_jira_tickets), so the cap keeps a stable, predictable subset.

Co-Authored-By: Claude
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