Repository navigation
Move Code Scanning Fixer onto the native work queue - #79600
Conversation
- Add code-scanning-dispatcher: admits up to three severity-ranked open alerts per run into a dedicated code-scanning pool (concurrency 3) and stages one bounded dispatch request. - Add code-scanning-fixer-worker: assignment-only worker that fixes one alert per Claim and finishes the Claim completed after a PR, or cancelled with noop. - Add code_scanning_portfolio.cjs plan builder and tests; queue identity and retries replace the cache-memory ledger, checkpoints and stalled-alert diagnostics. - Remove code-scanning-fixer and its selector test; retarget tool-permission and contract tests to the worker.
…nning queue - Rank AI Scan findings first, then severity and alert number; admit up to three clusters per run of at most five alerts sharing scanner, rule and parent directory, never sharing an alert file within a batch. - Skip alerts any open pull request covers (changed or renamed file, canonical URL, #N beside an alert keyword, or the fixer's cluster marker); fail closed when a pull request's files cannot be listed completely. - Gate pre-activation on an uncovered open alert, and re-check coverage in the worker's pre-agent step before the agent runs. - Completed Work blocks only through its open pull request; a closed pull request makes the alerts new Work. Fingerprints whose retries ran out stay suppressed until they change. - Run the dispatcher every 4 hours; remove the cache-based context and selector scripts superseded by the plan builder.
|
🧠 Matt Pocock Skills Reviewer is reviewing this pull request using Matt Pocock's engineering skills... |
|
✅ PR Code Quality Reviewer completed the code quality review. Caution agentic threat detected DetailsPotential security threats were detected in the agent output. Detected threat types: prompt injection. Review the workflow run logs for details. PR Code Quality ReviewerOutcome: The agent completed and reported one or more actions. The no-op output is a completion signal, not a claim that no action was taken. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
✅ Test Quality Sentinel completed test quality analysis. Test Quality SentinelOutcome: The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
✅ Ponytail Reviewer completed successfully! Ponytail ReviewerOutcome: The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
✅ PR Specification Reviewer completed successfully! Caution agentic threat detected DetailsPotential security threats were detected in the agent output. Detected threat types: prompt injection. Review the workflow run logs for details. PR Specification ReviewerOutcome: The agent completed and reported one or more actions. The no-op output is a completion signal, not a claim that no action was taken. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
Comment MemoryPeek at saved memory (spec-review-history)History |
There was a problem hiding this comment.
Caution
agentic threat detected
Threat detection flagged this output in warn mode. Manual review is REQUIRED before any follow-up automation.
Details
Potential security threats were detected in the agent output. Detected threat types: prompt injection.
Review the workflow run logs for details.
Reviewed the current diff and changed-line behavior, including the queue planner, PR coverage detection, worker assignment projection, and staged dispatcher/worker contracts. I found no actionable correctness, performance, or maintainability issues that warrant blocking this change. Static review only; tests were not run by this reviewer.
🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt50 · ~7 AIC · ⌖ ~2 AIC · ⊞ 1.6K
Comment /review to run again
Comment MemoryPeek at saved memory (review-history)History |
- Run the dispatcher's pre-activation gate, its planning step and the worker's pre-agent step from the workflow sources, in-realm as actions/github-script does, against the real setup modules, an Octokit double and a ledger built with the installed code-scanning Policy. - Check the compiled wiring: pre-activation gate and permissions, dispatcher and worker queue roles, the worker allowlist, and the selection step running before the agent.
There was a problem hiding this comment.
🟡 Changes recommended
The worker’s sed permission enables sandbox command-restriction bypasses, and plaintext queue fingerprints expose restricted scanner messages in public repositories.
8 open issues
Restrict sed to sandboxed execution · New Persist opaque digests instead of plaintext fingerprints · New Add run-specific workflow concurrency to allow parallel assignments · New Validate rename and copy source paths · New Enforce the payload limit for singleton clusters · New Preserve severity ordering when selecting queued Work · New Keep Work live until delivery is verified or proven effect-free · New Suppress fingerprints only for exhausted retries · New
What changed in this PR
This PR moves the repository’s Code Scanning Fixer onto gh-aw’s native work queue, replacing cache-based coordination while preserving AI Scan-first clustering and open-PR deduplication.
Changes:
- Adds a four-hour dispatcher and an assignment-only worker that fixes clusters of up to five alerts.
- Introduces a dedicated pool with three concurrent Claims and a three-attempt retry budget.
- Ports selection and lifecycle coverage to JavaScript and removes the legacy workflow, helpers, and tests.
| File | Description |
|---|---|
scripts/workflow-tool-contracts.test.cjs |
Updates restricted-tool checks for the queue worker. |
scripts/code-scanning-fixer-selection.test.cjs |
Removes legacy selector tests. |
pkg/workflow/reported_tool_permissions_test.go |
Checks the renamed worker’s tool permissions. |
Makefile |
Removes the deleted selection-test invocation. |
docs/src/content/docs/agent-factory-status.mdx |
Removes the obsolete fixer status entry. |
actions/setup/js/work_queue_binding_policy.test.cjs |
Expects the new code-scanning pool. |
actions/setup/js/code_scanning_portfolio.test.cjs |
Covers ranking, deduplication, and queue lifecycle. |
actions/setup/js/code_scanning_portfolio.cjs |
Plans alert clusters and projects worker assignments. |
.github/workflows/code-scanning-fixer.md |
Removes the monolithic cache-based fixer. |
.github/workflows/code-scanning-fixer-worker.md |
Defines assignment processing and Claim outcomes. |
.github/workflows/code-scanning-fixer-worker.lock.yml |
Compiles worker execution and queue lifecycle wiring. |
.github/workflows/code-scanning-dispatcher.md |
Defines scheduled planning and staged dispatch. |
.github/workflows/aw.json |
Adds the three-slot code-scanning pool. |
.github/scripts/code-scanning-fixer-select.jq |
Removes the cache-based alert selector. |
.github/scripts/code-scanning-fixer-context.sh |
Removes legacy API and context collection. |
.changeset/patch-code-scanning-work-queue.md |
Records the migration in release notes. |
Review effort: Max (adaptive)
| require-assignment: true | ||
| worker: true | ||
| cli-proxy: true | ||
| bash: ["cat:*", cut, "git diff:*", "git diff --binary --no-ext-diff | wc -c", "git restore:*", "git status:*", grep, "head:*", jq, ls, "sed:*", tail, wc] |
| * Compact JSON of [rule_id, path, line, message]; any change is a new finding. | ||
| * @param {any} alert | ||
| */ | ||
| function alertFingerprint(alert) { | ||
| const instance = alert.most_recent_instance ?? {}; | ||
| return JSON.stringify([alert.rule?.id ?? "", alertPath(alert), instance.location?.start_line ?? 0, truncate(instance.message?.text, 256)]); |
| on: | ||
| workflow_dispatch: | ||
| concurrency: | ||
| job-discriminator: ${{ github.run_id }} |
| for (const pull of pulls) { | ||
| const files = await github.paginate(github.rest.pulls.listFiles, { ...repo, pull_number: pull.number, per_page: 100 }); | ||
| if (files.length >= MAX_PULL_FILES) throw new Error(`Could not completely inspect changed files for pull request #${pull.number}: GitHub lists at most ${MAX_PULL_FILES}`); | ||
| if (files.some((/** @type {any} */ file) => typeof file?.filename !== "string" || !file.filename)) throw new Error(`Invalid changed-file listing for pull request #${pull.number}`); |
| */ | ||
| function clusterNode(members, repository, repositoryId) { | ||
| // An oversized payload would make admission reject the whole batch. | ||
| while (members.length > 1 && canonicalBytes(clusterPayload(members, repository, repositoryId)) > DEFAULT_LIMITS.payload_bytes) members = members.slice(0, -1); |
| // Earlier attempts on these alerts make a retry after a closed pull request a new Work identity. | ||
| node_key: digest({ alerts: members.map(member => [member.number, member.fingerprint]), after: [...new Set(members.flatMap(member => member.prior))].sort() }), | ||
| pool: POOL, | ||
| priority: isAIScan(lead.alert) ? 1 : 7 - Math.max(2, severityRank(lead.alert)), |
| if (work?.pool !== POOL) continue; | ||
| const payload = work.payload; | ||
| if (typeof work.graph_id !== "string" || !work.graph_id.startsWith(GRAPH_PREFIX) || typeof payload?.cluster_key !== "string" || !Array.isArray(payload.alerts)) throw new Error("Code scanning queue Work is malformed"); | ||
| const live = !TERMINAL.has(work.state); |
| stored.push(work); | ||
| if (live) liveClusters.add(payload.cluster_key); | ||
| for (const member of payload.alerts) { | ||
| attempts.set(member.number, [...(attempts.get(member.number) ?? []), { work_id: work.work_id, live, cancelled: work.state === "cancelled", fingerprint: member.fingerprint }]); |
|
🍳 A little prep to help this PR along! Copilot assignment requested for the following outstanding work:
Keeping the changes focused; human review and CI get the final taste test. No merging or CI triggering. Structured data{
"completed_task": 0,
"head": "bd912466ae88020ff8544f2b079e9219fdf504d9",
"kind": "requested",
"schema_version": "1",
"state": "828b578bbd6a58c61f9632c3f18433e676c2e6ee2c626f0a7f968b5fd9790ae7",
"work": [
"046b162e70e22b7867c93960c166b9a6d5a7365c83c2cef2dcbe51c9a9e12945",
"114152b8a58c02c608da6e2a7c1a09348c5111c9601bec2992033883cff223e1",
"13ff18db75176d6e679abc16503d3c59b1ed870f6eac91634cc8acf7e60995cf",
"30276a6c00e796e62b1ee3caacd25853b3489303b4037b956adf9afef837c4eb",
"9335014caebe0fa03f93b9d81980cde7f4d9ef4c34a918110a837edd91c572e3",
"a65a473ba434e565e1f4b571f8c5fdf14c36e98a61af367eb8c9d3646d10a519",
"e54fd7e1a2305482408501a1c23e63a1e23f49e870e644301e357a3f01118815",
"e6e58660f42ef83390efe5fcfa3a02eed62b50f64743b06a06c2f02773c63945"
],
"workflow": "pr-sous-chef"
}
|


Moves the Code Scanning Fixer onto the native work queue and ports the AI Scan-first clustering and open-PR deduplication from #79559 into the queue design.
What changes
code-scanning-dispatcher(new, every 4h). A trusted step lists open alerts and every open PR with its complete changed-file list, builds the plan withactions/setup/js/code_scanning_portfolio.cjs, and stagessubmit+dispatch_next. Pre-activation skips the run when no open alert is left uncovered by an open PR.code-scanning-fixer-worker(new). Assignment-only. One Claim is one cluster of up to 5 alerts, fixed in one PR. The worker finishes the Claimcompletedafter the PR intent is accepted, otherwise emitsnoopand cancels. Before the agent starts, it re-checks open PRs and drops alerts they now cover.code-scanning(concurrency 3, 3 attempts) in.github/workflows/aw.json. The other dispatcher locks change only because each embeds the full queue policy.code-scanning-fixer.mdand its lock,.github/scripts/code-scanning-fixer-context.sh,.github/scripts/code-scanning-fixer-select.jq,scripts/code-scanning-fixer-selection.test.cjs. Their cases are ported tocode_scanning_portfolio.test.cjs.actions/setup/js/smoke_work_queue_workflows.test.cjsnow runs the dispatcher's pre-activation gate, its planning step and the worker's pre-agent step straight from the workflow sources. They run the wayactions/github-scriptruns them, against the real setup modules, an Octokit test double and a ledger built with the installed code-scanning Policy. The suite also checks the compiled wiring: the gate and its permissions in pre-activation, the dispatcher and worker queue roles, the worker allowlist, and the selection step running before the agent.Behaviour kept from #79559
AI Scanor rule prefixai-scan/), then severity, then alert number.Code scanning cluster: KEYmarker. The key uses the same encoding as Prioritize and batch AI Scan fixes without duplicating open PRs #79559, so[code-scanning-fix]PRs already open keep blocking their clusters.#Nnext to an alert keyword, or carries its cluster marker. Planning fails closed if any PR's files can't be listed completely (error, invalid entry, or 3,000-file cap).Differences from #79559
levelinputrouter/balancedKnown edge: if an open PR starts covering a queued cluster before its worker runs, the worker cancels. If that exhausts the retries, the alert stays suppressed after the PR closes, until its fingerprint changes (any line shift does that).
Validation
make agent-report-progress: all stages pass. The first run hit Go lint's 10-minute timeout on a cold cache;golangci-lint run --timeout 40m ./pkg/workflowreports 0 issues.npx vitest run code_scanning_portfolio.test.cjs: 9/9, covering ranking, clusters, every coverage rule, the queue lifecycle against a real ledger, worker projection, and fail-closed PR listing.npx vitest run smoke_work_queue_workflows.test.cjs: 11/11, including the 3 code scanning regression cases.aw.jsonor lock files: 258/258.node --test scripts/workflow-tool-contracts.test.cjs: 7/7.go test ./pkg/workflow -run TestReportedWorkflowToolPermissions: pass.make recompile: 370/370 compiled, no drift outside this change. Rebased on6238b139cfand recompiled the 6 affected locks with no drift.Not dispatched live.