Skip to content

ci: run CodeQL from a workflow so fork pull requests get analyzed - #70

Merged
avifenesh merged 1 commit into
mainfrom
fix/codeql-fork-pr-coverage
Aug 18, 2026
Merged

ci: run CodeQL from a workflow so fork pull requests get analyzed#70
avifenesh merged 1 commit into
mainfrom
fix/codeql-fork-pr-coverage

Conversation

@avifenesh

Copy link
Copy Markdown
Collaborator

Summary

CodeQL default setup never produced an analysis for pull requests from forks. The main ruleset requires code_scanning (CodeQL), so external contributions were unsatisfiable by construction — #69 was fully green and approved and still had to be merged with an admin override. The gate was theatre for exactly the pull requests it should cover.

A workflow living in the repository does run for fork pull requests, so this replaces default setup with advanced setup and the required check now exists for contributors as well as maintainers.

  • Default setup disabled (leaving it on makes these SARIF uploads conflict).
  • Language set and query suite match what default setup was configured with: actions, javascript-typescript, rust, security-extended.
  • build-mode: none for all three, so analysis stays source-based — no system packages, no gpui git checkout, no full build per pull request.
  • Weekly cron kept, so newly published queries still reach main between pushes.
  • Actions SHA-pinned with a version comment, matching the rest of .github/workflows.

Checklist

  • cargo fmt --check passes — N/A, no Rust change
  • cargo clippy --locked -- -D warnings passes — N/A, no Rust change
  • cargo test --locked passes — N/A, no Rust change
  • git diff --check is clean
  • scripts/integration_smoke.sh — N/A, no runtime behavior change
  • No secrets, credentials, personal data, or machine-specific absolute paths added
  • Docs updated if behavior, flags, or the permission/trust model changed — N/A

Notes for reviewers

The thing to watch on this PR is its own CodeQL (…) checks: they are the proof the replacement works. Merging is what makes the required check reachable for the next external contribution.

CodeQL default setup never produced an analysis for pull requests from forks.
The `code_scanning` rule on `main` requires one, so external contributions
were unsatisfiable by construction and #69 could only be merged with an admin
override — the gate was theatre for exactly the pull requests it should cover.

Replace default setup with an advanced setup workflow. A workflow living in
the repository does run for fork pull requests, so the required check now
exists for contributors as well as maintainers. Default setup is disabled;
leaving it on would make these SARIF uploads conflict.

Analysis stays source-based with `build-mode: none` for all three languages,
so a pull request pays no system packages, no gpui git checkout, and no full
build. Query suite and language set match what default setup was configured
with.
Copilot AI lite review requested due to automatic review settings August 18, 2026 22:18

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@revuto-review revuto-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This is an auto review done by revuto.


Reviewed .github/workflows/codeql.yml against the pinned codeql-action@ff2f1c6 (v4.37.7) sources.

Verified: the analyze action always attempts the SARIF upload on pull_request events (upload-lib.ts uploadPayload has no fork-token guard), and the CodeQL (…) check runs from this PR are already reporting success against the head SHA — so the check exists and can satisfy the code_scanning required check. Workflow-level permissions: contents: read plus job-level security-events: write is the documented advanced-setup shape. build-mode: none is valid for all three languages (actions/js-ts are interpreted; rust none-build is supported), and avoids the gpui/system-dep build. SHA pinning matches the sibling workflows.

Nothing clears the bar for a finding:

  • Fork-PR behavior: for same-repo and fork PRs, GitHub forces GITHUB_TOKEN to read-only on pull_request events when the repo sets restrictive defaults, but the explicit job-level security-events: write grants the upload, and on fork PRs where the token is downgraded the action surfaces a clear 403-style error rather than silently skipping — the check would fail loudly, not pass vacuously. The PR's own runs (which did upload: "No new alerts in code changed by this pull request") prove the happy path works.
  • Weekly cron + push: main keeps main analyzed between pushes; cancel-in-progress scoped to pull_request is safe since alerts are attributed to the main/scheduled runs.
  • No MCP stdio, Rust, installer, npm, skill, or docs surface is touched, so none of the repo-specific isolation/stdio/idempotency contracts apply.

Clean change; no inline comments.

@avifenesh

Copy link
Copy Markdown
Collaborator Author

Self-review

Copilot hit its quota on this PR and revuto's check run reports Revuto found review concerns while its review body says "Clean change; no inline comments" and it posted none — separate revuto bug, filing that on its own. So the verification here is mine.

The claim this PR makes is that advanced setup produces the analysis the code_scanning rule wants. Checked directly rather than trusting the green checks:

GET /code-scanning/analyses?ref=refs/pull/70/merge
  /language:rust                   CodeQL  0 results
  /language:javascript-typescript  CodeQL  0 results
  /language:actions                CodeQL  0 results

Three analyses attributed to the pull request ref, tool CodeQL — which is what the rule matches on, so the required check is now reachable from a workflow rather than only from default setup. CodeQL (rust) passing also settles that build-mode: none is valid for Rust; that was the one input I could not confirm from the action's sources ahead of the run.

Default setup is not-configured as of this change, so there is no upload conflict.

Merging with an admin override for the same reason #69 needed one: solo approval requirement with Copilot out of quota. That's the last fork pull request that should ever need it.

@avifenesh
avifenesh merged commit 0fa40d8 into main Aug 18, 2026
8 of 9 checks passed
@avifenesh
avifenesh deleted the fix/codeql-fork-pr-coverage branch August 18, 2026 22:26
avifenesh added a commit to avifenesh/revuto that referenced this pull request Aug 18, 2026
…lled (#81)

`summarizeReviewSteps` set `hasFindings` whenever `post_review` or
`post_issue_comment` appeared in a step, without looking at the result. Two
false reports came out of that:

- A clean review posted through `post_review` with an empty `comments` array
  failed the check as "Revuto posted one or more findings on the pull request.
  Address the review comments and push a new head." — on a pull request with no
  comments at all. Observed on agent-sh/agent-workspace-linux#70, where the
  review body itself said "Clean change; no inline comments".
- A `post_review` the API rejected also set `hasFindings`, so a run that put
  nothing on the pull request reported posted findings, and a `skip_review`
  after the failure would have reported a clean review the reviewer never
  managed to publish.

Findings now come from calls that succeeded. A posting call that failed is
counted in a new `postFailures`, and the check fails on it with what actually
happened rather than claiming findings exist.

The clean-review case is settled at the tool instead of guessed at afterwards:
`post_review` refuses an empty `comments` array and points at `skip_review`,
which is the path that lets the App submit the approval. The system prompt
already said not to post a "looks good" review; now the tool holds that line.
That refusal carries its own error code, and it is deliberately not a
`postFailure` — it drops nothing, so the `skip_review` that follows stays a
clean pass instead of moving the same false failure to a new field.
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.

2 participants