feat(detector): honor GH_AW_DETECTION_CONTINUE_ON_ERROR for missing artifacts - #751
Merged
Merged
Conversation
…rtifacts Mirrors gh-aw#49415 in the Go detector so it no longer depends on gh-aw's JS setup step for required-artifact validation. Load now records the expected-but-absent artifacts (agent_output.json, aw-prompts/prompt.txt, and a patch/bundle when HAS_PATCH=true) and the CLI warns and continues in the default warn mode, or fails with config_error in strict mode. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: David Slater <12449447+davidslater@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Adds host-controlled handling for missing threat-detection artifacts, aligning the Go detector with gh-aw setup behavior.
Changes:
- Tracks required-but-missing artifacts.
- Adds warn/strict handling, diagnostics, and JSONL logging.
- Updates specifications, documentation, and tests.
Show a summary per file
| File | Description |
|---|---|
specs/usage-spec.md |
Documents host integration behavior. |
specs/threat-detection-spec.md |
Defines missing-artifact requirements. |
README.md |
Documents inputs, variables, and logging. |
pkg/artifacts/artifacts.go |
Detects missing required artifacts. |
pkg/artifacts/artifacts_test.go |
Tests artifact detection. |
gosec-report.json |
Adds a generated scanner report. |
cmd/threat-detect/main.go |
Implements warn and strict modes. |
cmd/threat-detect/main_test.go |
Tests CLI behavior. |
cmd/threat-detect/conclude.go |
Reuses the policy helper. |
Review details
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 9/9 changed files
- Comments generated: 2
- Review effort level: Balanced
| // detection run and the conclude subcommand: anything other than "false" is | ||
| // warn mode, so an unset variable defaults to warning rather than failing. | ||
| func detectionContinueOnError() bool { | ||
| return os.Getenv("GH_AW_DETECTION_CONTINUE_ON_ERROR") != "false" |
| @@ -0,0 +1,593 @@ | |||
| { | |||
Reworks the required-artifact policy on top of #750's degraded-input warnings instead of a parallel MissingRequired list: ArtifactWarning now carries RequiredInput, and strict mode (GH_AW_DETECTION_CONTINUE_ON_ERROR="false") turns those findings into errors plus a config_error exit while advisory findings stay warnings. Also addresses review feedback: the continue-on-error comparison is now case-insensitive (matching gh-aw's setup), and the accidentally committed gosec-report.json is removed and gitignored along with the other `make clean` generated reports. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: David Slater <12449447+davidslater@users.noreply.github.com>
This was referenced Aug 5, 2026
This was referenced Aug 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #720
Parity follow-up for the gh-aw v0.84.2 scan in #720.
Triage of the two flagged changes
buildExternalDetectorExecutionStep), which now copiesModel/ModelMappings/DefaultAiCreditsPricinginto the detection job. The detector already consumes what it produces:--modelplus theGH_AW_MODEL_DETECTION_*/COPILOT_MODELfallbacks inengine.ResolveModel.GH_AW_DETECTION_CONTINUE_ON_ERRORin detection setup: parity gap, addressed here. That PR taught gh-aw'ssetup_threat_detection.cjsto warn instead of hard-failing whenagent_output.jsonis missing, or when a patch is expected (HAS_PATCH=true) but absent — and to still fail in strict mode. This repo owns that setup logic in Go going forward, butthreat-detectdid neither half: it silently proceeded with"No agent output file found"placeholders and ignored both env vars.Changes
pkg/artifacts:Loadnow recordsMissingRequired— the expected-but-absent host-staged artifacts (agent_output.json→ERR_SYSTEM,aw-prompts/prompt.txt→ERR_VALIDATION, and a missingaw-*.patch/aw-*.bundlewhenHAS_PATCH=true→ERR_VALIDATION). Loading never fails on these; the caller decides.cmd/threat-detect: warn mode (default,GH_AW_DETECTION_CONTINUE_ON_ERROR != "false") emits a::warning::per entry and continues detection with whatever was staged; strict mode emits::error::and returnsconfig_error/ exit2before the engine is invoked. A newartifacts_missing_requiredJSONL event records the entries and resolved mode.GH_AW_DETECTION_CONTINUE_ON_ERRORinterpretation is now a single shared helper used by both the detection run andconclude(no behavior change toconclude).Verification
make fmt-check lint build testpass.make security-scanandmake golintfail identically onmain(38 pre-existing gosec findings; golangci-lint binary built with go1.25 vs. the go1.26 target).