Repository navigation
ci: audit agent-assisted pull requests with agent evals - #4446
Tommy Nguyen (tido64) wants to merge 24 commits into
Conversation
Runs `yarn eval` on pull requests authored or co-authored by Copilot, Claude, or Cursor, and reports the results in a sticky comment. Copilot cloud agent session logs are fetched from the Copilot API when possible; otherwise, rules that require the session log are skipped and the comment explains how to run the audit locally. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Agent evals
|
Adds `yarn eval:report`, which runs the evals and posts the report in a comment shared with the Agent evals workflow. The workflow skips the audit if the comment already has a report with the session log for the head of the pull request. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
`copilotSession=current` selects the session whose Copilot process is an ancestor of the evals, i.e. the session running them. `yarn eval:report` uses it by default, so agents audit themselves. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Without a model, the Copilot runtime picks its default, which may not be available to the account and fails with "The requested model is not supported". Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
An empty `copilotSession` now selects the session running the evals, or if there is none, the latest session that is not in use. `previous` always selects the latter. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Groups rules by status, failures first, with a summary and collapsed skipped and passed rules. The terminal output is unchanged. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
… trailer matching Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The report must be posted again after every push, because a new commit makes the workflow replace it. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Re-read the report comment before posting, and keep a full report for the same commit instead of replacing it with a diff-only one - Use the paths from the cloud session log instead of discarding them - Fail if the API returns fewer sessions than the pull request has - Reject invalid pull request numbers in yarn eval:report - Reword the AGENTS.md instructions Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>


Description
Adds a CI pipeline that runs
yarn evalon pull requests assisted by agents and reports the results in a sticky comment. A pull request counts as assisted when Copilot, Claude, or Cursor authored it, authored any of its commits, or co-authored any of its commits through aCo-authored-bytrailer.Workflow (
.github/workflows/agent-evals.yml): runs onpull_request_target, so the base branch's code runs and the PR's code is only read. It only reports; failed rules never fail the check. The workflow uses onlyGITHUB_TOKEN.Session logs: for Copilot cloud agent PRs, the provider fetches the session logs from the Copilot API (
/agents/resource/pull/{id}and/agents/sessions/{id}/events). Those endpoints return the same event schema as a localevents.jsonl.Fallback: if the logs can't be read, the PR is audited from its diff alone. Rules tagged
requires: sessionare skipped and shown as-, and the comment explains how to run the audit locally.Agent-posted reports:
yarn eval:report(inevals/) runs the evals and posts the report in a comment that the agent and the workflow share. The comment is identified by a hidden marker recording the head commit and whether the session log was read.AGENTS.mdinstructs agents to run it after creating or updating a PR. The workflow skips its audit if the comment already has a report with the session log for the head commit; otherwise, it posts the diff-only report and asks for a local run.Note
This is a prototype; docs and tests are pending review. The
pull_requesttrigger markedTEMPlets the workflow run on this PR before it is onmain, and must be removed before merging.In CI,
GITHUB_TOKENcan neither read Copilot cloud agent sessions nor run the grader. The Copilot API rejects it with "400 the Copilot-Integration-Id header does not match the GitHub App that issued this installation access token". Session rules are therefore skipped (-), rubric rules are marked unchecked (!), and the comment asks for a local run.Test plan
yarn eval:report 4446posted a comment with the marker, and CI then updated that same comment, even though it was posted with a user token.With the marker set to
log=yesfor the head commit,yarn eval:report --unless-reported 4446skipped the audit.Locally:
yarn workspace @rnx-kit/evals eval --var pullRequest=4425reads all 37 cloud sessions and audits the session rules.yarn workspace @rnx-kit/evals eval --var pullRequest=4439(a CLI co-authored PR) falls back to the diff-only audit and skips the session rules.In CI: