Harden threat-detection against missing prompt artifact; unblock safe_outputs#36113
Merged
Conversation
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] Fix missing prompt file for threat-detection job
Harden threat-detection against missing prompt artifact; unblock safe_outputs
May 31, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR hardens the threat-detection setup so missing or empty workflow prompt artifacts are reported as warnings instead of blocking the detection pipeline and downstream safe_outputs.
Changes:
- Adds a generated workflow preflight warning when the detection prompt context is missing or empty.
- Changes threat-detection JS setup to continue with fallback workflow metadata when prompt context is unavailable.
- Adds focused Go and Vitest coverage for the new warning/fallback paths.
Show a summary per file
| File | Description |
|---|---|
pkg/workflow/threat_detection.go |
Adds shell preflight warning for missing/empty detection prompt context. |
pkg/workflow/threat_detection_test.go |
Verifies the compiled prepare step includes the new warning logic. |
actions/setup/js/setup_threat_detection.cjs |
Softens prompt-context validation and substitutes an unavailable marker. |
actions/setup/js/setup_threat_detection.test.cjs |
Covers missing and empty prompt artifact fallback behavior. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 4/4 changed files
- Comments generated: 0
Contributor
|
Please refresh the branch and rerun checks so the missing prompt-artifact fix can be validated end to end.
|
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.
The
detectionjob could fail hard when/tmp/gh-aw/threat-detection/aw-prompts/prompt.txtwas missing, producingERR_PARSEand skippingsafe_outputsdespite a successfulagentjob. This change makes missing prompt context a diagnosable warning path instead of a pipeline blocker.Detection setup now degrades gracefully
actions/setup/js/setup_threat_detection.cjsno longer hard-fails on missing/empty detection prompt context.Compiled workflow adds explicit prompt preflight check
pkg/workflow/threat_detection.gonow emits a guard inPrepare threat detection filesthat checks for a non-empty prompt file (-s) and logs a clear warning if absent.Coverage for regression path
Branch updated by pr-sous-chef from https://github.com/github/gh-aw/actions/runs/26714571223.