Repository navigation
[3691 by Claude Opus 5.5] AI and llm-* labels are applied twice when a PR is created - #3721
Conversation
… call, and skip any label the PR already has. But I couldn't find a second labelling call in ProPR's code for the normal case, so this may not stop the duplicates you're seeing. What the PR timelines show. I checked the last 80 PRs and 23 have `AI` added twice, in two patterns: - Older PRs (#3579–#3711): `AI` and `llm-*` appear twice, 0–1 s apart. ProPR's retry waits at least 2 s, so a retry can't explain this. - Newer PRs (#3712, #3717): `AI`, `ultrafix` and `llm-*` all appear again 2 s after `ultrafix` is added. No ProPR code adds those three together, and `ultrafix` was already on the PR. Normal creation makes a single label call. The labels were already in place when the second set appeared. That suggests GitHub may record labels again on a PR it is still setting up, which ProPR can't prevent. I couldn't test that without making real PRs. Code paths that could label twice, now fixed: - Final validation: if a step after creation failed, the run lost track of the PR it had opened. Final validation then found that PR and labelled it again. Validation now records the labels the PR already has (`packages/core/src/utils/prValidation.ts`), so that second call sends nothing. - Creation itself: in `src/jobs/issueJobHelpers.ts`, only the create request is now inside the `try`. Labelling happens once afterwards, so an error after labelling can no longer fall into the "find existing PR" path and label again. - The other paths (existing PR found after a duplicate error, and the API retry in `src/jobs/issueJobPRRetry.ts`) use the same shared helper and skip labels GitHub already lists on the PR. - The shared helper in `src/jobs/pullRequestProcessingLabels.ts` now sends only the missing labels, and makes no call at all when nothing is missing. Tests - A new file, `test/pullRequestCreationLabels.test.ts`, checks that each creation path makes exactly one label call. It also checks that labels already on the PR aren't re-sent, and that a failed label call isn't repeated through the existing-PR fallback. - I added cases to `test/recoveredPullRequestLabels.test.ts` covering final validation and the API retry when the PR already has some or all of its labels. - Against the original `issueJobHelpers.ts`, 2 of the 5 new creation-path tests fail. The single-call tests also pass on the old code, because it already made one call per path. - The suites that touch these files ran 508 tests with 507 passing and 0 failing. Typecheck is clean for the root and core packages, and lint is clean on the changed source files. If the duplicates continue after this ships, the next step is to compare ProPR's worker log for one affected PR with its timeline. Two "Added processing labels" log lines would mean ProPR sent two calls; one would mean the duplicate comes from GitHub. The change isn't visible on screen, so there are no previews.
|
/ultrafix goal=8 max=3 |
|
🔄 Ultrafix loop started (goal: 8/10, max cycles: 3) First action:
|
|
✅ AI Code Review Complete requested by @propr-ultrafix Posted 1 review: |
🔍 AI Code Review — codex:gpt-6-astraOverall EvaluationThe PR consistently filters already-present labels across creation and recovery paths. No merge-blocking regression is evident in the supplied diff. It is merge-ready within scope, conditional on the four pending test shards passing; the reported timeline duplication remains unproven as resolved. ✅ Recovery preserves label state — Both validation lookup paths return label names, and final validation passes them into the shared labeling helper. ✅ Missing labels remain actionable — The helper sends only missing labels and skips the request when all requested labels are present. ✅ Narrower creation fallback — Only the create request can now trigger This review used static analysis of the supplied code; no commands or tests were run. Merge blockersNo merge blockers. SuggestionsThese are optional follow-ups and are not sent to S1: 🟢 Assert fallback calls directlyIn S2: 🟢 Consolidate label payload parsing
S3: 🟢 Verify the production duplicate sourceThe supplied context acknowledges that normal creation already issued one label call. Correlating request attempts with an affected PR’s timeline would distinguish recovery-related duplication from other causes. This is follow-up diagnosis, not a blocker for the concrete deduplication improvements here. ScoreThe changed paths are coherent and have focused coverage, with no verified blockers or current check failures. Four test shards remain pending, and production resolution of the original symptom still needs confirmation. Score: 8/10 🤖 Review Details
Copy and edit to choose records from this review: 🤖 Review by ProPR |
AI and llm-* labels are applied twice when a PR is createdAI and llm-* labels are applied twice when a PR is created
AI and llm-* labels are applied twice when a PR is createdAI and llm-* labels are applied twice when a PR is created
AI Implementation Summary
Closes #3691
Branch:
3691/claude-opus-5-5-ai-and-llm-labels-are-app-20261118-1901-ccgCommits: ✅ Changes committed (28780ae)
AI Processing Completed
Execution Details:
AIandllm-*labels are applied twice when a PR is created #3691Summary:
I made every path that opens or finds a new PR send its labels in one call, and skip any label the PR already has. But I couldn't find a second labelling call in ProPR's code for the normal case, so this may not stop the duplicates you're seeing.
What the PR timelines show. I checked the last 80 PRs and 23 have
AIadded twice, in two patterns:AIandllm-*appear twice, 0–1 s apart. ProPR's retry waits at least 2 s, so a retry can't explain this.AI,ultrafixandllm-*all appear again 2 s afterultrafixis added. No ProPR code adds those three together, andultrafixwas already on the PR.Normal creation makes a single label call. The labels were already in place when the second set appeared. That suggests GitHub may record labels again on a PR it is still setting up, which ProPR can't prevent. I couldn't test that without making real PRs.
Code paths that could label twice, now fixed:
packages/core/src/utils/prValidation.ts), so that second call sends nothing.src/jobs/issueJobHelpers.ts, only the create request is now inside thetry. Labelling happens once afterwards, so an error after labelling can no longer fall into the "find existing PR" path and label again.src/jobs/issueJobPRRetry.ts) use the same shared helper and skip labels GitHub already lists on the PR.src/jobs/pullRequestProcessingLabels.tsnow sends only the missing labels, and makes no call at all when nothing is missing.Tests
test/pullRequestCreationLabels.test.ts, checks that each creation path makes exactly one label call. It also checks that labels already on the PR aren't re-sent, and that a failed label call isn't repeated through the existing-PR fallback.test/recoveredPullRequestLabels.test.tscovering final validation and the API retry when the PR already has some or all of its labels.issueJobHelpers.ts, 2 of the 5 new creation-path tests fail. The single-call tests also pass on the old code, because it already made one call per path.If the duplicates continue after this ships, the next step is to compare ProPR's worker log for one affected PR with its timeline. Two "Added processing labels" log lines would mean ProPR sent two calls; one would mean the duplicate comes from GitHub.
The change isn't visible on screen, so there are no previews.
Review digest
Risk-tiered paths
packages/core/src/utils/prValidation.ts(+17/−2)src/jobs/issueJobHelpers.ts(+67/−88)src/jobs/issueJobPRRetry.ts(+3/−3)src/jobs/issueJobPostProcessing.ts(+1/−1)src/jobs/pullRequestProcessingLabels.ts(+26/−8)test/pullRequestCreationLabels.test.ts(added, +112/−0)test/recoveredPullRequestLabels.test.ts(+27/−3)Diff size: 7 files changed, +253/−105 lines
View task for the run's logs and conversation.
This PR was created automatically by ProPR after processing issue #3691.
💡 Need changes?
Comment on this PR to request refinements — the AI agent monitors comments and will update the implementation based on your feedback. Keep iterating until you're satisfied!