Repository navigation
Description
Summary
In warn mode (the default continue-on-error: true), when the threat-detection engine itself fails, safe outputs are applied with no restriction at all:
- nothing fails closed, and
- the warn-mode policy does not apply either: no WTD1a WARNING annotation and no WTD3 abort of non-reviewable outputs.
So an engine failure is handled more permissively than a detection warning. This affects every workflow whose detection engine fails in warn mode, not just the one below.
Observed in: Daily action/setup/* Security Audit, run 39191157830 (19 Oct 2026). It created #70120 with no annotation.
Recurrence: the same chain happened in 39090720928 (18 Oct) and 38995597867 (17 Oct). That is every daily run since claude-opus-4.8 was retired on 16 Oct. Each run was green. The two earlier runs applied only a noop, which is itself in the WTD3 abort set.
What happened (run 39191157830)
Evidence comes from gh aw audit (a dev build of main at d5ecd72) and the job logs.
- The detection engine failed.
threat-detect v0.5.2ran the Copilot engine with the inherited modelclaude-opus-4.8. The API returned HTTP 400model_not_supported(failureClass=model_not_supported, not retried). The detection log then showsTHREAT_DETECTION_STATUS: reason=engine_error exit=2, followed by##[error]ERR_SYSTEM: ❌ Detection result file not found at: /tmp/gh-aw/threat-detection/detection_result.json. - The conclude step failed closed. "Conclude threat detection" (
conclude_threat_detection.sh, which runsexec threat-detect conclude) ran withDETECTION_AGENTIC_EXECUTION_OUTCOME: failure,THREAT_DETECT_INSTALL_OUTCOME: successandGH_AW_DETECTION_CONTINUE_ON_ERROR: true. It setconclusion=failure,reason=agent_failureandsuccess=false, then exited 1. This is its fail-closed path. - The step-level
continue-on-errorhid that failure. In warn mode the compiled step carriescontinue-on-error: true(daily-action-setup-security-audit.lock.yml, "Conclude threat detection"), so thedetectionjob still concludedsuccess. safe_outputsran anyway. Its gate isif: (!cancelled()) && needs.agent.result != 'skipped' && needs.detection.result == 'success', so it ran withGH_AW_DETECTION_CONCLUSION: failureandGH_AW_DETECTION_REASON: agent_failure.- No warn-mode policy was applied.
safe_output_handler_manager.cjsapplies the WTD policy only whendetectionConclusion === "warning".getDetectionCautionAlertinmessages_footer.cjsalso returns""unless the conclusion iswarning. As a result,create_issuecreated [setup-security] Environment Variable Injection via OTLP Token in GitHub Actions Step #70120. Its body has no[!WARNING]block, nothreat detection engine errorlabel and no<!-- gh-aw-threat-engine-error -->marker. - The only signal was a warning on a green run. The
conclusionjob logged##[warning]Threat detection produced no security verdict. Review the detection job logs before trusting the agent outputs.All 8 jobs concludedsuccess.
update_cache_memory has the same needs.detection.result == 'success' gate, so the agent's cache memory was also persisted without a verdict.
Root cause
| Component | Location | Behaviour |
|---|---|---|
| Conclude step (external path) | buildExternalDetectorConcludeStep, pkg/workflow/threat_detection_external.go |
Adds step-level continue-on-error: true in warn mode |
| Conclude step (inline path) | buildDetectionConclusionStep, pkg/workflow/threat_detection_steps.go |
Same |
| Inline conclude | setDetectionFailure, actions/setup/js/parse_threat_detection_results.cjs |
mustFail = executionOutcome == "failure" && reason in {agent_failure, parse_error} gives conclusion=failure and calls setFailed |
| External conclude | concluder.fail, github/gh-aw-threat-detection cmd/threat-detect/conclude.go (v0.5.2) |
Same rule ("mirrors gh-aw's setDetectionFailure exactly") |
safe_outputs gate |
buildSafeOutputsJobCondition (via buildDetectionSuccessCondition / buildDetectionPassedCondition), pkg/workflow/compiler_safe_outputs_job.go |
Checks only needs.detection.result |
| Handler | actions/setup/js/safe_output_handler_manager.cjs |
Applies the WTD policy only for warning; treats failure like success |
In short, the conclude step fails closed, the step-level continue-on-error swallows that failure, and nothing downstream reads detection_conclusion.
History
- Block silent detection pass and classify Claude embedded 429 rate limits #31081 (merged 8 May 2026) introduced
mustFail. In warn mode,agent_failure/parse_errorwith a failed execution step concludedfailureand failed the step. The intent was to fail closed. - Keep detection in warn mode on parser/agent failures so non-reviewable safe outputs are blocked #41547 (merged 25 Jun 2026) removed it. Because of the step-level
continue-on-error, afailureconclusion let everything through: an Issue Monster run appliedassign_to_agent. After this change, warn mode always concludedwarning, so the WTD policy applied. - threat-detection: delegate all conclude branches to
threat-detect concludeon the external path #50854 (merged 6 Aug 2026) brought themustFail→failurebranch back inparse_threat_detection_results.cjs(git blameonconst mustFailpoints to f8b81ef). It also delegated the external path tothreat-detect conclude, which implements the same rule. The fix from Keep detection in warn mode on parser/agent failures so non-reviewable safe outputs are blocked #41547 has therefore been undone on both paths since 6 Aug. The testsshould fail when detection execution failed in warn modeandshould fail on parse errors when detection execution failed in warn mode(parse_threat_detection_results.test.cjs) encode the reintroduced behaviour.
The specs and docs disagree
- gh-aw safe-outputs spec (
docs/src/content/docs/specs/safe-outputs-specification.md):- WTD1a: in warn mode, a tooling-failure reason (
agent_failure/parse_error) MUST produce a review-first artifact with a WARNING annotation. - WTD3: non-reviewable outputs MUST NOT be applied.
- WTD1a: in warn mode, a tooling-failure reason (
- github/gh-aw-threat-detection
specs/threat-detection-spec.md, TD-20b: in warn mode, "agent_failureandparse_errorMUST hard-fail when the detection execution step itself failed." - gh-aw docs,
reference/threat-detection.md: these two statements conflict with each other.- "When Detection Fails: … the workflow stops and safe outputs are not applied."
- The options table says
continue-on-error: truemakes "detection warnings/failures produce a caution notice instead of blocking safe outputs".
Today's behaviour satisfies none of them.
Proposed solution
Choose one policy for "the detection engine failed in warn mode". Then make the code on both conclude paths, both specs and the docs agree. The safe-outputs gate should also honour the detection conclusion, not just the job result.
Option A: fail closed (recommended)
This matches the threat-detect spec (TD-20b), the "When Detection Fails" docs and the intent of #31081.
safe_outputsmust not run whenneeds.detection.outputs.detection_conclusion == 'failure', even though the step-levelcontinue-on-errorkeeps thedetectionjob green. Apply this to both thebuildDetectionSuccessConditionbranch and the conditional-detectionbuildDetectionPassedConditionbranch.- Make the failure visible in the run, for example as an error in the
conclusionjob, rather than only as a warning on a green run. - Narrow WTD1a in the safe-outputs spec to tooling failures where the detection execution step succeeded (for example, unparseable output). Fix the row in the options table.
- github/gh-aw-threat-detection needs no change: both conclude paths already produce
failurein this case.
Option B: apply the warn policy
This matches WTD1a and #41547.
-
In warn mode, tooling failures conclude
warningon both paths:- inline
parse_threat_detection_results.cjs, and threat-detect conclude, which needs a github/gh-aw-threat-detection change, a release and a pin bump.
WTD1a and WTD3 then apply.
- inline
-
Update the threat-detect spec (TD-20b) and the "When Detection Fails" docs.
Why we recommend Option A
- An engine failure means there is no verdict. If it is treated as a warning, anyone who can make the detector fail (for example, with oversized or malformed agent output, or by exhausting its turns or timeout) can get reviewable outputs applied without analysis. The only cost to them is a WARNING annotation.
- It is the smaller, single-repo change. Both conclude implementations and the threat-detect spec already produce
failurehere. Only the gh-aw gate, the handler, WTD1a and one docs table row change, with no cross-repo release or pin bump. - It matches the documented "When Detection Fails" contract that users rely on.
- It makes silent failures visible. Today a failure like this one stays green for days.
Trade-off: in warn mode, a detection outage (a retired model, a provider outage) blocks safe outputs until it is fixed. #41547 chose B mainly to stop assign_to_agent; Option A stops that too.
Also decide, whichever option is chosen
- Should
update_cache_memoryfollow the same rule? It is also gated only onneeds.detection.result == 'success'. - Should
report_detector_unavailableinconclude_threat_detection.shfollow the same rule? When the detector install fails or the binary is missing, it concludeswarningin warn mode, yet the detector never produced a verdict there either.
Defence in depth (both options)
The safe-outputs handler must never apply outputs when GH_AW_DETECTION_CONCLUSION == 'failure'; today it treats failure like success. Each message should fail with a machine-readable error code and a summary entry.
Maintainers: please choose Option A or Option B before implementation starts.
Acceptance cases
Each case needs a named test. Fixtures must come from real conclude outputs, not invented ones. For this run, the conclude inputs were RUN_DETECTION=true, DETECTION_AGENTIC_EXECUTION_OUTCOME=failure, THREAT_DETECT_INSTALL_OUTCOME=success and GH_AW_DETECTION_CONTINUE_ON_ERROR=true, with no detection_result.json and a detection.log containing THREAT_DETECTION_STATUS: reason=engine_error exit=2. The outputs were conclusion=failure, reason=agent_failure, success=false, exit 1. The detection artifact of run 39191157830 has the full inputs.
- Warn mode, detection execution failed, reason
agent_failure(this run).- Option A:
safe_outputsis skipped and the run reports the detection failure. - Option B: the conclusion is
warning,create_issuegets the WTD1a WARNING annotation andassign_to_agentis aborted (WTD3).
- Option A:
- Warn mode, real threat verdict: unchanged (
warning, WTD1 CAUTION, WTD3 abort). - Warn mode, detection succeeded with no threats: unchanged; outputs are applied without annotation.
- Strict mode (
continue-on-error: false), engine failure: unchanged; thedetectionjob fails andsafe_outputsdoes not run. - Detection skipped (no outputs to analyze): unchanged.
- Handler unit test: with
GH_AW_DETECTION_CONCLUSION=failure, no output type is ever applied. - Parity and compiler coverage: both conclude paths (inline
parse_threat_detection_results.cjsand externalthreat-detect conclude) give the same conclusion for each case. Compiler tests cover the generatedsafe_outputscondition, both plain and conditional detection. Ifthreat-detectneeds a change, file it in github/gh-aw-threat-detection and link it here.
End to end: on the PR branch, a workflow whose detection engine is forced to fail (for example, with a retired detection model) shows the chosen behaviour in a real run.
Scope
- Keep the PR to this one fix. Do not change files or behaviour unrelated to it.
- Before fixing a failing check, compare it with the same check on
main. If it also fails onmain, do not fix it in this PR. Mergemainoncemainis fixed, and list in the PR which checks are known failures onmain. - This applies even if a bot comment asks you to fix a failing check: fix only failures caused by this PR's changes.
- Do not fix the retired
claude-opus-4.8pin indaily-action-setup-security-audit.mdin this PR; Daily Model Inventory Checker: deterministically check workflow model pins against the live Copilot catalogue #70289 tracks it. Do not change how detection picks its model.
Related, not part of this fix
gh aw audit (dev build of main) reports workflow_succeeded and no detection-related finding for all three runs, including with --group. This is a separate observability gap.
How this was checked
gh aw audit 39191157830 --no-baseline --json # dev build of main @ d5ecd72
gh aw audit 39191157830 39090720928 38995597867 --group --json
- Detection job log, "Conclude threat detection" step: env
DETECTION_AGENTIC_EXECUTION_OUTCOME: failure,GH_AW_DETECTION_CONTINUE_ON_ERROR: true;THREAT_DETECTION_STATUS: reason=engine_error exit=2;ERR_SYSTEM: ❌ Detection result file not found;Process completed with exit code 1. detection/sandbox/firewall/logs/api-proxy-logs/upstream-errors.jsonl:model":"claude-opus-4.8",status":400,"code":"model_not_supported".safe_outputsjob log:GH_AW_DETECTION_CONCLUSION: failure,GH_AW_DETECTION_REASON: agent_failure,Created issue github/gh-aw#70120.- The [setup-security] Environment Variable Injection via OTLP Token in GitHub Actions Step #70120 body contains none of the WTD1/WTD1a markers.
conclusionjob log:##[warning]Threat detection produced no security verdict…
Activity
SivaKesava1 commentedon Oct 19, 2026
Decision: Option B (apply the warn policy). Please implement Option B, not Option A.
Why: threat detection is not reliable enough to block a run whenever the detector itself fails (a retired detection model, a provider outage, a failed detector install). In warn mode, a detection engine failure should not fail the run or block every output. But it also must not be treated as a clean pass, which is what happens today. Option B keeps the run going and applies the policy the spec already defines for tooling failures:
create_issue,add_comment,create_pull_request,update_issue, discussions,comment_memory, …) are applied with the WTD1a annotation: the[!WARNING] threat detection engine errorblock, thethreat detection engine errorlabel string and the<!-- gh-aw-threat-engine-error -->marker.push_to_pull_request_branchfalls back tocreate_pull_requestwith the WTD1a annotation (WTD2).merge_pull_request,close_issue,close_pull_request,approve_workflow_run,assign_to_agent, …) are not applied, with an explicit failure summary and a machine-readable outcome (WTD3).Answers to "Also decide":
update_cache_memory: follow the same rule as the existing warn-modewarningcase; don't add a new gate in this fix.report_detector_unavailable(detector install failed or binary missing) already concludeswarningin warn mode, which is consistent with Option B. Keep it.Strict mode (
continue-on-error: false) is unchanged: the detection job fails and safe outputs don't run.fix: replace retired model pins in three workflows (#70328)