Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
83 commits
Select commit Hold shift + click to select a range
f5f264c
feat(agent-review): Python foundation for porting the scripts (M1)
egparedes Nov 14, 2026
7c637f2
test(agent-review): make the structure tests independent of the port …
egparedes Nov 14, 2026
71d31a6
fix(agent-review): close gaps in the Python rules found in review
egparedes Nov 14, 2026
ff2bb60
test(agent-review): probe legacy '##[' commands from sandbox output
egparedes Nov 14, 2026
6da96df
fix(agent-review): stop legacy '##[' workflow commands from sandbox o…
egparedes Nov 14, 2026
90c2061
feat(agent-review): say why files.read_bytes refused a file
egparedes Nov 14, 2026
a69560b
feat(agent-review): port collect-result to Python (M3)
egparedes Nov 14, 2026
de937a4
fix(agent-review): let gh.api take bot logins in the endpoint path
egparedes Nov 14, 2026
ef42cdc
feat(agent-review): gh.api can treat output on stderr as a failure
egparedes Nov 14, 2026
bd065a9
feat(agent-review): runner.run can send stdout to a descriptor
egparedes Nov 14, 2026
62d9e32
test(agent-review): allow the shutil module in the Python code
egparedes Nov 14, 2026
6e69751
test(agent-review): drop the legacy collect-result and its differenti…
egparedes Nov 14, 2026
8a34aec
feat(agent-review): port publish-comment to Python (M2, commit A)
egparedes Nov 14, 2026
baa2ea9
docs(agent-review): state collect-result's FIFO handling precisely
egparedes Nov 14, 2026
870cb9d
feat(agent-review): run-review reset and post-condition in Python (M4…
egparedes Nov 14, 2026
817f2e5
feat(agent-review): run-review prompt rendering in Python (M4, 2/3)
egparedes Nov 14, 2026
cf534c5
chore(agent-review): delete the legacy bash publish-comment (M2, comm…
egparedes Nov 14, 2026
0ad9acc
docs(agent-review): scope the 'no log' claim of invariant 5 to the pu…
egparedes Nov 14, 2026
5509097
feat(agent-review): port run-review to Python (M4, 3/3; D5 commit A)
egparedes Nov 14, 2026
a3512cf
fix(agent-review): exact truncation note, atomic cut (behaviour change)
egparedes Nov 14, 2026
f0d8c11
test(agent-review): one engine leaves no two-engine mismatch to catch
egparedes Nov 14, 2026
e40c000
feat(agent-review): port authorize to Python (M5, commit A)
egparedes Nov 14, 2026
185d8fa
fix(agent-review): keep UnsafeFileError's old one-argument form
egparedes Nov 14, 2026
e1d2906
fix(agent-review): collect-result works through search-only directories
egparedes Nov 14, 2026
2c96e04
test(agent-review): pin the teardown gate of 'Collect the result'
egparedes Nov 14, 2026
7b4efba
fix(agent-review): run-review's results replace what the harness left
egparedes Nov 14, 2026
c197233
docs(adr): runner.run's descriptor output and replacement decoding
egparedes Nov 14, 2026
343756e
test(agent-review): drop the bash run-review and its differential tes…
egparedes Nov 14, 2026
44c8340
test(agent-review): keep run-review's checks that lived in the differ…
egparedes Nov 14, 2026
3692de6
test(agent-review): drop the legacy bash authorize and its differenti…
egparedes Nov 14, 2026
26da48a
fix(agent-review): no raw HTML in the review (behaviour change)
egparedes Nov 14, 2026
dd1575b
fix(agent-review): bound the first line in the comment listing
egparedes Nov 14, 2026
fbe37cd
test(self-test): the publish steps' fixed PATH finds /usr/bin/gh
egparedes Nov 14, 2026
e166fc1
fix(agent-review): an unusable review file is invalid (exit 3), not a…
egparedes Nov 14, 2026
b6a13e3
fix(agent-review): fullmatch in read_two_fields; the harness allowlis…
egparedes Nov 14, 2026
f4335e7
test(agent-review): authorize's actor check and test_repository under…
egparedes Nov 14, 2026
4c10fc3
fix(agent-review): reset symlinks and gitlinks at instruction directo…
egparedes Nov 14, 2026
9a628f6
fix(agent-review): substitute the prompt's placeholders in one pass
egparedes Nov 14, 2026
346eb0f
test(agent-review): neutral names in the run-review unit tests
egparedes Nov 14, 2026
e0a9bec
fix(agent-review): check the addendum for placeholders after strict d…
egparedes Nov 14, 2026
2aa25b1
test(agent-review): keyword-only options of the reset tests' make_root
egparedes Nov 14, 2026
87e36d0
fix(agent-review): rename out/ aside after the harness instead of rem…
egparedes Nov 14, 2026
5e0c850
fix(agent-review): decide review truncation from the bytes read; path…
egparedes Nov 14, 2026
6ace854
test(agent-review): patch os.fstat directly in the truncation test
egparedes Nov 14, 2026
21e08ee
Merge M3: port collect-result to Python (#4)
egparedes Nov 14, 2026
a32924d
Merge M2: port publish-comment to Python (#5)
egparedes Nov 14, 2026
3b54a05
Merge M5: port authorize to Python (#7)
egparedes Nov 14, 2026
04aae87
Merge M4: port run-review to Python (#6)
egparedes Nov 14, 2026
184d05e
refactor(agent-review): bin/ holds Python entry points only
egparedes Nov 14, 2026
eec0eb2
refactor(agent-review): call-site rules for Python entry points only
egparedes Nov 14, 2026
c078c64
docs(agent-review): ADR 0003 states the trusted-host steps' fixed PATH
egparedes Nov 14, 2026
170ad31
fix(agent-review): base directory symlinks must lead into a reset dir…
egparedes Nov 14, 2026
f2b04e7
fix(agent-review): fail closed on base symlinks at instruction files …
egparedes Nov 14, 2026
8b965f9
chore(agent-review): caller-neutral names in new tests and comments
egparedes Nov 14, 2026
b1e44ce
docs(agent-review): renumber the Python runtime ADR to 0004
egparedes Nov 14, 2026
6bea3ad
test(agent-review): reject cases for each call-site check on its own
egparedes Nov 14, 2026
c587a0e
test(agent-review): structure rule for the fixed PATH on host calls
egparedes Nov 14, 2026
ed6f2f4
docs(agent-review): name the one changed bash-suite case and the PATH…
egparedes Nov 14, 2026
fa2f757
fix(agent-review): a missing or empty central reset list is fatal
egparedes Nov 14, 2026
a612c84
fix(agent-review): a base submodule at an instruction directory no lo…
egparedes Nov 14, 2026
32adec9
fix(agent-review): accept harmless link spellings and name each refus…
egparedes Nov 14, 2026
17b0136
test(agent-review): structure rule for the steps after the sandbox
egparedes Nov 14, 2026
13c4c4a
test(agent-review): pin how a PR's .gitattributes acts on restored files
egparedes Nov 14, 2026
479190c
test(agent-review): probe legacy commands with a NUL inside the marker
egparedes Nov 14, 2026
57a4af6
fix(agent-review): drop NUL before breaking up '##[' in sandbox output
egparedes Nov 14, 2026
eef55ce
docs(agent-review): say exactly who parses API JSON on the host
egparedes Nov 14, 2026
f34be52
docs(agent-review): other bots as readers of the review, code-fence i…
egparedes Nov 14, 2026
0879a4b
docs(agent-review): why reading BOT_LOGIN in post is safe
egparedes Nov 14, 2026
955074c
test(agent-review): read the review log as text in the check job
egparedes Nov 14, 2026
98d6bcb
Merge main (#3, the reusable PR Agent workflow) into the Python port
egparedes Nov 14, 2026
210807f
fix(agent-review): close structure-test gaps found in review
egparedes Nov 15, 2026
9b2c424
fix(agent-review): let base links to files pass on a wildcard way
egparedes Nov 15, 2026
727f496
docs(agent-review): make three comments match the code
egparedes Nov 15, 2026
03e0801
fix(agent-review): dangling wildcard-way links; more token routes che…
egparedes Nov 15, 2026
ea6516d
test(agent-review): a base link to a missing target; clearer token me…
egparedes Nov 15, 2026
d73622d
fix(agent-review): close structure-test gaps from an independent review
egparedes Nov 16, 2026
41d3429
fix(agent-review): pin how awf is named, what follows it, and diag
egparedes Nov 16, 2026
51e18e8
fix(agent-review): no shell syntax in the awf call, nothing before it
egparedes Nov 16, 2026
65e7f26
fix(agent-review): no shell-startup variables in the review jobs
egparedes Nov 16, 2026
4c62f51
fix(agent-review): startup variables in shells, and NODE_OPTIONS
egparedes Nov 16, 2026
21e28b0
docs(agent-review): make the text match the code and explain why
egparedes Nov 16, 2026
8572786
docs(agent-review): state the rules the tests check, settle the PATH …
egparedes Nov 16, 2026
42dc80f
docs(agent-review): release checklist covers fork runs and the real post
egparedes Nov 16, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,15 @@ updates:
# the routine group.
ignore:
- dependency-name: github/gh-aw-firewall
# The self-test's test-only tools (requirements.in): uv re-runs the
# 'uv pip compile --generate-hashes' recorded in requirements.txt, so the
# hashes stay. A week of cooldown before a new release is proposed.
- package-ecosystem: uv
directory: /agent-review/tests
schedule:
interval: weekly
cooldown:
default-days: 7
groups:
python-test-tools:
patterns: ["*"]
39 changes: 24 additions & 15 deletions .github/workflows/agent-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,11 @@ jobs:
TRUSTED_SHA: ${{ job.workflow_sha }}
CALLER_WF_SHA: ${{ github.workflow_sha }}
HAS_SHARED_KEY: ${{ secrets.inference_api_key != '' }}
run: bash "${RUNNER_TEMP}/trusted/bin/authorize"
# 'gh' is found on PATH (docs/adr/0004-python-runtime.md): only the
# system directories, never the home directories the runner's
# default PATH searches first.
PATH: /usr/bin:/bin
run: /usr/bin/python3 -I -S -B "${RUNNER_TEMP}/trusted/bin/authorize"

prepare:
needs: authorize
Expand Down Expand Up @@ -524,9 +528,12 @@ jobs:
# No key and no agent: only 'run-review' runs, and git on the PR with
# hooks, filters and submodules disabled. Its output is prefixed (and
# carriage returns dropped), so no line can start a workflow command
# ('::...::'); no '::stop-commands::', whose token would be printed to
# the live log first. 'sudo -E' passes the environment to AWF, which
# forwards none of it to the sandbox except what it sets itself.
# ('::...::'); NUL bytes are dropped and every '##[' is then broken up
# with a zero-width space, because the runner finds the legacy
# '##[command]' anywhere in a line. No '::stop-commands::', whose token
# would be printed to the live log first. 'sudo -E' passes the
# environment to AWF, which forwards none of it to the sandbox except
# what it sets itself.
- &fetch-pr
name: Fetch the pull request in the sandbox
id: fetch
Expand All @@ -543,8 +550,8 @@ jobs:
--proxy-logs-dir "${RUNNER_TEMP}/awf-fetch-logs" \
--image-tag "${IMAGE_TAG}" \
--container-workdir "${WS}" \
-- /opt/agent-review/bin/run-review --phase fetch "${WS}" 2>&1 \
| /usr/bin/sed -u -e 's/\r//g' -e 's/^/awf| /'
-- /usr/bin/python3 -I -S -B /opt/agent-review/bin/run-review --phase fetch "${WS}" 2>&1 \
| /usr/bin/sed -u -e 's/\r//g' -e 's/\x00//g' -e 's/##\[/#\xe2\x80\x8b#[/g' -e 's/^/awf| /'
# The default shell has no pipefail: report awf's status, not sed's.
exit "${PIPESTATUS[0]}"

Expand Down Expand Up @@ -582,8 +589,8 @@ jobs:
--proxy-logs-dir "${RUNNER_TEMP}/awf-logs" \
--image-tag "${IMAGE_TAG}" \
--container-workdir "${WS}" \
-- /opt/agent-review/bin/run-review --phase review "${WS}" 2>&1 \
| /usr/bin/sed -u -e 's/\r//g' -e 's/^/awf| /'
-- /usr/bin/python3 -I -S -B /opt/agent-review/bin/run-review --phase review "${WS}" 2>&1 \
| /usr/bin/sed -u -e 's/\r//g' -e 's/\x00//g' -e 's/##\[/#\xe2\x80\x8b#[/g' -e 's/^/awf| /'
rc=${PIPESTATUS[0]}
# The sandbox could write only to the workspace; still, treat the
# host as tainted from here on: shell builtins only.
Expand Down Expand Up @@ -614,15 +621,15 @@ jobs:
fi

# Absolute paths and a fixed PATH: the runner's default PATH searches
# home directories such as ~/.local/bin before /usr/bin, and the sandbox
# could write there.
# home directories such as ~/.local/bin before /usr/bin. AWF mounts them
# read-only, but after the sandbox ran the host is treated as tainted.
- &collect
name: Collect the result
if: always() && steps.key.outputs.skipped != 'true' && steps.teardown.outcome == 'success'
shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
env:
PATH: /usr/bin:/bin
run: /usr/bin/bash /opt/agent-review/bin/collect-result "${WS}/out" "${RUNNER_TEMP}/result"
run: /usr/bin/python3 -I -S -B /opt/agent-review/bin/collect-result "${WS}/out" "${RUNNER_TEMP}/result"

- &upload-result
name: Upload the result
Expand Down Expand Up @@ -765,8 +772,8 @@ jobs:
DRY_RUN: ${{ needs.authorize.outputs.dry_run }}
SKIPPED: ${{ needs.review.outputs.skipped || needs.review-keyless.outputs.skipped }}
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
PATH: /usr/bin:/bin
run: |
pc="${RUNNER_TEMP}/trusted/bin/publish-comment"
review="${RUNNER_TEMP}/result/review.md"
if [ "${SKIPPED}" = true ]; then
echo "result=skipped" >> "$GITHUB_OUTPUT"
Expand All @@ -777,7 +784,8 @@ jobs:
exit 0
fi
rc=0
bash "${pc}" render --harness "${HARNESS}" --version "${VERSION}" --model "${MODEL}" \
/usr/bin/python3 -I -S -B "${RUNNER_TEMP}/trusted/bin/publish-comment" render \
--harness "${HARNESS}" --version "${VERSION}" --model "${MODEL}" \
--head-sha "${HEAD_SHA}" --run-url "${RUN_URL}" --review "${review}" > "${RUNNER_TEMP}/body.md" || rc=$?
case "${rc}" in
0) ;;
Expand Down Expand Up @@ -806,8 +814,9 @@ jobs:
REPO: ${{ github.repository }}
PR: ${{ needs.authorize.outputs.pr }}
HARNESS: ${{ needs.authorize.outputs.harness }}
PATH: /usr/bin:/bin
run: |
url=$(bash "${RUNNER_TEMP}/trusted/bin/publish-comment" post --repo "${REPO}" --pr "${PR}" \
url=$(/usr/bin/python3 -I -S -B "${RUNNER_TEMP}/trusted/bin/publish-comment" post --repo "${REPO}" --pr "${PR}" \
--harness "${HARNESS}" --body-file "${RUNNER_TEMP}/body.md")
echo "::notice::Posted the agent review: ${url}"
{ echo "result=posted"; echo "comment_url=${url}"; } >> "$GITHUB_OUTPUT"
Expand All @@ -824,7 +833,7 @@ jobs:
run: |
case "${RESULT}" in
missing) reason="the agent produced no review (fetch outcome '${FETCH_OUTCOME}', review outcome '${OUTCOME}', exit code '${EXIT_CODE}')" ;;
invalid) reason="the review was rejected as invalid (not UTF-8, or empty)" ;;
invalid) reason="the review was rejected as invalid (not UTF-8, empty, or not a regular file within the size cap)" ;;
esac
echo "::warning title=Agent review failed::No review was posted: ${reason}. See the 'Fetch the pull request in the sandbox' and 'Run the review in the sandbox' logs."
{
Expand Down
118 changes: 95 additions & 23 deletions .github/workflows/self-test.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
name: Self-test

# This repository's own CI: lint, zizmor, the script and structure tests of
# both workflows, PR Agent's keyless path (dry run), and the whole agent
# review pipeline end to end with the
# 'stub' harness (the keyless job: no environment, no key, no model call,
# nothing posted) through a LOCAL call, so the commit under test is exactly
# the one whose files the pipeline fetches. The fixed fixture is a
# merged public pull request of another repository whose head is in a fork
# and which changes AGENTS.md at two depths, so the cross-repository fetch by sha and the instruction-file
# reset run for real.
# both workflows, the agent review's Python tests, PR Agent's keyless path
# (dry run), and the whole agent review pipeline end to end with the 'stub'
# harness (the keyless job: no environment, no key, no model call, nothing
# posted) through a LOCAL call, so the commit under test is exactly the one
# whose files the pipeline fetches. The fixture is a fixed, merged public
# pull request of another repository whose head is in a fork and which
# changes AGENTS.md at two depths, so the cross-repository fetch by sha and
# the instruction-file reset run for real.

on:
pull_request:
Expand Down Expand Up @@ -125,6 +125,32 @@ jobs:
echo "::warning::Tag '${tag}' now points to '${now}', not the pinned '${digest}'."
fi

# The agent review's Python code (docs/adr/0004-python-runtime.md): unit
# tests, the entry points under the production command line in a hostile
# environment, the structure checks on crafted inputs, and mypy. The test
# tools come from the hash-pinned agent-review/tests/requirements.txt, in a
# virtual environment; the runtime code never imports them.
python:
runs-on: ubuntu-24.04
timeout-minutes: 10
permissions:
contents: read
env:
PYTHONDONTWRITEBYTECODE: "1"
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Install the test tools
run: |
/usr/bin/python3 -m venv "${RUNNER_TEMP}/venv"
"${RUNNER_TEMP}/venv/bin/pip" install --require-hashes --no-deps --only-binary :all: \
-r agent-review/tests/requirements.txt
- name: pytest
run: '"${RUNNER_TEMP}/venv/bin/python" -B -m pytest'
- name: mypy
run: '"${RUNNER_TEMP}/venv/bin/python" -m mypy'

# The model-calling adapters' installers, as the 'prepare' job runs them:
# pinned versions with integrity checks, no install scripts, no harness
# code executed (the version check runs inside the sandbox).
Expand Down Expand Up @@ -248,10 +274,11 @@ jobs:
if: always()
runs-on: ubuntu-24.04
timeout-minutes: 5
# Reads this run's jobs and the keyless review's log, and the commit's
# deployments; nothing is written.
# Reads this run's jobs, the keyless review's log and annotations, and
# the commit's deployments; nothing is written.
permissions:
actions: read
checks: read
deployments: read
steps:
- name: The stub review of the fixture was rendered, not posted
Expand All @@ -264,6 +291,18 @@ jobs:
echo "e2e='${E2E}' result='${RESULT}' head_sha='${HEAD_SHA}' comment_url='${COMMENT_URL}'"
[ "${E2E}" = success ] && [ "${RESULT}" = dry-run ] && [ "${HEAD_SHA}" = "${FIXTURE_HEAD_SHA}" ] && [ -z "${COMMENT_URL}" ]

# 'Publish the review' in agent-review.yml runs only for a real post,
# which the self-test never makes: check on the same runner image that
# its fixed PATH finds the runner's gh.
- name: The publish step's fixed PATH finds gh
env:
PATH: /usr/bin:/bin
run: |
gh_path=$(command -v gh)
echo "gh under PATH=${PATH}: ${gh_path}"
[ "${gh_path}" = /usr/bin/gh ]
gh --version

- name: The keyless job ran the sandbox as configured
env:
GH_TOKEN: ${{ github.token }}
Expand All @@ -286,21 +325,54 @@ jobs:
expect "the keyless job succeeded" test "$(job 'e2e / review-keyless' conclusion)" = success
expect "nothing was posted" test "$(step 'e2e / publish' 'Publish the review')" = skipped

# The raw log, through curl: it holds escape sequences, which 'gh'
# The raw logs, through curl: they hold escape sequences, which 'gh'
# refuses to print. curl drops the token on the redirect to storage.
id=$(job 'e2e / review-keyless' id)
[[ "${id}" =~ ^[0-9]+$ ]] || { echo "::error::No keyless review job."; exit 1; }
for i in 1 2 3 4 5; do
curl -fsSL -H "Authorization: Bearer ${GH_TOKEN}" \
"https://api.github.com/repos/${REPO}/actions/jobs/${id}/logs" | tr -d '\r' > "${RUNNER_TEMP}/review.log" && break
sleep $((i * 5))
done
fetch_log() { # job-name file
local id
id=$(job "$1" id)
[[ "${id}" =~ ^[0-9]+$ ]] || { echo "::error::No job '$1'."; exit 1; }
for i in 1 2 3 4 5; do
curl -fsSL -H "Authorization: Bearer ${GH_TOKEN}" \
"https://api.github.com/repos/${REPO}/actions/jobs/${id}/logs" | tr -d '\r' > "$2" && break
sleep $((i * 5))
done
}
# 'grep -a' throughout: the sandbox's output may put any byte (NUL
# included) in the log, which would make grep print 'Binary file matches'.
log="${RUNNER_TEMP}/review.log"
expect "fetch run allows only github.com" grep -qE '^[^ ]+ awf\| \[INFO\] Allowed domains: github\.com$' "${log}"
expect "review run allows no domain" grep -qE '^[^ ]+ awf\| \[INFO\] Allowed domains: ?$' "${log}"
expect "caps clamped" grep -qF '{"rateLimiting":{"requestsPerMinute":30,"requestsPerHour":10},"maxTurns":5,"agentTimeout":10}' "${log}"
expect "no key reached AWF" test "$(grep -c 'API proxy enabled: OpenAI=true' "${log}")" -eq 0
expect "the reset was verified" grep -qF 'are their base versions.' "${log}"
prepare_log="${RUNNER_TEMP}/prepare.log"
fetch_log 'e2e / review-keyless' "${log}"
fetch_log 'e2e / prepare' "${prepare_log}"
expect "fetch run allows only github.com" grep -aqE '^[^ ]+ awf\| \[INFO\] Allowed domains: github\.com$' "${log}"
expect "review run allows no domain" grep -aqE '^[^ ]+ awf\| \[INFO\] Allowed domains: ?$' "${log}"
expect "caps clamped" grep -aqF '{"rateLimiting":{"requestsPerMinute":30,"requestsPerHour":10},"maxTurns":5,"agentTimeout":10}' "${log}"
expect "no key reached AWF" test "$(grep -ac 'API proxy enabled: OpenAI=true' "${log}")" -eq 0
expect "the reset was verified" grep -aqF 'are their base versions.' "${log}"

# The Python runtime (bin/probe, run by the stub harness): on the
# host in 'prepare' and inside the sandbox, the same interpreter,
# with the production flags and the standard library only.
probe='agent-review-probe python=3\.12\.[0-9]+ executable=/usr/bin/python3 isolated=1 ignore_environment=1'
probe+=' no_user_site=1 no_site=1 dont_write_bytecode=1 safe_path=1 site=0 stdlib_only=1'
host=$(grep -aE "^[^ ]+ ${probe} lib=/[^ ]+/trusted/lib$" "${prepare_log}" | cut -d' ' -f2- || true)
sandbox=$(grep -aE "^[^ ]+ awf\| ${probe} lib=/opt/agent-review/lib$" "${log}" | cut -d' ' -f3- || true)
echo "host: ${host}"
echo "sandbox: ${sandbox}"
expect "Python on the host (prepare)" test "$(wc -l <<< "${host}")" -eq 1 -a -n "${host}"
expect "Python in the sandbox" test "$(wc -l <<< "${sandbox}")" -eq 1 -a -n "${sandbox}"
expect "the same Python version on both" test "$(cut -d' ' -f2 <<< "${host}")" = "$(cut -d' ' -f2 <<< "${sandbox}")"

# Sandbox output issues no workflow command in the legacy syntax
# either (invariant 11): the stub prints the probe on stdout and
# through 'diag'; neither may become an annotation of the job.
expect "the legacy-command probe ran (stdout and diag, with and without NUL)" \
test "$(grep -a -c 'agent-review-legacy-probe' "${log}")" -ge 4
check_run=$(job 'e2e / review-keyless' check_run_url)
[[ "${check_run}" =~ ^https://api\.github\.com/(repos/[^/]+/[^/]+/check-runs/[0-9]+)$ ]] ||
{ echo "::error::No check run for the keyless job."; exit 1; }
n=$(gh api --paginate "${BASH_REMATCH[1]}/annotations" \
--jq '.[] | select(.message | contains("agent-review-legacy-probe")) | .message' | wc -l)
expect "no annotation from the legacy-command probe (${n})" test "${n}" -eq 0

# The keyless job requests no environment, so no deployment.
n=$(gh api "repos/${REPO}/deployments?sha=${COMMIT}" --jq length)
Expand Down
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Local tool caches; never commit bytecode (the structure test forbids it).
__pycache__/
*.py[co]
.mypy_cache/
.pytest_cache/
.ruff_cache/
20 changes: 20 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,23 @@ repos:
# Info-level notes (quoting in test assertions, sourced helpers) are
# not failures.
args: [--severity=warning]
# The agent review's Python code (agent-review/lib/, tests). Entry points in
# bin/ have no '.py' suffix and are checked against their fixed template
# by the structure test instead. Scoped to agent-review/: PR Agent
# (pr-agent/) stays bash, and its test scripts follow their own rules.
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: ef6cf06c079dd6b299dfc720b0f14400c9d168e1 # frozen: v0.17.5
hooks:
- id: ruff-check
files: ^agent-review/
- id: ruff-format
files: ^agent-review/
# The runtime code only, which has no dependency; the self-test's 'python'
# job also checks the tests, with the hash-pinned requirements.
- repo: https://github.com/pre-commit/mirrors-mypy
rev: ad26ebfa797fcb9b8f83275937c1c1d6e126719c # frozen: v2.4.1
hooks:
- id: mypy
files: ^agent-review/lib/
pass_filenames: false
args: [--config-file=pyproject.toml, agent-review/lib]
Loading
Loading