Skip to content

Allow opting out of "[aw] Detection Runs" tracking issue independently of threat detection - #61428

Merged
pelikhan merged 7 commits into
mainfrom
copilot/allow-opt-out-detection-runs
Sep 17, 2026
Merged

pelikhan merged 7 commits into
mainfrom
copilot/allow-opt-out-detection-runs

Conversation

Copilot AI commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

Threat detection's automatic reporting to the [aw] Detection Runs tracking issue had no independent opt-out — it could only be disabled by turning off threat detection entirely, which also drops enforcement (continue-on-error behavior, safe-output blocking, etc.). Repositories using gh-aw for issue triage ended up with framework diagnostics (e.g. parse_error reports) polluting user-facing issue queues, with no way to keep detection active while suppressing the tracking issue.

Config

  • Added report-as-issue (boolean, default true) to safe-outputs.threat-detection.
  • false skips creating/updating the tracking issue and posting comments to it; detection still runs and enforcement (continue-on-error, blocking behavior) is unaffected.
safe-outputs:
  threat-detection:
    report-as-issue: false

Implementation

  • ThreatDetectionConfig gains a ReportAsIssue *bool field and IsReportAsIssueEnabled() helper (nil → enabled, preserving current default behavior).
  • Parsing of the object-form threat-detection config extracts report-as-issue; the parser function was split into smaller helpers (scalar fields vs. engine field) to keep it within line-length limits.
  • The conclusion job's "Log detection run" step (which creates/updates the tracking issue) is now skipped when report-as-issue: false, while the detection job, its outputs, and downstream enforcement remain untouched.

Schema & docs

  • JSON schema updated with the new report-as-issue property under threat-detection.
  • threat-detection.md reference doc updated with the field description and a dedicated opt-out example.

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 · 31.6 AIC · ⊞ 9.1K · ◷
Comment /souschef to run again

Copilot AI and others added 2 commits September 16, 2026 23:39
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Add option to opt out of detection runs issues Allow opting out of "[aw] Detection Runs" tracking issue independently of threat detection Sep 16, 2026
Copilot AI requested a review from pelikhan September 16, 2026 23:40
@pelikhan
pelikhan marked this pull request as ready for review September 17, 2026 02:29
Copilot AI balanced review requested due to automatic review settings September 17, 2026 02:29
@github-actions

Copy link
Copy Markdown
Contributor

🔬 Test Quality Sentinel is analyzing test quality on this pull request...

@github-actions

github-actions Bot commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

✅ Ponytail Reviewer completed successfully!

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 #61428

@github-actions

github-actions Bot commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

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

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.

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

@github-actions

github-actions Bot commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

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

🏗️ ADR gate enforced by Design Decision Gate 🏗️

@github-actions

github-actions Bot commented Sep 17, 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 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.

Ponytail review: one place to trim abstraction without changing behavior.

net: -4 lines possible.

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 #61428 · codex · gpt53codex · 3.67 AIC · ⌖ 4.02 AIC · ⊞ 12.4K
Comment /ponytail to run again

Comments that could not be inline-anchored

pkg/workflow/notify_comment_conclusion_helpers.go:106

L106: yagni: IsReportAsIssueEnabled() helper wraps one nil/default bool check used once. Inline detectionConfig == nil || detectionConfig.ReportAsIssue == nil || *detectionConfig.ReportAsIssue at call site until a second caller exists.

@github-actions

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

I enforced the ADR gate for this PR because it adds 128 new lines in business-logic directories (pkg/) and introduces a new architectural configuration choice.

Evidence reviewed

  • PR description explains the decision to decouple threat-detection enforcement from [aw] Detection Runs issue reporting.
  • Code changes add ReportAsIssue to ThreatDetectionConfig, parse report-as-issue, and conditionally omit the conclusion job's detection-runs logging step.
  • Schema, docs, and tests were updated to reflect the new configuration contract.

Outcome

I generated and committed a draft ADR here:

  • docs/adr/61428-allow-opting-out-of-detection-runs-tracking-issue.md

Next action

Please review and refine the draft ADR, then keep it with this implementation so the decision remains explicit before merge.

🏗️ ADR gate enforced by Design Decision Gate 🏗️ · pi · gpt54 · 15.4 AIC · ⊞ 10.2K · ◷
Comment /review to run again

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.

🟡 Changes recommended

The generated frontmatter reference is stale, and the documentation overstates run-summary availability.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

Adds an independent opt-out for threat-detection tracking issues while preserving detection and enforcement.

Changes:

  • Adds and parses report-as-issue.
  • Omits tracking-issue reporting when disabled.
  • Updates schema, tests, documentation, and release notes.
File summaries
File Description
pkg/workflow/threat_detection_config.go Defines and parses the option.
pkg/workflow/notify_comment_conclusion_helpers.go Skips tracking-issue logging when disabled.
pkg/workflow/detection_success_test.go Tests opt-out behavior.
pkg/parser/schemas/main_workflow_schema.json Exposes the option in the schema.
docs/src/content/docs/reference/threat-detection.md Documents configuration and behavior.
.changeset/threat-detection-report-as-issue-option.md Records the feature for release.
Review details
  • Files reviewed: 7/7 changed files
  • Comments generated: 2
  • Review effort level: Balanced

Comment thread docs/src/content/docs/reference/threat-detection.md Outdated
Comment on lines +11915 to +11918
"report-as-issue": {
"type": "boolean",
"default": true,
"description": "When true (default), detection warnings/failures create or update the '[aw] Detection Runs' tracking issue and post a comment to it. When false, detection still runs and enforces its configured continue-on-error behavior, but no tracking issue is created or updated; results remain available in the GitHub Actions run diagnostics."

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.

Regenerated frontmatter-full.md from the schema, including the new report-as-issue option. Addressed in 03afa9f.

@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 /tdd — solid feature implementation with good end-to-end (compile-level) test coverage; a couple of unit-level test gaps worth closing.

📋 Key Themes & Highlights

Key Themes

  • Test coverage gaps at unit level: The new IsReportAsIssueEnabled() helper and the report-as-issue parsing branch mirror the existing IsContinueOnError() / continue-on-error pair, both of which have direct table-driven unit tests (TestIsContinueOnError, cases in TestParseThreatDetectionConfig). The new field only has an end-to-end compile test (TestDetectionRunsStepOmittedWhenReportAsIssueDisabled), which is good but doesn't substitute for fast, focused unit coverage of the parsing/default logic.

Positive Highlights

  • ✅ Clean, minimal implementation: ReportAsIssue *bool + IsReportAsIssueEnabled() mirrors the existing ContinueOnError pattern exactly, keeping the codebase consistent (/codebase-design).
  • ✅ Correct scoping: detection job, its outputs, and continue-on-error enforcement are left untouched — only the "Log detection run" step is skipped.
  • ✅ Docs and JSON schema updated together with the code change, including a concrete opt-out example.
  • ✅ The parser refactor (parseThreatDetectionScalarFields / parseThreatDetectionReportingFields / parseThreatDetectionEngineField) is a reasonable, low-risk decomposition that keeps parseThreatDetectionObjectConfig readable.

@copilot please address the review comments above.

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.

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

_, engineConfig, model := c.ExtractEngineConfig(map[string]any{"engine": engineObj})
threatConfig.EngineConfig = engineConfig
threatConfig.Model = model
// Parse report-as-issue field (default: true).

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.

[/tdd] parseThreatDetectionObjectConfig's table-driven test (TestParseThreatDetectionConfig) covers every other reporting/kill-switch field but has no case for report-as-issue, so parsing regressions here (e.g. accidentally dropping the field, or breaking it when combined with continue-on-error) wouldn't be caught at the parser-unit level — only by the heavier compile-level test in detection_success_test.go.

💡 Suggested addition to TestParseThreatDetectionConfig
{
	name: "object with report-as-issue false",
	outputMap: map[string]any{
		"threat-detection": map[string]any{
			"report-as-issue": false,
		},
	},
	expectedConfig: &ThreatDetectionConfig{
		ReportAsIssue: boolPtr(false),
	},
},

This keeps parser-level coverage symmetric with continue-on-error and catches regressions closer to the source than the full-compile test.

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

Added parser-level coverage for report-as-issue: false combined with continue-on-error: false. Addressed in 03afa9f.

@github-actions

Copy link
Copy Markdown
Contributor

🧪 Test Quality Sentinel Analysis

Summary

Test Quality Score: 100/100 ✅ Excellent

Metric Result
Design Tests 9/9 (100%)
Assertions 72 total
Edge Cases 5+ scenarios (table-driven + opt-out)
Test Inflation 95 lines / 72 production lines = 1.3:1 ✅
Mock Violations 0 (no forbidden libraries)
Build Tag ✅ Present ((go/redacted):build !integration)
Implementation Tests 0% (0/9)

Test Coverage Breakdown

✅ Feature Validation: TestDetectionRunsStepOmittedWhenReportAsIssueDisabled directly validates the PR feature:

  • Disables report-as-issue tracking independently
  • Verifies "Log detection run" step is omitted
  • Confirms threat detection still runs
  • Validates backward compatibility

✅ Table-Driven Coverage: 5 test scenarios across configuration modes

✅ No Forbidden Patterns: Zero mock library usage, all tests verify actual compiled workflow output

Recommendation

✅ APPROVE — Excellent test coverage. Score: 100/100. All 9 tests are design-focused behavioral tests with comprehensive workflow output validation. The opt-out feature has explicit test coverage.

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.

🧪 Test quality analysis by Test Quality Sentinel · copilot · haiku45 · 141.5 AIC · ⌖ 8.56 AIC · ⊞ 8.4K · ◷
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. All 9 behavioral tests verify design invariants with comprehensive workflow output validation. Feature opt-out test (TestDetectionRunsStepOmittedWhenReportAsIssueDisabled) validates the PR requirement correctly. 0% implementation tests. No forbidden patterns (0 mock violations). Ready to approve.

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.

🧪 Test quality analysis by Test Quality Sentinel · copilot · haiku45 · 141.5 AIC · ⌖ 8.56 AIC · ⊞ 8.4K
Comment /review to run again

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

pr-sous-chef
@copilot this PR still needs forward progress before a maintainer can investigate quickly.

Please address the unresolved review feedback:

If the branch is behind or stale, refresh it, regenerate any drifted generated docs if needed, and then continue with the pr-finisher skill to close out review feedback and validation.

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 · 31.6 AIC · ⊞ 9.1K · ◷
Comment /souschef to run again

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

Copilot AI commented Sep 17, 2026

Copy link
Copy Markdown
Contributor Author

pr-sous-chef
@copilot this PR still needs forward progress before a maintainer can investigate quickly.
...

Addressed all three linked review threads in 03afa9f, regenerated the schema reference, and added parser-level coverage. The branch was already current with main; local lint and tests pass.

Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Copilot AI requested a review from gh-aw-bot September 17, 2026 06:09
@pelikhan
pelikhan merged commit 9dbbbd8 into main Sep 17, 2026
1 check passed
@pelikhan
pelikhan deleted the copilot/allow-opt-out-detection-runs branch September 17, 2026 06:44
github-actions Bot added a commit that referenced this pull request Sep 17, 2026
PR #61428 added safe-outputs.threat-detection.report-as-issue to the
schema but safe-outputs-runtime.md never listed it alongside the other
threat-detection sub-fields.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v0.89.17

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.

Allow opting out of Detection Runs issues without disabling threat detection

4 participants