Skip to content

Fix required-labels parsing for reply-to-pr-review-comment and resolve-pr-review-thread - #62667

Merged
pelikhan merged 5 commits into
mainfrom
copilot/fix-required-labels-issue
Sep 22, 2026
Merged

pelikhan merged 5 commits into
mainfrom
copilot/fix-required-labels-issue

Conversation

Copilot AI commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

required-labels compiled without warnings for reply-to-pull-request-review-comment and resolve-pull-request-review-thread but was never enforced — the parsers for these two safe-outputs never read the field into config.RequiredLabels, so the value silently disappeared before reaching the runtime handlers or the handler-registry codegen that was already wired to consume it.

Changes

  • reply_to_pr_review_comment.go: parseReplyToPullRequestReviewCommentConfig now calls ParseFilterConfig(configMap) to populate SafeOutputFilterConfig (RequiredLabels, RequiredTitlePrefix), matching the pattern used by push-to-pull-request-branch and other filterable safe-outputs.
  • resolve_pr_review_thread.go: parseResolvePullRequestReviewThreadConfig gets the same ParseFilterConfig call.
  • Tests: Added reply_resolve_required_labels_test.go asserting required-labels in source YAML shows up in the compiled config's RequiredLabels field for both types.
safe-outputs:
  reply-to-pull-request-review-comment:
    target: "*"
    required-labels: [automation, my-workflow]  # now actually enforced

No changes were needed downstream — the handler-registry codegen and runtime .cjs handlers already read required_labels/RequiredLabels correctly; only the parsing step was missing.


Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • github.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "github.com"

See Network Configuration for more information.

Generated by 👨‍🍳 PR Sous Chef · pi · gpt54 · 35.3 AIC · ⌖ 8.7 AIC · ⊞ 9.6K · ◷
Comment /souschef to run again

Copilot AI changed the title [WIP] Fix required-labels ignoring issue for review comments and threads Fix required-labels parsing for reply-to-pr-review-comment and resolve-pr-review-thread Sep 22, 2026
Copilot AI requested a review from pelikhan September 22, 2026 14:45
@pelikhan
pelikhan marked this pull request as ready for review September 22, 2026 16:34
Copilot AI balanced review requested due to automatic review settings September 22, 2026 16:34
@pelikhan

Copy link
Copy Markdown
Collaborator

@copilot update safe output specs and tests, add compiled workflow integration tests

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.

Copilot review overview

🟡 Changes recommended

Tests do not verify generated handler configuration or runtime enforcement of this security-sensitive filter.

Get a fresh assessment by requesting another Copilot review.

Review effort: Balanced
Findings: 1 Low severity

Open (1)
What changed in this PR

Fixes label-filter parsing for two pull-request review safe outputs.

Changes:

  • Parses shared filter configuration for reply and resolve operations.
  • Adds parser-level tests for required labels.
File Description
pkg/​workflow/​resolve_pr_review_thread.go Parses review-thread filters.
pkg/​workflow/​reply_to_pr_review_comment.go Parses review-comment filters.
pkg/​workflow/​reply_resolve_required_labels_test.go Tests required-label parsing.

t.Fatal("Expected reply-to-pull-request-review-comment configuration to be parsed")
}

requiredLabels := workflowData.SafeOutputs.ReplyToPullRequestReviewComment.RequiredLabels

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Addressed in 091ce5b. Both handlers now have runtime tests that pass required_labels with a missing label and verify the reply/resolve API mutation is not called; the compiled handler config coverage remains in reply_resolve_required_labels_test.go.

@github-actions

github-actions Bot commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ PR Code Quality Reviewer failed during code quality review.

Warning

Threat Detection Engine Failure — The analysis engine could not complete. This is a tooling failure, not a security finding.

What happened

The threat detection engine failed to produce results.

Review the workflow run logs for details.

🔎 Code quality review by PR Code Quality Reviewer

@github-actions

github-actions Bot commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

✅ Test Quality Sentinel completed test quality analysis.

Test Quality Sentinel skipped because pre-fetch PR data was unavailable: unable to fetch test file diff

🧪 Test quality analysis by Test Quality Sentinel

@github-actions

github-actions Bot commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer

@github-actions

github-actions Bot commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

✅ Ponytail Reviewer completed successfully!

Lean already. Ship.

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • ab.chatgpt.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "ab.chatgpt.com"

See Network Configuration for more information.

Generated by Ponytail Reviewer for #62667

@github-actions

github-actions Bot commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

✅ Design Decision Gate 🏗️ completed the design decision gate check. See the comment below for the result and any generated ADR draft.

🏗️ ADR gate enforced by Design Decision Gate 🏗️

@github-actions

Copy link
Copy Markdown
Contributor

Warning

Threat Detection Engine Failure — The analysis engine could not complete. This is a tooling failure, not a security finding.

What happened

The threat detection engine failed to produce results.

Review the workflow run logs for details.

Comment Memory

reviewed_at: 2026-09-22T16:45:44Z
review_event: REQUEST_CHANGES
top_themes:
  - missing end-to-end coverage for required_labels handler config emission
files_reviewed:
  - pkg/workflow/reply_resolve_required_labels_test.go
  - pkg/workflow/reply_to_pr_review_comment.go
  - pkg/workflow/resolve_pr_review_thread.go
comment_count: 0

Note

This comment is managed by comment memory.

It stores persistent context for this thread in the code block at the top of this comment.
Edit only the text inside the backtick fences; workflow metadata and the footer are regenerated automatically.

Learn more about comment memory

🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt54 · 16.8 AIC · ⊞ 19.2K · ◷
Comment /review to run again

Copilot AI commented Sep 22, 2026

Copy link
Copy Markdown
Contributor Author

@copilot update safe output specs and tests, add compiled workflow integration tests

Updated in 6cf1c1... (latest commit): added required-labels/required-title-prefix to the safe-outputs specification for both output types, plus compiled-workflow integration tests that assert required_labels/required_title_prefix show up in the generated .lock.yml handler config JSON (not just the parsed Go struct).

@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 — the fix itself is correct and minimal (matches the existing ParseFilterConfig pattern used by dismiss_pull_request_review.go, update_pull_request.go, and mark_pull_request_as_ready_for_review.go), and I confirmed the handler-registry codegen (safe_outputs_handler_registry_pull_requests.go lines 180 and 214) already reads c.RequiredLabels for both resolve_pull_request_review_thread and reply_to_pull_request_review_comment, so this two-line change genuinely closes the bug described in #62663.

📋 Key Themes & Highlights

Key Themes

  • Root cause correctly addressed: the parsers now call ParseFilterConfig(configMap), consistent with the established pattern for filterable safe-outputs.
  • Regression tests added, but shallow: both new tests (TestReplyToPullRequestReviewCommentRequiredLabels, TestResolvePullRequestReviewThreadRequiredLabels) stop at asserting the parsed Go struct field. They don't exercise compiler.CompileWorkflow + inspect the generated .lock.yml, which is the convention used elsewhere (e.g. TestPushToPullRequestBranchConfigParsing) and is what would actually catch a regression if the handler-registry wiring ever broke. One instance of this gap was already flagged by an existing review comment on line 57; I added a matching comment on the sibling test at line 111.

Positive Highlights

  • ✅ Fix is surgical and follows existing conventions exactly — no unnecessary abstraction introduced.
  • ✅ Both affected safe-output types are covered with a test, even if the assertion depth could be improved.

Not blocking, since the underlying fix is verified correct against the actual codegen path, but recommend strengthening the two new tests to assert against the compiled lock file before merge.

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · sonnet50 · 28.5 AIC · ⌖ 14.5 AIC · ⊞ 10.1K
Comment /matt to run again

t.Fatal("Expected resolve-pull-request-review-thread configuration to be parsed")
}

requiredLabels := workflowData.SafeOutputs.ResolvePullRequestReviewThread.RequiredLabels

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.

[/diagnosing-bugs] Same gap as the sibling test above: this only asserts the parsed Go struct, not that required-labels survives the full compile pipeline into the generated .lock.yml handler config — which is the actual symptom described in #62663 (the value "silently disappeared before reaching the runtime handlers").

💡 Suggested end-to-end assertion

Follow the pattern used in push_to_pull_request_branch_test.go (TestPushToPullRequestBranchConfigParsing): call compiler.CompileWorkflow(mdFile), read the generated .lock.yml, and grep the safe_outputs/handler-registry section for required_labels: [automation, my-workflow] (or the equivalent JS handler config literal). That closes the loop from YAML frontmatter all the way to the artifact the runtime actually consumes, matching how regressions like this are normally caught.

if err := compiler.CompileWorkflow(mdFile); err != nil {
    t.Fatalf("Failed to compile workflow: %v", err)
}
lockFile := stringutil.MarkdownToLockFile(mdFile)
lockContent, _ := os.ReadFile(lockFile)
if !strings.Contains(string(lockContent), "required_labels") {
    t.Fatalf("expected required_labels to appear in generated lock file")
}

@copilot please address this.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Addressed by the compiled-workflow tests in reply_resolve_required_labels_test.go, which compile both safe-output types and assert required_labels and required_title_prefix reach the generated handler config. Runtime enforcement coverage was added in 091ce5b.

@github-actions

Copy link
Copy Markdown
Contributor
🏗️ ADR required — draft added for PR #62667

Result

A draft ADR has been added to this PR because ADR enforcement is required and no existing ADR covering this decision was found.

Evidence used

  • adr-prefetch-summary.json: no implementation label, but default_business_additions is 125, which exceeds the 100-line enforcement threshold.
  • PR body and diff: the change fixes required-labels parsing for reply-to-pull-request-review-comment and resolve-pull-request-review-thread by wiring both parsers to ParseFilterConfig(configMap).
  • Branch ADR search: existing ADRs were present in docs/adr/, but none covered this parser/enforcement decision for review safe outputs.

Draft ADR added

  • docs/adr/62667-enforce-required-label-filters-for-review-safe-outputs.md

Next action

Please review and refine the draft ADR so it accurately reflects the intended long-term architectural decision before merge.

🏗️ ADR gate enforced by Design Decision Gate 🏗️ · pi · gpt54 · 13.7 AIC · ⌖ 9.86 AIC · ⊞ 9.9K · ◷
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.

Impeccable Review — refactor_cleanup

Small, focused fix. Reviewed with harden/audit lenses (bug-fix scope).

Assessment: ✅ No blocking issues.

  • Both parseReplyToPullRequestReviewCommentConfig and parseResolvePullRequestReviewThreadConfig now call ParseFilterConfig(configMap), correctly mirroring the pattern already used by push-to-pull-request-branch, create-pull-request-review-comment, and other filterable safe-outputs.
  • Confirmed the handler-registry codegen (safe_outputs_handler_registry_pull_requests.go) already reads c.RequiredLabels/c.RequiredTitlePrefix for both output types, so this change closes the actual gap end-to-end (config → registry → runtime handler).
  • Build (go build ./...) and the two new tests (TestReplyToPullRequestReviewCommentRequiredLabels, TestResolvePullRequestReviewThreadRequiredLabels) pass.
  • New tests stop at the parsed Go struct level (don't assert on the compiled .lock.yml/handler config), matching the existing convention in push_to_pull_request_branch_test.go (TestPushToPullRequestBranchWithRequiredLabels) — consistent with repo precedent, not a regression.

No further action requested.

🧵 Reviewed using Impeccable skills by Impeccable Skills Reviewer · copilot · sonnet50 · 29.4 AIC · ⌖ 13.1 AIC · ⊞ 8.1K

@pelikhan

Copy link
Copy Markdown
Collaborator

@copilot run pr-finisher skill

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

pr-sous-chef
@copilot This PR still needs forward progress before a maintainer can merge it.

The remaining review thread is still open on the current head:

Please complete the end-to-end coverage requested there, push the follow-up changes, and then run the pr-finisher skill.

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • github.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "github.com"

See Network Configuration for more information.

Generated by 👨‍🍳 PR Sous Chef · pi · gpt54 · 35.3 AIC · ⌖ 8.7 AIC · ⊞ 9.6K · ◷
Comment /souschef to run again

@pelikhan
pelikhan merged commit 119ed5b into main Sep 22, 2026
5 of 6 checks passed
@pelikhan
pelikhan deleted the copilot/fix-required-labels-issue branch September 22, 2026 17:55

Copilot AI commented Sep 22, 2026

Copy link
Copy Markdown
Contributor Author

@copilot run pr-finisher skill

PR finisher completed. Added runtime missing-label enforcement tests in 091ce5b, replied to both review threads, merged current main in 42c9e0c, and all local validation passed. CI is stale after the agent push and needs a maintainer re-trigger; the two answered threads still need UI resolution.

Copilot AI restored the copilot/fix-required-labels-issue branch September 22, 2026 17:58

Copilot AI commented Sep 22, 2026

Copy link
Copy Markdown
Contributor Author

@copilot run pr-finisher skill

PR #62667 has already been merged, so there's nothing further to drive to merge-ready state.

@github-actions

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v0.89.20

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.

required-labels is silently ignored for reply-to-pull-request-review-comment and resolve-pull-request-review-thread

4 participants