Repository navigation
Include detection reporting permissions in conclusion App tokens - #74949
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
|
✅ Test Quality Sentinel completed test quality analysis. Test Quality SentinelOutcome: The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅
|
This comment has been minimized.
This comment has been minimized.
|
✅ PR Code Quality Reviewer completed the code quality review.
|
|
✅ Ponytail Reviewer completed successfully!
|
🏗️ Design Decision Gate — ADR RequiredThis PR makes significant changes to core business logic (>100 new lines) but does not have a linked Architecture Decision Record (ADR). 📄 Draft ADR committed:
🔎 Evidence used
📋 What to do next
Once the ADR is linked in the PR body, this gate will re-run and verify that the implementation matches the decision. ❓ Why ADRs MatterADRs create a searchable, permanent record of why the codebase looks the way it does, including the trade-offs future contributors need to understand.
|
There was a problem hiding this comment.
Reviewed the changed permission logic and regression coverage. No actionable correctness, security, or performance issues found in the diff.
🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt50 · ~3 AIC · ⌖ ~1 AIC · ⊞ 1.6K
Comment /review to run again
There was a problem hiding this comment.
What this change does: It grants issues: write to the conclusion job when runnable threat detection reports to its tracking issue, including work-queue participants. It adds regression cases for normal and worker App-token paths.
Should fix:
-
The App-token test matrix is broader than this change (
pkg/workflow/notify_comment_test.go:L2177)- What this is: The table now carries seven independent config fields and repeats reporter cases already covered by
TestConclusionJobIssuesWritePermissionDerivedFromConfig. - Problem: The failure, missing-tool, and default paths are unchanged here, so this detection-only regression now has a second matrix with roughly 50 extra maintenance lines.
- Fix: Keep the baseline rows plus focused detection enabled, disabled, not-runnable, and worker rows; remove the unrelated reporter fields, rows, and exception assertion.
- If we skip it: Each future conclusion reporter enlarges this table without protecting this change.
- What this is: The table now carries seven independent config fields and repeats reporter cases already covered by
Verdict: fix 1 first.
Not checked: Targeted Go tests could not run because this checkout requires Go 1.27.3, the runner has Go 1.26.10, and the automatic toolchain download failed TLS validation.
Lean: -52 lines possible.
Generated by ✂️ Ponytail Reviewer for #74949 · codex · routed: gpt56 max · ~5 AIC · ⌖ ~1 AIC · ⊞ 118
Comment /ponytail to run again
| name string | ||
| reportFailedJobs *TemplatableBool | ||
| reportFailureAsIssue *TemplatableBool | ||
| threatDetection *ThreatDetectionConfig |
There was a problem hiding this comment.
What this is: This table now carries seven independent config fields and repeats the existing reporter cases. Problem: TestConclusionJobIssuesWritePermissionDerivedFromConfig already covers failure, missing-tool, and default paths; adding them here makes a detection-only regression require edits in a second matrix and adds roughly 50 lines for behavior this change does not touch. Fix: Keep the baseline rows plus focused detection enabled/disabled/not-runnable and worker rows; remove the unrelated reporter fields/rows and the exception assertion. If we skip it: Each future conclusion reporter enlarges this table without protecting this change.
There was a problem hiding this comment.
Addressed in 7ac4bc9. Kept the baseline and focused detection/worker cases, removed unrelated reporter fields and rows, and made the safe-output permission assertion unconditional. Added worker non-runnable coverage and checked that reporting-step emission matches the detection permission grant. Targeted tests and the final validation gate pass.
There was a problem hiding this comment.
🟡 Changes recommended
Default detection reporting now requires issues: write, risking reusable-workflow validation and App token creation failures without documentation of the permission requirement and opt-out.
1 open issue
What changed in this PR
Updates the workflow compiler so conclusion jobs and their GitHub App tokens have the permissions needed to report detection results as issues.
Changes:
- Add
issues: writefor runnable detection with issue reporting enabled, including work-queue participants. - Preserve reporting opt-outs and safe-output execution permissions.
- Expand regression coverage across conclusion reporters and detection settings.
| File | Description |
|---|---|
pkg/workflow/notify_comment.go |
Include detection reporting in conclusion permission derivation. |
pkg/workflow/notify_comment_test.go |
Cover reporter permissions, opt-outs, non-runnable detection, and work-queue cases. |
Review effort: Max (auto)
| if conclusionMissingToolCreateIssueEnabled(data) { | ||
| return true | ||
| } | ||
| if IsDetectionJobEnabled(data.SafeOutputs) && data.SafeOutputs.ThreatDetection.IsReportAsIssueEnabled() { |
There was a problem hiding this comment.
Addressed in 7ac4bc9. The threat-detection reference now documents issues: write requirements for reusable callers and GitHub Apps, plus the report-as-issue: false opt-out that preserves enforcement. ADR-54630's opt-out list now includes detection reporting.
There was a problem hiding this comment.
Skills-Based Review 🧠
Applied /codebase-design and /tdd. The behaviour is correct; one refactor suggestion is posted inline.
📋 Key Themes & Highlights
Key Themes
- Duplicated gate: the detection-reporting predicate appears in
notify_comment.goat L185 and L276. Extracting a helper prevents drift. - Test coverage:
TestConclusionGitHubAppTokenUsesConclusionPermissionscovers the worker and general paths well. An observer/dispatcher case with detection reporting enabled would close the remaining gap, since that role takes the general path.
Positive Highlights
- ✅ The grant uses the same condition as the detection-runs step (
buildConclusionDetectionRunsStep), so permission and behaviour agree. - ✅
IsReportAsIssueEnabledis nil-safe and defaults to true, matching the documented behaviour. - ✅ The grant is additive and applied after
ComputePermissionsForSafeOutputs, so safe-output permissions are unchanged. - ✅
gh aw compileproduces no lock-file diffs.
Validation Notes
go test ./pkg/workflow -run TestConclusionpasses.go vetandgofmtare clean.- Four unrelated full-suite failures (
TestVerifyGitCredentials,TestCredentialFreePromptEnvironment, and others) look environmental. I could not confirm them against the base commit because the sandbox blocks git fetch. - Skill selection was done directly from the diff. The
pr-triagestep was not run.
🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · routed: haiku55 xhigh · ~7 AIC · ⌖ ~1 AIC · ⊞ 5.4K
Comment /matt to run again
| conclusionPerms.Set(PermissionContents, PermissionWrite) | ||
| conclusionPerms.Set(PermissionIssues, PermissionWrite) | ||
| } | ||
| if IsDetectionJobEnabled(data.SafeOutputs) && data.SafeOutputs.ThreatDetection.IsReportAsIssueEnabled() { |
There was a problem hiding this comment.
[/codebase-design] The detection-reporting predicate IsDetectionJobEnabled(data.SafeOutputs) && data.SafeOutputs.ThreatDetection.IsReportAsIssueEnabled() is repeated here and at conclusionMayCreateIssue (L276). If only one site changes, the permission grant and the detection-runs step can drift apart. Extract a shared helper and call it from both places.
💡 Suggested helper
func conclusionDetectionMayCreateIssue(data *WorkflowData) bool {
return IsDetectionJobEnabled(data.SafeOutputs) && data.SafeOutputs.ThreatDetection.IsReportAsIssueEnabled()
}The && short-circuit keeps it nil-safe because IsDetectionJobEnabled returns false when SafeOutputs or ThreatDetection is nil.
@copilot please address this.
There was a problem hiding this comment.
Addressed in 7ac4bc9. Added conclusionDetectionMayCreateIssue and reused it for both permission derivation paths and the detection-runs step, keeping the opt-out and runnable-detection checks aligned. Focused conclusion/detection tests and final validation pass.
|
Copilot assignment requested for the following outstanding work:
Once you start work, post this work summary as a PR comment, including the Sous-chef head, work, and state lines below, to record that the assignment is running. Apply the necessary fixes on this PR's existing branch, reply to each listed review thread and resolve it when addressed. Ignore feedback already answered or resolved; stop when only human review or CI remains. Do not merge or trigger CI. Sous-chef requested-head: 29b854e
|
|
Copilot assignment requested for the following outstanding work:
Once you start work, post this work summary as a PR comment, including the Sous-chef head, work, and state lines below, to record that the assignment is running. Apply the necessary fixes on this PR's existing branch, reply to each listed review thread and resolve it when addressed. Ignore feedback already answered or resolved; stop when only human review or CI remains. Do not merge or trigger CI. Sous-chef requested-head: 29b854e
|
|
Copilot assignment requested for the following outstanding work:
Once you start work, post this work summary as a PR comment, including the Sous-chef head, work, and state lines below, to record that the assignment is running. Apply the necessary fixes on this PR's existing branch, reply to each listed review thread and resolve it when addressed. Ignore feedback already answered or resolved; stop when only human review or CI remains. Do not merge or trigger CI. Sous-chef requested-head: 29b854e
|
|
Copilot assignment requested for the following outstanding work:
Once you start work, post this work summary as a PR comment, including the Sous-chef head, work, and state lines below, to record that the assignment is running. Apply the necessary fixes on this PR's existing branch, reply to each listed review thread and resolve it when addressed. Ignore feedback already answered or resolved; stop when only human review or CI remains. Do not merge or trigger CI. Sous-chef requested-head: 29b854e
|
|
Copilot assignment requested for the following outstanding work:
Once you start work, post this work summary as a PR comment, including the Sous-chef head, work, and state lines below, to record that the assignment is running. Apply the necessary fixes on this PR's existing branch, reply to each listed review thread and resolve it when addressed. Ignore feedback already answered or resolved; stop when only human review or CI remains. Do not merge or trigger CI. Sous-chef requested-head: 29b854e
|
|
Copilot assignment requested for the following outstanding work:
Once you start work, apply the necessary fixes on this PR's existing branch, reply to each listed review thread and resolve it when addressed. Ignore feedback already answered or resolved; stop when only human review or CI remains. Do not merge or trigger CI. Sous-chef requested-head: 29b854e
|
|
@copilot make sure that this behavior can be disabled through the "report-as-issue: false" field in safe outputs (or similar existing field name) |
…n-job-issues Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
…ions Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Verified and preserved in 7ac4bc9: |
…forks flag Document safe-output output_id/depends-on dependency gating (#74376), the managed source-sha frontmatter field (#74948), the dangerously-allow-pull-request-target-forks-all feature flag (#74884), and detection report-as-issue permission requirements (#74949). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
🎉 This pull request is included in a new release. Release: |

Conclusion App tokens can lack
issues: writeeven when detection reporting needs to create or update its tracking issue.issues: writewhen runnable detection has issue reporting enabled, including work-queue participants.