fix(automations): keep background scan runs single-provider#740
Merged
Conversation
Multi-provider repository scopes left scan payloads unstamped, so dequeue
fell back to the GitHub default and token minting failed on the non-GitHub
repository names ("Failed to create source control token.").
- dependabot-triage: scope to GitHub repositories only (Dependabot alerts
are GitHub-only), stamp sourceControlProvider, and skip when no active
GitHub repository is environment-backed (matching codeql-triage)
- codeql-triage: stamp the provider explicitly
- sentry-triage + suggester routes: partition environment-backed scopes
into per-(provider, host) scan runs with explicit stamps, mirroring the
merged-pr-audit runner
- scheduled-triage-runner: buildScanTask now returns one payload per run
- github-deployment-scope: shared partitionActiveRepositoriesByProvider
- dequeue-helpers: warn when the ambiguous GitHub fallback engages
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Contributor
|
2 issues outstanding. See task
Reviewed 49f8910 |
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.
Problem
Background-automation scan runs whose repository scope spans multiple source-control providers fail at bootstrap with "Failed to create source control token."
A scan payload over a mixed-provider repository set gets no
sourceControlProviderstamp (resolveWorkspaceSourceControlProviderdeliberately returnsundefinedfor ambiguous sets), so dequeue falls back to the GitHub default and GitHub token minting fails withSelected repositories not found— the non-GitHub repository names don't exist in the GitHub installation. This breaks even on deployments with a working GitHub app.Reproduced locally: a scheduled
dependabot_triagescan over a Bitbucket + Azure DevOps repository set was canceled at thecreateSourceControlTokenphase, and a fresh manual trigger reproduced the identical failure.Fix
A run's source-control token is minted for exactly one provider, so every launched scan run must be single-provider:
sourceControlProvider: 'github', and skip when no active GitHub repository is environment-backed — matching codeql-triage's existing behavior.(provider, host)with explicitsourceControlProvider/sourceControlHoststamps and per-partition prompts — mirroring the merged-pr-audit runner's partition pattern.buildScanTasknow returnspayloads: [...]; one task run launches per payload.partitionActiveRepositoriesByProviderhelper (deterministic provider-enum + host ordering, same identity rules as the audit runner).Snapshot-resume provider inheritance was fixed separately (#732/#734); this PR only covers fresh scan/automation launches.
Validation
ado, one stampedbitbucket— both passingcreateSourceControlTokenwith tokens minted for their own providers.pnpm lintandpnpm check-typesclean.pnpm knippasses on this branch (CI Knip job is green, and verified locally from a clean checkout of the branch). The local pre-push knip failure turned out to be environmental, not code: knip walks ancestor.gitignorefiles past the git-worktree boundary, and a worktree nested under a checkout's.agents/worktrees/(which the parent's.gitignoreignores) poisons its analysis with phantom unused-file/export findings. The same commit passes knip from a non-nested directory.🤖 Generated with Claude Code