Skip to content

Harden threat-detection against missing prompt artifact; unblock safe_outputs#36113

Merged
pelikhan merged 4 commits into
mainfrom
copilot/aw-failures-fix-prompt-file-issue
May 31, 2026
Merged

Harden threat-detection against missing prompt artifact; unblock safe_outputs#36113
pelikhan merged 4 commits into
mainfrom
copilot/aw-failures-fix-prompt-file-issue

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 31, 2026

The detection job could fail hard when /tmp/gh-aw/threat-detection/aw-prompts/prompt.txt was missing, producing ERR_PARSE and skipping safe_outputs despite a successful agent job. 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.cjs no longer hard-fails on missing/empty detection prompt context.
    • Emits actionable warnings and continues by generating a fallback detection prompt from workflow metadata and available artifacts.
  • Compiled workflow adds explicit prompt preflight check

    • pkg/workflow/threat_detection.go now emits a guard in Prepare threat detection files that checks for a non-empty prompt file (-s) and logs a clear warning if absent.
    • Makes ordering/artifact issues visible at detection start with an explicit operator hint.
  • Coverage for regression path

    • Added focused tests for:
      • missing prompt artifact → warning + fallback continuation,
      • empty prompt artifact → warning + fallback continuation,
      • compiled detection step contains the preflight warning logic.
# Generated in detection job
- name: Prepare threat detection files
  run: |
    mkdir -p /tmp/gh-aw/threat-detection/aw-prompts
    cp /tmp/gh-aw/aw-prompts/prompt.txt /tmp/gh-aw/threat-detection/aw-prompts/prompt.txt 2>/dev/null || true
    if [ ! -s /tmp/gh-aw/threat-detection/aw-prompts/prompt.txt ]; then
      echo "::warning::ERR_VALIDATION: Missing or empty detection context prompt ..."
    fi

Branch updated by pr-sous-chef from https://github.com/github/gh-aw/actions/runs/26714571223.

Generated by 👨‍🍳 PR Sous Chef · gpt54 9.8M ·

Copilot AI and others added 2 commits May 31, 2026 12: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] Fix missing prompt file for threat-detection job Harden threat-detection against missing prompt artifact; unblock safe_outputs May 31, 2026
Copilot AI requested a review from pelikhan May 31, 2026 12:41
@pelikhan pelikhan marked this pull request as ready for review May 31, 2026 12:43
Copilot AI review requested due to automatic review settings May 31, 2026 12:43
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@github-actions github-actions Bot mentioned this pull request May 31, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Please refresh the branch and rerun checks so the missing prompt-artifact fix can be validated end to end.

Generated by 👨‍🍳 PR Sous Chef · gpt54 9.8M ·

@pelikhan pelikhan merged commit 12b13ff into main May 31, 2026
@pelikhan pelikhan deleted the copilot/aw-failures-fix-prompt-file-issue branch May 31, 2026 15:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[aw-failures] Threat-detection job fails — prompt.txt not found → blocks safe_outputs (Code Simplifier)

3 participants