-
Notifications
You must be signed in to change notification settings - Fork 102
Fix detection job checkout failure from missing contents permission #14698
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Detection job now gets `contents: read` permission when running in dev/script mode (where checkout is needed) - In release mode (no checkout needed), detection job continues to use empty permissions - Added test to verify detection job permissions in both dev and release modes - Updated existing test to account for new permission behavior - Recompiled all workflows with correct permissions Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Fixes a permissions mismatch in the compiled “detection” job: when dev/script mode injects an actions/checkout step (“Checkout actions folder”), the job now receives contents: read instead of permissions: {}, preventing checkout failures due to an unscoped GITHUB_TOKEN.
Changes:
- Update detection job permission rendering to conditionally set
contents: readonly when the checkout-actions-folder step is present (dev/script modes). - Update existing threat detection job unit test expectations to reflect the new permission behavior.
- Add focused regression tests for detection job permissions in dev vs release mode and regenerate affected compiled workflow lock files.
Reviewed changes
Copilot reviewed 141 out of 141 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/workflow/threat_detection.go | Conditionally renders detection job permissions (contents: read only when local actions checkout is injected). |
| pkg/workflow/threat_detection_test.go | Updates expected permissions for the detection job based on action mode. |
| pkg/workflow/detection_permissions_test.go | Adds regression tests validating detection job permissions with/without checkout. |
| .github/workflows/workflow-skill-extractor.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/workflow-normalizer.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/workflow-health-manager.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/workflow-generator.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/weekly-issue-summary.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/video-analyzer.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/unbloat-docs.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/ubuntu-image-analyzer.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/typist.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/tidy.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/test-project-url-default.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/test-dispatcher.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/test-create-pr-error-handling.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/terminal-stylist.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/technical-doc-writer.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/super-linter.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/sub-issue-closer.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/step-name-alignment.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/static-analysis-report.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/stale-repo-identifier.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/smoke-test-tools.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/smoke-project.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/smoke-opencode.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/smoke-copilot.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/smoke-codex.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/smoke-claude.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/slide-deck-maintainer.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/sergo.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/semantic-function-refactor.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/security-review.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/security-guard.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/security-compliance.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/scout.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/schema-consistency-checker.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/safe-output-health.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/research.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/repository-quality-improver.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/repo-tree-map.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/repo-audit-analyzer.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/release.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/q.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/python-data-charts.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/prompt-clustering-analysis.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/pr-triage-agent.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/pr-nitpick-reviewer.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/portfolio-analyst.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/poem-bot.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/plan.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/pdf-summary.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/org-health-report.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/notion-issue-summary.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/mergefest.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/mcp-inspector.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/lockfile-stats.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/layout-spec-maintainer.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/jsweep.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/issue-triage-agent.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/issue-monster.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/issue-classifier.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/issue-arborist.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/instructions-janitor.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/hourly-ci-cleaner.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/grumpy-reviewer.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/go-pattern-detector.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/go-logger.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/go-fan.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/glossary-maintainer.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/github-remote-mcp-auth-test.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/github-mcp-tools-report.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/github-mcp-structural-analysis.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/functional-pragmatist.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/firewall-escape.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/example-workflow-analyzer.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/duplicate-code-detector.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/draft-pr-cleanup.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/docs-noob-tester.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/discussion-task-miner.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/dictation-prompt.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/developer-docs-consolidator.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/dev.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/dev-hawk.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/dependabot-project-manager.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/dependabot-go-checker.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/dependabot-burner.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/delight.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/deep-report.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/daily-workflow-updater.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/daily-testify-uber-super-expert.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/daily-team-status.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/daily-team-evolution-insights.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/daily-syntax-error-quality.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/daily-semgrep-scan.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/daily-secrets-analysis.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/daily-safe-output-optimizer.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/daily-repo-chronicle.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/daily-regulatory.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/daily-performance-summary.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/daily-observability-report.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/daily-news.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/daily-multi-device-docs-tester.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/daily-mcp-concurrency-analysis.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/daily-issues-report.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/daily-firewall-report.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/daily-file-diet.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/daily-doc-updater.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/daily-copilot-token-report.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/daily-compiler-quality.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/daily-code-metrics.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/daily-cli-tools-tester.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/daily-cli-performance.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/daily-choice-test.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/daily-assign-issue-to-user.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/craft.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/copilot-session-insights.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/copilot-pr-prompt-analysis.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/copilot-pr-nlp-analysis.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/copilot-pr-merged-report.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/copilot-cli-deep-research.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/copilot-agent-analysis.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/commit-changes-analyzer.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/code-simplifier.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/code-scanning-fixer.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/cloclo.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/cli-version-checker.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/cli-consistency-checker.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/claude-code-user-docs-review.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/ci-doctor.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/ci-coach.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/changeset.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/breaking-change-checker.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/brave.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/blog-auditor.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/auto-triage-issues.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/audit-workflows.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/artifacts-summary.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/archie.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/agent-persona-explorer.lock.yml | Detection job now has permissions: contents: read. |
| .github/workflows/agent-performance-analyzer.lock.yml | Detection job now has permissions: contents: read. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // Extract detection job section | ||
| detectionStart := strings.Index(yaml, " detection:") | ||
| require.Greater(t, detectionStart, 0, "Detection job not found") | ||
|
|
||
| // Find the next job by looking for a line that starts with " " followed by a lowercase letter and ":" | ||
| // This matches job definitions like " agent:", " safe_outputs:", etc. | ||
| searchStart := detectionStart + len(" detection:") | ||
| nextJobPattern := "\n " | ||
| var detectionSection string | ||
|
|
||
| // Search for the next job |
Copilot
AI
Feb 9, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test reimplements job-section extraction via manual string scanning. There is already an extractJobSection(yamlContent, jobName) helper in pkg/workflow/compiler_test_helpers.go used across other tests; using it here would reduce duplication and make the test less brittle to formatting changes (indentation, new fields, etc.).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 2316145 - now using the existing extractJobSection helper from compiler_test_helpers.go instead of reimplementing the extraction logic.
| detectionStart := strings.Index(yaml, " detection:") | ||
| require.Greater(t, detectionStart, 0, "Detection job not found") | ||
|
|
Copilot
AI
Feb 9, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
require.Greater(t, detectionStart, 0, ...) will fail if the substring happens to start at index 0. Using require.NotEqual(t, -1, detectionStart, ...) (or GreaterOrEqual(..., 0)) is the correct way to assert that strings.Index found a match.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 2316145 - replaced require.Greater(t, detectionStart, 0, ...) with require.NotEmpty(t, detectionSection, ...) which correctly handles all cases including when the job section is at index 0.
| compiler := NewCompiler() | ||
| // Set to release mode (default) - no checkout needed | ||
| compiler.actionMode = ActionModeRelease | ||
|
|
Copilot
AI
Feb 9, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment says “Set to release mode (default)”, but NewCompiler() defaults to version dev and action-mode dev (auto-detected). Consider rewording to avoid implying release is the default, or explicitly set compiler.version to a non-dev value when exercising release-mode behavior.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 2316145 - updated the comment to clarify that dev mode is the default: "Set to dev mode to trigger checkout (dev is also the default)" and removed the misleading "(default)" text from the release mode test.
|
🎬 THE END — Smoke Claude MISSION: ACCOMPLISHED! The hero saves the day! ✨ |
|
🧪 Smoke Project is now testing project operations... |
|
✅ Changeset Generator completed successfully! |
|
✨ The prophecy is fulfilled... Smoke Codex has completed its mystical journey. The stars align. 🌟 |
|
📰 BREAKING: Smoke Copilot is now investigating this pull request. Sources say the story is developing... |
Agent Container Tool Check
Result: 10/12 tools available Missing tools:
|
|
✅ Smoke Project completed successfully. All project operations validated. |
|
PR titles: chore: create workflow video with voice over; docs: update architecture documentation
|
Smoke Test Results - Run 21845575538PRs Tested:
Results: ✅ GitHub MCP | ✅ Safe Inputs | ✅ Serena | ✅ Playwright | ✅ File I/O | ✅ Build | ✅ Workflow Dispatch Overall: ✅ PASS @pelikhan
|
|
📰 VERDICT: Smoke Copilot has concluded. All systems operational. This is a developing story. 🎤 |
- Use extractJobSection helper instead of manual string parsing - Fix linter error: use require.NotEmpty instead of require.Greater for index check - Fix comment: clarify that dev mode is the default, not release mode Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Fixed in 2316145 - resolved the linter errors by using |
Fix detection job
permissions: {}preventingactions/checkoutfrom succeedingProblem
The
detectionjob hadpermissions: {}but included a checkout step when running in dev/script mode, causing a 404 error because theGITHUB_TOKENhad nocontents: readpermission.Solution
contents: readpermission when checkout is neededbuildThreatDetectionJobto conditionally set permissions based on whether checkout is neededactionMode.IsDev() || actionMode.IsScript())make agent-finishbefore committingChanges
pkg/workflow/threat_detection.go: UpdatedbuildThreatDetectionJobto check if checkout is needed and setcontents: readpermission accordinglypkg/workflow/detection_permissions_test.go: Added comprehensive tests for both dev mode (with checkout) and release mode (without checkout), now uses existingextractJobSectionhelperpkg/workflow/threat_detection_test.go: Updated existing test expectations to account for conditional permissions.lock.ymlfiles: Recompiled with correct permissionsOriginal prompt
permissions: {}preventsactions/checkoutfrom succeeding #14692💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.
Changeset
contents: readwhenever it injectsactions/checkout, mirroring the agent job permissions.