Skip to content

fix: add safe-outputs.threat-detection.runs-on override for the detection job runner#28287

Closed
Copilot wants to merge 4 commits intomainfrom
copilot/fix-detection-step-runs-on-inheritance
Closed

fix: add safe-outputs.threat-detection.runs-on override for the detection job runner#28287
Copilot wants to merge 4 commits intomainfrom
copilot/fix-detection-step-runs-on-inheritance

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 24, 2026

The detection job always used ubuntu-latest with no way to override it from within the workflow frontmatter. Unlike other framework jobs, the detection job intentionally does not inherit runs-on-slim or safe-outputs.runs-on because it has different networking and compute requirements.

Changes

  • safe_outputs_runtime.go — New formatDetectionJobRunsOn() helper: uses safe-outputs.threat-detection.runs-on when set, otherwise defaults to ubuntu-latest.

  • threat_detection.gobuildDetectionJob now delegates to formatDetectionJobRunsOn() instead of the inline hardcoded value.

  • safe_outputs_runs_on_test.go — Unit tests for the new helper and integration tests asserting that the detection job section uses the expected runner and that runs-on-slim/safe-outputs.runs-on do not bleed through.

  • self-hosted-runners.md — Restored original documentation wording: detection job defaults to ubuntu-latest; override with safe-outputs.threat-detection.runs-on.

Example

To run the detection job on a specific runner (e.g. when your self-hosted runner lacks outbound internet access for AI detection):

runs-on: [self-hosted, linux, x64]
runs-on-slim: self-hosted
safe-outputs:
  create-issue: {}
  threat-detection:
    runs-on: ubuntu-latest

Without threat-detection.runs-on, the detection job always uses ubuntu-latest regardless of runs-on-slim or safe-outputs.runs-on.

Copilot AI and others added 2 commits April 24, 2026 14:42
…tputs.runs-on

The detection job previously defaulted to ubuntu-latest regardless of any
runs-on or runs-on-slim frontmatter settings. Now the precedence is:

1. safe-outputs.threat-detection.runs-on  (highest)
2. safe-outputs.runs-on
3. runs-on-slim
4. ubuntu-latest (default)

Adds formatDetectionJobRunsOn() helper, tests, and updated docs."

Agent-Logs-Url: https://github.com/github/gh-aw/sessions/09ad97a3-118c-4077-acae-d2ee8efde6ac

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
…ssert.Equal in tests

Agent-Logs-Url: https://github.com/github/gh-aw/sessions/09ad97a3-118c-4077-acae-d2ee8efde6ac

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix detection step runs-on not inherited from runs-on or runs-on-slim fix: detection job does not inherit runs-on from runs-on-slim or safe-outputs.runs-on Apr 24, 2026
Copilot AI requested a review from pelikhan April 24, 2026 14:47
Comment thread pkg/workflow/safe_outputs_runtime.go Outdated
Comment on lines +59 to +62
if data.RunsOnSlim != "" {
safeOutputsRuntimeLog.Printf("Detection job runs-on from runs-on-slim: %s", data.RunsOnSlim)
return "runs-on: " + data.RunsOnSlim
}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@copilot should not rely on runs-on-slim

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.

Reverted in 01a2e6e. runs-on-slim no longer affects the detection job.

Comment thread pkg/workflow/safe_outputs_runtime.go Outdated
safeOutputsRuntimeLog.Printf("Detection job runs-on from threat-detection config: %s", td.RunsOn)
return "runs-on: " + td.RunsOn
}
if so.RunsOn != "" {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@copilot should not rely on safe-outputs.runs-on

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.

Reverted in 01a2e6e. The detection job now only uses safe-outputs.threat-detection.runs-on and defaults to ubuntu-latestsafe-outputs.runs-on and runs-on-slim no longer propagate to it.

…runs-on override is supported

Per reviewer feedback, the detection job should not inherit from
safe-outputs.runs-on or runs-on-slim. It always defaults to ubuntu-latest
unless safe-outputs.threat-detection.runs-on is explicitly set.

Update tests and docs accordingly.

Agent-Logs-Url: https://github.com/github/gh-aw/sessions/1ad21e49-e78c-4836-b733-ca9ed34e0329

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title fix: detection job does not inherit runs-on from runs-on-slim or safe-outputs.runs-on fix: add safe-outputs.threat-detection.runs-on override for the detection job runner Apr 24, 2026
Copilot AI requested a review from pelikhan April 24, 2026 15:19
@pelikhan pelikhan closed this Apr 24, 2026
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.

[Bug] Detection step runs-on not inherited from runs-on or runs-on-slim

2 participants