Skip to content

[3691 by Claude Opus 5.5] AI and llm-* labels are applied twice when a PR is created - #3721

Merged
integry merged 1 commit into
3686-epic-0-9-g6ifrom
3691/claude-opus-5-5-ai-and-llm-labels-are-app-20261118-1901-ccg
Nov 18, 2026
Merged

integry merged 1 commit into
3686-epic-0-9-g6ifrom
3691/claude-opus-5-5-ai-and-llm-labels-are-app-20261118-1901-ccg

Conversation

@propr-dev

@propr-dev propr-dev Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

AI Implementation Summary

Closes #3691

Branch: 3691/claude-opus-5-5-ai-and-llm-labels-are-app-20261118-1901-ccg
Commits: ✅ Changes committed (28780ae)


AI Processing Completed

Execution Details:

Summary:
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 AI added twice, in two patterns:

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.

Review digest

Risk-tiered paths

  • High risk: none
  • Normal risk (5 files)
    • 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)
  • Low risk (2 files)
    • 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!

… 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.
@propr-dev

propr-dev Bot commented Nov 18, 2026

Copy link
Copy Markdown
Contributor Author

/ultrafix goal=8 max=3
Triggered automatically by the requested execution settings.

@propr-dev

propr-dev Bot commented Nov 18, 2026

Copy link
Copy Markdown
Contributor Author

🔄 Ultrafix loop started (goal: 8/10, max cycles: 3)

First action: /review

💡 Tip: Remove the ultrafix label from this PR to stop further ultrafix cycles.

@propr-dev

propr-dev Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ AI Code Review Complete requested by @propr-ultrafix

Posted 1 review:

View Task Details

@propr-dev

propr-dev Bot commented Nov 18, 2026

Copy link
Copy Markdown
Contributor Author

🔍 AI Code Review — codex:gpt-6-astra

Overall Evaluation

The 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 findExistingPR, separating creation failure from subsequent processing.

This review used static analysis of the supplied code; no commands or tests were run.

Merge blockers

No merge blockers.

Suggestions

These are optional follow-ups and are not sent to /fix.

S1: 🟢 Assert fallback calls directly

In test/pullRequestCreationLabels.test.ts, the label-failure test counts successful label requests and creation attempts, but does not count existing-PR lookups. A fallback lookup would not increment the creation counter. Recording every request and asserting zero fallback lookups would make the test substantiate its name. This is optional because the narrowed try already establishes that boundary in the implementation.

S2: 🟢 Consolidate label payload parsing

pullRequestLabelNames is duplicated in packages/core/src/utils/prValidation.ts and src/jobs/pullRequestProcessingLabels.ts. A shared utility could prevent these identical normalization rules from drifting. This small duplication does not introduce material complexity or incorrect behavior, so consolidation is optional.

S3: 🟢 Verify the production duplicate source

The 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.

Score

The 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

  • Model: GPT-6 Astra
  • Time: 20s
  • Tokens: 50,162 (49,658 in / 504 out)
  • Cost: $0.41

View Task


💡 Next step: Comment /fix to address every F# merge blocker, /fix all for every pending blocker and suggestion, or name records explicitly, as in /fix F3 S5.
F# and S# IDs increment across review comments and remain permanent, so selectors such as /fix F3 F5 stay unambiguous across cycles. S# suggestions stay optional: they are implemented only when you name them or request /fix all, and they never relax a merge blocker.

Copy and edit to choose records from this review:

/fix S1 S2 S3

🤖 Review by ProPR

@propr-dev propr-dev Bot removed the ultrafix label Nov 18, 2026
@propr-dev propr-dev Bot changed the title 🔨 [3691 by Claude Opus 5.5] AI and llm-* labels are applied twice when a PR is created ✅❽ [3691 by Claude Opus 5.5] AI and llm-* labels are applied twice when a PR is created Nov 18, 2026
@integry
integry merged commit 0c8d8f9 into 3686-epic-0-9-g6i Nov 18, 2026
64 checks passed
@propr-dev propr-dev Bot changed the title ✅❽ [3691 by Claude Opus 5.5] AI and llm-* labels are applied twice when a PR is created [3691 by Claude Opus 5.5] AI and llm-* labels are applied twice when a PR is created Nov 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant