Skip to content

Fix add_labels issue-intent path failing on pull requests - #51168

Merged
pelikhan merged 6 commits into
mainfrom
copilot/fix-add-labels-safe-output-failure
Aug 7, 2026
Merged

Fix add_labels issue-intent path failing on pull requests#51168
pelikhan merged 6 commits into
mainfrom
copilot/fix-add-labels-safe-output-failure

Conversation

Copilot AI commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

The add_labels safe output routed pull requests through updatePullRequest(input: { pullRequestId: ..., labels: ... }), but UpdatePullRequestInput has no labels field, so every PR label application failed and the safe_outputs job ended in partial_success:

InputObject 'UpdatePullRequestInput' doesn't accept argument 'labels'
Variable $labels is declared by anonymous mutation but not used

There is no Labelable mutation that accepts LabelUpdateInput intent metadata (rationale/confidence/suggest) — updateIssue is the only mutation that supports it. So the PR path degrades to the REST endpoint rather than attempting an intent-aware mutation.

Changes

  • actions/setup/js/add_labels.cjs: when the target is detected as a PR (REST pull_request field or PR_ node ID prefix), skip the GraphQL intent mutation and fall through to rest.issues.addLabels, logging that intent metadata is not supported for pull requests. The invalid updatePullRequest mutation and the query-selection branch are removed; the issue path now inlines the updateIssue mutation directly.
  • Issue behavior is unchanged, including the existing-label merge that preserves add-only semantics against updateIssue's replace-the-set behavior.
  • actions/setup/js/add_labels.test.cjs: the two PR tests now assert the REST fallback (no GraphQL mutation issued; issues.addLabels called with the expected number and labels); the issue test was renamed to state that it exercises the updateIssue intent mutation.

Trade-off

PR labels are applied without intent metadata. This removes the need for the issue-intent: false workaround and unblocks the failing checks, but restoring metadata on PRs depends on GitHub exposing a Labelable mutation that accepts LabelUpdateInput.


Generated by 👨‍🍳 PR Sous Chef · gpt54 · 29 AIC · ⊞ 8.5K ·
Comment /souschef to run again


Run: https://github.com/github/gh-aw/actions/runs/31215510357> Generated by 👨‍🍳 PR Sous Chef · gpt54 · 5.84 AIC · ⊞ 6.1K ·

Comment /souschef to run again

…requests

Co-authored-by: dsyme <7204669+dsyme@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix add labels safe output failure on invalid GraphQL mutation Fix add_labels issue-intent path failing on pull requests Aug 7, 2026
Copilot AI requested a review from dsyme August 7, 2026 19:33
Comment thread actions/setup/js/add_labels.cjs Outdated
@pelikhan
pelikhan marked this pull request as ready for review August 7, 2026 19:38
Copilot AI balanced review requested due to automatic review settings August 7, 2026 19:38

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Fixes pull-request label application by avoiding the unsupported GraphQL mutation.

Changes:

  • Falls back to the REST labels endpoint for pull requests.
  • Preserves the intent-aware GraphQL path for issues.
  • Updates tests for both pull-request detection paths.
Show a summary per file
File Description
actions/setup/js/add_labels.cjs Routes pull-request labeling through REST.
actions/setup/js/add_labels.test.cjs Verifies REST fallback and unchanged issue behavior.

Review details

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 2/2 changed files
  • Comments generated: 0
  • Review effort level: Balanced

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

⚠️ Security scanning failed for Matt Pocock Skills Reviewer. Review the logs for details.

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

⚠️ Security scanning failed for PR Code Quality Reviewer. Review the logs for details.

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

⚠️ Security scanning failed for Test Quality Sentinel. Review the logs for details.

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

⚠️ Security scanning failed for Design Decision Gate 🏗️. Review the logs for details.

No ADR enforcement needed: PR #51168 does not have the 'implementation' label and has 0 new lines of code in business logic directories (threshold: 100).

…tions

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI requested a review from pelikhan August 7, 2026 19:45

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The fix is correct: UpdatePullRequestInput does not accept a labels field, so the PR path now falls through to the REST addLabels endpoint. Logic, test coverage, and comments are all clean. No blocking issues found.

🧵 Reviewed using Impeccable skills by Impeccable Skills Reviewer · sonnet46 · 19 AIC · ⊞ 5.5K

@github-actions github-actions Bot mentioned this pull request Aug 7, 2026
@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

🧪 Test Quality Sentinel Report

Test Quality Score: 100/100 — Excellent

Analyzed 3 test(s): 3 design, 0 implementation, 0 violation(s).

📊 Metrics (3 tests)
Metric Value
Analyzed 3 (Go: 0, JS: 3)
✅ Design 3 (100%)
⚠️ Implementation 0 (0%)
Edge/error coverage 3 (100%)
Duplicate clusters 0
Inflation No (0.16:1)
🚨 Violations 0
Test File Classification Issues
should fall back to the REST add-labels endpoint for PRs when using issue_intent (pull_request field) actions/setup/js/add_labels.test.cjs:758 design_test, high_value, behavioral_contract None
should fall back to the REST add-labels endpoint for PRs when node_id starts with PR_ actions/setup/js/add_labels.test.cjs:801 design_test, high_value, behavioral_contract None
should use the updateIssue intent mutation for regular issues (ISSUE_ node_id) actions/setup/js/add_labels.test.cjs:843 design_test, high_value, behavioral_contract None

Analysis

All three modified tests verify the critical behavioral change: pull requests with issue_intent=true now correctly fall back to the REST addLabels endpoint instead of attempting an unsupported GraphQL updatePullRequest mutation.

  • Test 1 & 2: Cover both PR detection paths (via pull_request field and node_id prefix). Both assert that GraphQL mutations are NOT called (0 calls) and REST addLabels is used instead (1 call with correct parameters).
  • Test 3: Validates the positive path for regular issues, ensuring they still use the GraphQL updateIssue mutation.
  • Coverage: 100% of assertions are assertions about user-visible behavior (fallback routing decisions).
  • Inflation: Test additions (27 lines) are proportional to production changes (103 lines in the logic), indicating focused, purposeful test coverage.

Verdict

passed. 0% implementation tests (threshold: 30%). All tests are design-level behavioral contracts. No violations.

🧪 Test quality analysis by Test Quality Sentinel · haiku45 · 23.2 AIC · ⊞ 7.7K ·
Comment /review to run again

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ Test Quality Sentinel: 100/100. 0% implementation tests (threshold: 30%).

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Skills-Based Review 🧠

Applied /diagnosing-bugs and /tdd — approving with one minor test coverage note.

📋 Key Themes & Highlights

Key Themes

  • Correct root-cause fix: The broken updatePullRequest(input: { labels: ... }) mutation is removed; the PR path now unconditionally falls back to REST issues.addLabels, which matches the API's actual capabilities.
  • Issue path unchanged: The label-merging and updateIssue intent-mutation logic for non-PR items is preserved; only the PR branch is simplified.
  • Test coverage updated: Both PR detection paths (via pull_request field and via PR_ node ID prefix) now assert the REST fallback behaviour.

Positive Highlights

  • ✅ PR detection logic is explicit and readable (isPullRequestItem helper / inline comment)
  • ✅ The core.info log message clearly explains the trade-off (no intent metadata for PRs)
  • ✅ Test names were updated to describe the new expected behaviour — good specification hygiene
  • ✅ One inline comment left on a minor missing assertion in the second PR test

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · sonnet46 · 41.1 AIC · ⊞ 7.1K
Comment /matt to run again

Comment thread actions/setup/js/add_labels.test.cjs

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Review: no blocking issues

The PR correctly fixes the root bug — PR node IDs no longer reach the invalid updatePullRequest/updateIssue GraphQL mutations; they now cleanly fall through to the REST addLabels endpoint. The follow-up refactor extracting isPullRequestItem and applyIssueIntentLabels into named helpers (per the earlier reviewer comment) is a clean improvement and preserves existing merge/dedup semantics.

💡 Themes checked
  • Correctness: verified no code path can still send a PR_ node ID into updateIssue — the if (isPullRequestItem(...)) branch short-circuits before applyIssueIntentLabels is called, and falls through to the REST addLabels call at the bottom of the try block.
  • Redundant API call: fetchIssueState (for beforeState) and the subsequent githubClient.rest.issues.get (for issueData/node ID) both hit the same REST endpoint back-to-back. This is a minor extra API call, not new behavior introduced by this PR (it existed in the prior updatePullRequest code path too), so not flagged as blocking, but worth a follow-up cleanup.
  • Test coverage gap: flagged as an inline comment — the two new PR-fallback tests assert labelsAdded and the REST call args, but don't assert on the resulting after-state labels snapshot, unlike the issue-intent-path test. Non-blocking but worth adding.
  • Sub-agent (grumpy-coder) findings: reviewed all three; the redundant-GET finding predates this PR (not actionable here), the error-handling gap is low severity and already caught generically, and the test-coverage gap was escalated as the one inline comment above.

🔎 Code quality review by PR Code Quality Reviewer · auto · 54.1 AIC · ⊞ 7.8K
Comment /review to run again

Comment thread actions/setup/js/add_labels.test.cjs
@pelikhan

pelikhan commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator

@copilot run pr-finisher skill

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot please refresh the branch if needed and run the pr-finisher skill to address any remaining review or validation items.

Recent reviewer activity looks mostly green, but please do one final pass on the remaining non-blocking review notes and confirm validation is still clean after branch refresh.

Run context: https://github.com/github/gh-aw/actions/runs/31213603061

Generated by 👨‍🍳 PR Sous Chef · gpt54 · 29 AIC · ⊞ 8.5K ·
Comment /souschef to run again

Copilot AI commented Aug 7, 2026

Copy link
Copy Markdown
Contributor Author

@copilot please refresh the branch if needed and run the pr-finisher skill to address any remaining review or validation items.

Recent reviewer activity looks mostly green, but please do one final ...

Ran pr-finisher again — no changes were needed.

  • Branch: already up to date with main (merge commit 8cddbad; HEAD..origin/main is empty). No refresh required.
  • Reviews: all three threads have substantive replies — the add_labels.cjs refactor request (21cf9ab), the missing labelsAdded assertion, and the missing after_state.labels assertion (both 1bded3b). They still need a maintainer click to mark resolved; I don't have that permission here.
  • Checks (local): make agent-report-progress is green — JavaScript lint, schema freshness, impacted Go tests (none changed), and 62/62 add_labels.test.cjs tests. Working tree is clean, nothing unpushed.
  • Checks (CI): agent pushes don't trigger workflows, so CI on 8cddbad needs a maintainer re-trigger. No prior failing runs on this PR.
  • Mergeable: mergeable_state: blocked pending required review approval. Not actionable from here.

No merge performed.

Copilot AI requested a review from gh-aw-bot August 7, 2026 20:20
@gh-aw-bot

Copy link
Copy Markdown
Collaborator

$
@copilot Quick triage nudge for this PR.

Please refresh the branch, address any remaining review feedback, run the pr-finisher skill, and push follow-up fixes.

  • no recorded failed checks in compact candidate data

Run: https://github.com/github/gh-aw/actions/runs/31215510357

Generated by 👨‍🍳 PR Sous Chef · gpt54 · 5.84 AIC · ⊞ 6.1K ·
Comment /souschef to run again

…s-safe-output-failure

Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>

Copilot AI commented Aug 7, 2026

Copy link
Copy Markdown
Contributor Author

$
@copilot Quick triage nudge for this PR.
...

Ran pr-finisher again.

  • Branch refresh: merged origin/main (6f72754) into the branch — 46b3b7b. The incoming change only touched design-decision-gate workflow files; no conflicts, no drift affecting this PR.
  • Reviews: no new feedback. The after_state.labels thread is now resolved; the other two already have substantive replies (21cf9ab for the refactor request, 1bded3b for the labelsAdded assertion) and just need a maintainer click to mark resolved.
  • Checks (local): make agent-report-progress green after the merge — build, JavaScript lint, schema freshness, impacted Go tests (none changed), 62/62 add_labels.test.cjs. Working tree clean, nothing unpushed.
  • Checks (CI): unverified on 46b3b7b — agent pushes don't trigger workflows, so a maintainer re-trigger is needed. No prior failed checks recorded.
  • Mergeable: blocked pending required review approval. Not actionable from here.

No merge performed.

@pelikhan
pelikhan merged commit cc3330a into main Aug 7, 2026
9 checks passed
@pelikhan
pelikhan deleted the copilot/fix-add-labels-safe-output-failure branch August 7, 2026 20:55
@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v0.86.1

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.

add-labels safe output fails on pull requests with invalid UpdatePullRequestInput mutation

6 participants