PR reviewability check¶
agent-strace review reports what the authoring session can show a reviewer
about an AI-written pull request. It reads the captured sessions linked to the
branch and reports five findings. It can run as a required status check and
post one compact PR comment.
agent-strace review # terminal text for this branch
agent-strace review --format markdown # PR comment body
agent-strace review --format json # versioned JSON
agent-strace pr-comment --review # post or update the PR comment, exit per threshold
agent-strace review --publish-note # write the findings to a git note for CI
An agent can run the same check over MCP with the review tool of
agent-strace mcp. It returns the same JSON and never posts a comment. See
mcp.md.
Why¶
Rahman et al. surveyed 239 practitioners about reviewing AI-authored pull requests (arXiv 2610.11179, October 2026). They name the gap "reviewability debt". Reviewers decide how much effort to spend based on whether a PR arrives with bounded scope, project-grounded rationale, validation beyond CI, a responsive contributor, and identifiable ownership after merge.
Most of that evidence exists in the authoring session and is lost by the time the PR opens. This check puts it on the PR.
Findings¶
Each finding has a status, a confidence, and the source of its evidence.
| Finding | What it checks | Source |
|---|---|---|
| Rationale | Whether the original request was captured | user_prompt events. Counts only. Prompt text is never printed. |
| Scope | Files written vs files a prompt named or the session read | File and edit tool events, shell redirection targets, prompt path mentions, file reads, shell read targets |
| Validation | Tests and checks run inside the session, with exit codes or the test runner's own summary, and the agent's claims that tests passed | Shell tool calls and their linked results, and the agent's replies. CI is read only with --ci-checks. |
| Stewardship | Human turns, interventions after the agent started, approval decisions | user_prompt events, approval requests, recorded permission modes |
| Evidence health | Capture gaps, redaction state, provider limits, and how the session was linked | health, capture matrix, session link |
With --commits RANGE or --otel-logs FILE, the evidence health finding also
lists external evidence: Entire
checkpoints, including a trailer present but not pushed, Copilot cloud agent
commits (the Agent-Logs-Url trailer, or the agent as commit author or
co-author when the trailer is absent), Claude Code Claude-Session links,
declared assistance (Assisted-by and Generated-by trailers and agent
Co-authored-by lines), and Claude Code safety_event records. Each signal
has a source, a status and a confidence. They are reported, not graded.
Only the disclosure check can fail on them.
--commits also reads git-ai notes, and
--agent-trace-records FILE reads Agent Trace records. Their line counts are
external signals too, and the Scope finding lists the files with agent lines
that no linked session wrote. Scope keeps its status.
Statuses:
| Status | Meaning |
|---|---|
present |
The evidence was captured |
partial |
Some evidence was captured, or it is stale or failed |
missing |
The capture path records this evidence and none was found |
inconclusive |
The trace cannot say either way |
Confidence is high, medium, or low. It says how much the status depends on
heuristics. Prompt capture is high. Path matching for scope is medium. A weak
session link lowers evidence confidence to low.
Scope also reads file writes made through a shell tool call, because some
agents write every file with cat > file <<'EOF' instead of an edit tool. The
targets of >, >>, >|, &>, and tee [-a] FILE count as written files.
A relative target is resolved against an earlier cd DIR in the same command,
otherwise against the session working directory. A cd inside ( ) or
$( ), in a pipeline, or run with & does not carry over, as in the shell.
After an if, loop, or case whose body ran cd, later relative targets are
skipped, since the directory depends on which branch ran. Targets under /dev/, fd
duplications such as 2>&1, and targets with $, backticks, globs, or a
leading ~ are skipped. These paths are read from command text, not observed
as writes, so they never raise confidence: when shell redirection is the only
write evidence, scope is low confidence, the detail says so, and
facts.shell_writes counts the files seen only that way. Only paths are
shown, never the command. Writes made by sed -i, cp, mv, or an
interpreter such as python -c are not detected. A redirect target also
counts as a file change for validation staleness.
Shell reads count as file reads for grounding: file operands of cat,
head, tail, less, more, nl, and wc (option words and values such
as -n 20 are skipped) and < input redirect targets, with the same cd
and literal-path rules. They only ground a written file. They never add a
written file or raise confidence. Operands of grep, sed, awk, and other
tools are not read.
The session summary in the PR comment counts files read and modified from the
same evidence: file and edit tool events plus the shell read and write targets
described here. Its paths are relative to the session working directory, as in
Scope. Its cost row shows an estimate only when the trace records a model name
or token usage. In the review comment, the summary sits in a collapsed
Session details block below the findings, and the Cost and Model rows are
left out when no linked session captured them. See
pr-comment.
Validation uses the last run of each check across all linked sessions. Sessions
are ordered by start time, then ID. A check that passed before a later file
edit in any linked session is reported as partial. Runs and edits are ordered
by when their result was recorded, or by the call when it has no single
result. GitHub Copilot CLI starts tool calls in parallel batches, so an edit
started with a test run counts as seen by that run only when its result came
first. Command strings are never printed. They are mapped to fixed labels such
as pytest, npm test, ruff, or tsc. Each command in a shell call is
checked: parts joined by &&, ;, or a pipe, and each line of a multi-line
script. Heredoc bodies (<<EOF and its quoted and <<- forms) and #
comments are skipped, so text written to a file is never read as a test run.
A run counts only when it has exactly one result recorded after the call, with
an explicit status: an exit code, a success flag, is_error: true, or an error
event. A missing, duplicate, earlier, status-less, or conflicting result makes
the outcome unknown, and validation is partial.
The exit code belongs to the whole shell invocation. It is assigned to a check
only when the check is the whole command, such as pytest -k 'a && b' or
CI=1 uv run pytest. Pipes, ||, ;, redirects, background jobs, command
substitution, and multi-line scripts make the outcome unknown. One exception:
in a chain joined only by &&, exit 0 means every part ran and passed, so a
pass is kept. A failing && chain is unknown because the failing part is not
known.
When the exit code is masked this way, or the result has no explicit status,
the outcome is read from the test runner's own final summary in the linked
result. A result marked is_error: true with no exit code reads like a nonzero
exit. A single command is failed, and in a compound command the failure is
masked, so the summary is read.
Copilot CLI often pipes test output through tail, which hides the runner's
exit code but keeps its summary. The text output then reads
unittest passed (runner summary in output, not exit code), the source adds
runner summary lines in linked output, and the JSON run facts carry
outcome_source: "runner_summary" with exit_code: null. Runs read from an
explicit status carry outcome_source: "exit_status", with exit_code: null
when no exit code was recorded. Only the runner name and the outcome are
printed, never the command or the output.
Supported summaries:
| Runner | Pass | Fail |
|---|---|---|
unittest |
Ran N tests in Xs, then OK with at least one test that was not skipped |
Ran N tests in Xs, then FAILED (failures=N, errors=N) |
pytest |
One final line such as 3 passed, 1 skipped in 0.12s |
The same line with failed or error above 0 |
jest |
Test Suites: and Tests: lines whose counts add up to the total |
The same lines with failed above 0 |
vitest |
Test Files and Tests lines whose counts add up to the total |
The same lines with failed above 0, or an Errors line |
The parsing is strict, and any doubt keeps the outcome unknown:
- The shell call must run the runner in exactly one part, and the result must hold exactly one summary for it. Two runs in one call stay unknown.
- A summary cut short, a result cut short, a redacted result, an error event,
or a result whose content was not captured stays unknown. A result is cut
short when it ends with three dots, which the imports and the MCP proxy add
when they cut long output. It is also cut short when it ends with the hook
truncation marker, or when gh-aw marked it
outputTruncated. The part cut off can hold a failure, such as a coverage gate printed after the summary. An output that really ends with three dots looks the same, so it stays unknown too. A result markedis_error: trueis not an error event, so its summary is still read in a compound command. - No tests run, all tests skipped, counts that do not add up, unknown count words, and a coverage threshold failure all stay unknown.
- An explicit exit code still wins. A single
pytestcall with exit code 1 is failed even if its output shows a passing summary.is_error: truealso makes a single command failed, whatever its output shows. With exit code 0,success: trueorok: true, it conflicts, and the run is unknown. A conflicting or missing result is never repaired from text. go testandcargo testare not read. They print one line per package or test binary with no run-wide summary, so atailcan hide a failing package.
A pass read from a summary gives present with medium confidence, not
high. The runner's real exit status was not observed: another part of the
command could print similar text, and coverage gates, plugins, or teardown
can fail a run after its summary is printed. high is kept for an exit code
the check owns.
Stewardship counts turns and decisions. It does not rank or score people.
Check test claims against CI¶
An agent often ends a session by saying the tests pass. Validation compares
that claim with the test runs the session recorded, always and offline. With
--ci-checks it also reads CI on the pull request's head commit.
A claim is read from the agent's replies: assistant_response events, which
the hooks record from the agent's last message and the JSONL and Entire
imports record from the transcript. A sentence is a claim when it says that
tests passed, such as "all tests pass", "the test suite is green", "pytest
passed" or a runner summary like "42 passed". A sentence is not a claim when
it is a question, mentions a failure or error, counts no tests or only some
(0 passed, 3/42 tests passed, only, most, none), holds a negation or
hedge such as not, no, n't, should, will, once, until, if,
before or make sure, says what a test passes (the test passes an empty
list to parse()), or is longer than 500 characters. The latest claim across
the linked sessions is used. Only the matched phrase is kept, at most 80
characters, never the sentence around it. A claim is compared with test runs
only, not with lint, type or build checks.
| Outcome | When | Confidence |
|---|---|---|
ci_contradicts |
With --ci-checks: CI failed, and the agent said the tests passed, every last test run in the session passed, or a review note reports validation present. present becomes partial, and the detail names up to three failing checks. |
high |
claimed_after_failure |
The agent said the tests passed after a test run failed, and no later run of that test passed. | high with an exit code, else medium |
claimed_not_run |
The agent said the tests passed, and the session ran no test command. | medium |
failed_then_opened |
The session's last run of a test failed, and the agent claimed nothing after it. | high with an exit code, else medium |
ci_confirms |
With --ci-checks: CI passed, and every last test run in the session passed or a review note reports validation present. |
high |
When several apply, the first in the table wins. Only ci_contradicts
changes the status. The others add a sentence to the detail, such as
The agent said "all tests pass", but the session ran no test command., and
keep the status; failed_then_opened adds none, since the detail already
names the failed run. claimed_not_run needs captured tool calls: with none,
validation stays inconclusive. A weak session link caps the outcome's
confidence at low, as it does every finding's.
JSON records the outcome in the validation finding's facts.crosscheck. It is
there only when a claim was found, an outcome applies, or --ci-checks was
given, so other reports are unchanged:
"crosscheck": {
"outcome": "ci_contradicts",
"confidence": "high",
"claim": {"phrase": "all tests pass", "session_id": "3f9c2a71b0d4"},
"ci": {
"state": "failed",
"sha": "9b2e41c07d5a3f6e8c1b0a9d2e4f6a8b0c1d3e5f",
"repo": "OWNER/REPO",
"counts": {"ok": 4, "failed": 1, "pending": 0, "ignored": 1},
"failed": ["unit (3.12)"],
"pending": [],
"truncated": false,
"reason": ""
}
}
Text output adds Cross-check: and CI: lines under validation.
--ci-checks reads GitHub only. GitLab pipelines are not read yet. It reads
the head commit's check runs, latest per check, up to 10 pages of 100, and
its commit statuses, with GITHUB_TOKEN or GH_TOKEN, from GITHUB_API_URL
(default https://api.github.com). The repository is GITHUB_REPOSITORY,
else the origin remote when it is on GitHub. The commit is the pull
request's head in a pull request job, not the merge commit it checks out,
else the end of --commits, the queued commit in a merge_group job, or
HEAD. Without --ci-checks, nothing is fetched. The Action reads CI once
per step and reuses it, so the check, its report and the pull request comment
agree.
- A completed check run passes on
success,neutralorskipped, and fails on any other conclusion. A check run that has not completed is pending. The review job's own check run is the exception: when exactly one check run of the current workflow run (GITHUB_RUN_ID) is in progress, it is the review job and is ignored. Other jobs of that run that are queued or running, such as a test job beside the review, are pending. A commit status passes onsuccess, is pending onpending, and fails onfailureorerror. - CI is
failedwhen any check failed, elsependingwhen any is still running, elsepassed, elsenone. More check runs than were read settruncated. pending,noneand a CI that cannot be read set no outcome. The detail saysCI on 9b2e41c is still running., that no check was found, or why CI could not be read. When it cannot be read (no token, no GitHub repository, an API error), stderr has one warning, thecistate isunreadable, and the result and exit code do not change.- Check and status names come from the API. They are printed inert, like any trace text.
--publish-notecannot be combined with--ci-checks: a note records the sessions, and CI is read when the check runs.- A review note holds findings, not runs. Its validation is
presentonly when every last run in its sessions passed, so CI is checked against that: a red CI makes itpartial, a green one confirms it.
In the Action, set review-ci-checks: "true". Give the job checks: read
and statuses: read, and run it after the test jobs with needs:;
otherwise CI reads as pending. With needs: alone, a failed test job skips the
check, which is when it matters most, so also run it unless the workflow was
cancelled. Checks from other workflows can still be running; they read as
pending.
on: pull_request
permissions:
contents: read
pull-requests: write
checks: read
statuses: read
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: make test
reviewability:
needs: test
if: ${{ !cancelled() }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
- uses: Siddhant-K-code/agent-trace@v0.132.0
with:
review-commits: origin/${{ github.base_ref }}..HEAD
review-ci-checks: "true"
How sessions are linked¶
| Link | Meaning |
|---|---|
explicit |
Session IDs were named on the command line |
branch |
The session's recorded git branch matches the PR branch |
file_overlap |
No branch match. The session wrote files the PR changes, and it was recorded in this repository. |
file_overlap_other_branch |
As file_overlap, but the session was recorded on another branch |
file_overlap_unverified |
The session wrote files the PR changes, but its repository and branch are not known |
commit_time |
No branch match. The session closest to the head commit time was used. |
latest |
No branch or commit to match. The latest session was used. |
note |
No session. The review note on the head commit was used. |
note_rewritten |
No session. A review note copied to the head by notes.rewriteRef was used. |
note_commit |
No session. A review note on an older commit of --commits was used. |
note_patch_id |
No session. A review note on a commit with the same patch ID was used. |
entire_checkpoint |
--entire: the session was read from an Entire checkpoint that an Entire-Checkpoint trailer in --commits names. See review --entire. |
commit_time matches only a session whose start time is usable. When no
session has a usable start time, latest is used.
In a pull request job, commit_time uses the PR head commit that the CI
system names (see the table below), not the synthetic merge commit that
actions/checkout or Azure Pipelines creates. That commit must be in the
clone. Check out the head SHA as in the example below. If the head SHA is
unavailable, the commit_time link is skipped and latest is used.
The PR branch, head commit and target branch come from these variables,
read in row order: the first one set wins. Outside a pull request job the
head commit is HEAD.
| CI system | PR branch | Head commit | Target branch |
|---|---|---|---|
| GitHub Actions | GITHUB_HEAD_REF |
pull_request.head.sha in the event payload |
GITHUB_BASE_REF |
| GitLab CI | CI_MERGE_REQUEST_SOURCE_BRANCH_NAME, else CI_COMMIT_REF_NAME |
CI_MERGE_REQUEST_SOURCE_BRANCH_SHA, else CI_COMMIT_SHA |
CI_MERGE_REQUEST_TARGET_BRANCH_NAME |
| Bitbucket Pipelines | BITBUCKET_BRANCH |
BITBUCKET_COMMIT when BITBUCKET_PR_ID is set |
BITBUCKET_PR_DESTINATION_BRANCH |
| Azure Pipelines | SYSTEM_PULLREQUEST_SOURCEBRANCH, else a refs/heads/ value of BUILD_SOURCEBRANCH |
SYSTEM_PULLREQUEST_SOURCECOMMITID when SYSTEM_PULLREQUEST_PULLREQUESTID is set |
SYSTEM_PULLREQUEST_TARGETBRANCH |
| Jenkins Gerrit Trigger | the checked-out branch | GERRIT_PATCHSET_REVISION when GERRIT_CHANGE_NUMBER is set |
GERRIT_BRANCH when GERRIT_CHANGE_NUMBER is set |
| Anywhere else | the checked-out branch | HEAD |
none: pass --commits BASE..HEAD |
Azure branch values may be refs/heads/NAME (Azure Repos) or a bare name
(GitHub repositories); both work. Bitbucket pull request pipelines give an
abbreviated BITBUCKET_COMMIT, which git expands, so that commit must be in
the clone.
commit_time, latest, file_overlap_other_branch and
file_overlap_unverified are weak session links. Every finding's confidence is capped at low, and a present evidence
result becomes partial, so a weak session link cannot fail the default
threshold. note_rewritten, note_commit and note_patch_id are weak note
links: evidence confidence drops to low and a present evidence result
becomes partial, as described under review notes.
With no linked session, every finding is inconclusive at low confidence.
The default threshold passes in that case. To fail a pull request that no
strongly linked session stands behind, use strict links.
The PR's changed files¶
A session found by time alone may belong to another pull request. When the
check knows the files the PR changes, it reads them before it trusts a
commit_time or latest link:
- With
--commits A..B(orA...B), the changed files aregit diff --name-only A...B: what the PR adds or modifies since the merge base. Deleted files are left out. - Without
--commits, in a pull request job, the base is the target branch from the table above, read fromrefs/remotes/origin/BASE, so the checkout needs that branch fetched (fetch-depth: 0on GitHub). The PR head is the onecommit_timeuses. - Otherwise, or when git cannot read them, the files are unknown and links work as above.
The newest 200 sessions in the trace directory are read. Paths each one
wrote (edit tools, Codex apply_patch changes and shell redirection,
relative to the session's working directory) are compared with the
repository paths. An apply_patch call whose result says it failed or was
declined wrote nothing, and does not count as a write after the last test
run either. . and .. are resolved first, and a path that leaves
the working directory, such as ../README.md, is made absolute against it.
An absolute path counts only when it is inside this checkout, so a file with
the same name in another repository never matches.
Whether a session belongs to this repository comes from its recorded
git_repo remote and working_dir:
- A remote that matches one of this checkout's remotes (compared as
host/owner/repo, so SSH and HTTPS URLs match), or a working directory inside this checkout, makes the overlapfile_overlap. So does a recorded branch equal to the PR branch. - A session recorded on another branch is
file_overlap_other_branch. - A remote with a repository name that none of this checkout's remotes has is another repository, even when the working directory is inside this checkout (a nested clone or a submodule): the session is skipped.
- Anything else, such as no recorded remote or a fork with the same
repository name, is
file_overlap_unverified.
Of the sessions that wrote at least one changed file, a file_overlap link
wins, then file_overlap_unverified, then file_overlap_other_branch. Within
each, the session that wrote the most changed files wins, then the one closest
to the head commit.
When no session wrote a changed file, a commit_time or latest session
stays linked, still weak, only if it is among the sessions read, its capture
shows no file writes (for example, every edit went through a shell command
the capture cannot read), and it was not recorded in another repository.
Otherwise the link is dropped and the report has no session. Named sessions
and branch matches are kept as they are.
The Scope finding then lists the changed files no linked session wrote, in
text and markdown as "Changed in the PR, not written by a linked session" (5
paths, then a count) and in JSON as facts.pr_files_not_written, with
facts.pr_files the number of changed files. JSON lists at most 50 paths;
facts.pr_files_not_written_count is the full count. With no linked
session, every changed file is listed. It does not change Scope's status. A
PR that changes more than 10,000 files is treated as one whose files are
unknown.
Strict links¶
--strict-links reviews only agent-trace sessions with a strong link: named
on the command line (explicit), matched by branch (branch), or that wrote
the PR's changed files in this repository (file_overlap). A session linked
by commit_time, latest, file_overlap_other_branch or
file_overlap_unverified is refused. The report lists it as refused and does
not review it, and JSON adds strict_links: true and refused_sessions, each
with session_id and link. With --entire or --from-note, the Entire
checkpoints or the review note are then read in its place, as when no session
is linked. A review note is not a session: one found by a weak note link is
still read, at low evidence confidence. In the Action, set
review-strict-links: "true"; in the GitLab component, strict-links: true.
Without strict links, a weak link caps every finding at low, so it cannot
fail the default threshold. With strict links, a refused session leaves every
finding inconclusive at low, which the default threshold also passes. To
also fail a pull request that no strongly linked session, Entire checkpoint or
review note stands behind, add a second gate next to the default one.
--fail-on replaces the default missing threshold instead of adding to it,
so the Evidence-only gate is a separate run:
agent-strace review --strict-links
agent-strace review --strict-links --fail-on inconclusive --min-confidence low --findings evidence
Evidence is also inconclusive for a linked session whose capture health is
unknown, so the second run fails that too. In the Action, keep the default
threshold and fail on the review-evidence output, which is linked only
when every reviewed session, checkpoint or note has a strong link:
- uses: Siddhant-K-code/agent-trace@v0.132.0
id: agent-review
with:
review-strict-links: "true"
- if: steps.agent-review.outputs.review-evidence != 'linked'
run: |
echo "::error::No strongly linked session, Entire checkpoint or review note"
exit 1
Merge queues¶
In a GitHub merge_group job, the checkout is the queue's branch,
gh-readonly-queue/<base>/pr-<number>-<sha>, which no session was recorded
on. review and pr-comment --review:
- read the pull request number from that branch, or from
GITHUB_REFwhen the checkout is a detachedHEAD, then read the pull request's head branch fromGET /repos/{owner}/{repo}/pulls/{number}withGITHUB_TOKENorGH_TOKEN, and link sessions by it. This runs only in GitHub Actions. When the pull request cannot be read, stderr says so and sessions are linked by the files it changes, never by the queue branch. The queue branch cannot confirm a recorded branch, so a session recorded on any branch is thenfile_overlap_unverified. - without
--commits, read the changed files from the event'smerge_group.base_sha...head_sha: this pull request's changes, not those of the pull requests ahead of it in the queue. Both commits must be in the clone, so usefetch-depth: 0.
commit_time uses the time of the queue's commit, made when the pull request
entered the queue, so it is even less likely to name the right session.
--strict-links refuses it. The review note lookup starts at the queue's
commit, which has no note, then reads the --commits range: a merge commit
queue finds the note on the pull request's own commit (note_commit), a
rebase queue finds it by patch ID (note_patch_id), and a squash queue only
when the pull request has one commit. All are weak note links.
The Action, on merge_group:
- sets
review-commitsto the event'sbase_sha..head_shawhen it is empty and both commits are in the clone, and otherwise adds a notice that says why no range is read (for missing commits, it asks forfetch-depth: 0); - passes
github-tokento both steps, so the session it links matches the one the check reviews; - fetches review notes and Entire checkpoints from
origin, never from a fork; - with
cognitive-debt: auto, skips cognitive debt, and withpost-pr-comment: auto, posts no comment.
on:
pull_request:
merge_group:
permissions:
contents: read
pull-requests: write
jobs:
reviewability:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}
fetch-depth: 0
- uses: Siddhant-K-code/agent-trace@v0.132.0
with:
# Empty on merge_group, where the Action reads the range from the event.
review-commits: ${{ github.base_ref && format('origin/{0}..HEAD', github.base_ref) || '' }}
review-strict-links: "true"
github.base_ref is set only on pull_request and pull_request_target.
Evidence¶
JSON has a top-level evidence field, and text has an Evidence: line:
| Value | Meaning |
|---|---|
linked |
Every session was named, matched by branch, found by file_overlap, read from an Entire checkpoint (--entire), or read from the review note on the head commit |
weak |
A weak link was used. For a session link, every confidence is capped at low; for a review note, evidence confidence is low. |
none |
No session and no review note |
With none, text and markdown open with No session evidence. When
external evidence shows agent involvement, that line names the agent, such as
an agent co-author from --commits. The exit code is unchanged.
Threshold¶
The threshold decides which findings fail the check. The default fails on
missing at medium or higher confidence. It never fails on partial or
inconclusive unless you configure it to.
Add a review block to .agent-strace.yaml:
review:
fail_on: # a list, a comma list, or none
- missing
- partial
min_confidence: medium # low, medium, high
findings: [rationale, validation]
.agent-strace.yml and .agent-strace.json also work. --fail-on,
--min-confidence, --findings, and --config override the file.
The config fails closed. An empty or null value, an empty list, an unknown key,
a nested mapping, or any YAML the parser does not support is an error (exit
2). Only the literal value none, on its own, turns failures off.
Exit codes: 0 pass, 1 threshold, cognitive debt or disclosure check
failed, 2 bad config or unknown session.
Disclosure¶
Many projects ask contributors to declare AI assistance. Of the 281 AI policies studied in arXiv 2609.07542, 64.7% ask for it in the PR description and 26.7% in the commit message. The disclosure check compares what a pull request declares with the agent evidence that was observed, and reports one state. It is off by default.
agent-strace review --disclosure report --pr-body body.md --commits origin/main..HEAD
agent-strace review --disclosure check --commits origin/main..HEAD # in CI, the PR description comes from the event
Without --commits, the default sources leave commit messages unread, so a
pull request whose description declares nothing gives not_compared, which
never fails the check.
| State | Label | Meaning | Fails check |
|---|---|---|---|
consistent |
consistent | AI assistance is declared and evidence was found, or neither | no |
declared_no_evidence |
declared, no evidence found | Declared, and no evidence in the sources read. Inconclusive: evidence can live elsewhere, such as a session that was not recorded. | no |
evidence_not_declared |
evidence, not declared | Evidence was found, and no declaration matched the project's settings | yes |
agent_signoff |
agent Signed-off-by present | A Signed-off-by trailer names an AI agent |
yes |
not_compared |
not compared | Nothing declares, and a configured source could not be read, or the PR description was truncated before a pattern matched | no |
report adds the result and never changes the exit code. check also fails
on evidence_not_declared and agent_signoff. The wording says what was read
and found. Evidence alone does not show how much of a change an agent wrote.
Declared¶
Two sources are read, set by disclosure_sources:
pr_body, the PR description. A visible line contains one of the patterns.commits, the commit messages in the--commitsrange. A commit declares when its author or trailers name an agent: anAssisted-byorGenerated-bytrailer, an agentCo-authored-byline, a Copilot cloud agent author, or aClaude-Session,Agent-Logs-UrlorEntire-Checkpointtrailer. Agent co-authors are known by their fixed address, never by name. Without--commitsthis source is not read.
The PR description comes from --pr-body FILE, then the GitHub
pull_request event payload, then GitLab's CI_MERGE_REQUEST_DESCRIPTION
(which GitLab truncates to 2,700 characters). At most 256 KiB are read. A
truncated description that matches no pattern gives not_compared, because the
declaration may sit in the part that was cut. Its text is never printed: the
output lists the patterns that matched.
Patterns are matched as case-insensitive substrings, one line at a time, never
as regular expressions. The default patterns are Assisted-by:,
Generated-by: (used by Apache projects) and Generated with [Claude Code].
These lines are skipped:
- HTML comments: a comment closed on its line, or one that starts a line and
runs to its
-->(or to the end, if none closes it). A<!--inside a line with no-->after it is text, as GitHub shows it. - fenced code blocks
- unticked task-list items, such as
- [ ] I used AI assistance
A ticked - [x] I used AI assistance matches the pattern
I used AI assistance. Choose a phrase that appears only on the checkbox
line, and put template instructions in an HTML comment so they never match.
Observed¶
- A session linked
explicit,branchorfile_overlap, or read from an Entire checkpoint with--entire(entire_checkpoint). Sessions found by a weak link (commit_time,latest,file_overlap_other_branchorfile_overlap_unverified) are listed and not counted. - With
--from-note, a session in the review note on the head commit. Sessions in a note found by a weak link are listed and not counted. - An external evidence signal that shows agent involvement. That includes git-ai notes and Agent Trace records with agent lines. They are not in a commit message, so they are never a declaration.
While commits is a source, a line that only declares is a declaration, not
evidence: the assisted_by, generated_by and agent_coauthor signals, and
the Copilot signal that rests only on a co-author line. A commit that carries
its own evidence is both: a Copilot cloud agent author or a Claude-Session,
Agent-Logs-Url or Entire-Checkpoint trailer is evidence, and a
declaration for that commit. When only pr_body is a source, commit lines are
not read as declarations, so those signals count as observed. If they are all
that was observed, the finding says the commits declare agent assistance and
the PR description has no matching declaration, and Observed lists them as
commit declaration lines.
Agent Signed-off-by¶
Signed-off-by certifies the Developer Certificate of Origin, which only a
person can do. The Linux kernel's rules say AI agents must not add it. When
--commits is given, whatever disclosure_sources says, a Signed-off-by in
a commit's final trailer block that names an agent gives agent_signoff. An
agent is the Copilot cloud agent, by bot name or noreply ID, or one of the
co-author addresses, such as noreply@anthropic.com; a name alone never
matches. comparison in JSON keeps the state the comparison gave.
Configure¶
review:
disclosure: check # off, report, or check
disclosure_patterns: # replaces the defaults
- "Assisted-by:"
- "Generated-by:"
- "I used AI assistance"
disclosure_sources: [pr_body, commits]
disclosure_patterns takes up to 50 patterns of up to 200 characters. Quote a
pattern that contains [ or #. --disclosure overrides disclosure.
--pr-body without the check on, or without pr_body as a source, is an
error (exit 2), as is any invalid value.
Text output adds:
Disclosure: evidence, not declared (check) FAIL
Agent evidence was found, and no declaration matched the project's disclosure settings in the sources read. Evidence alone does not show how much of the change an agent wrote.
Declared: PR description matches no pattern; no declaration in 3 commits
Observed: 1 linked session
Fails the check.
JSON adds a top-level disclosure object: mode, state, label,
comparison, fails_check, detail, declared (per source: what was read
and matched), observed (sessions, weak_sessions, from_note (the
sessions came from a review note), signals, and declaration_signals, the
signals that rest only on a commit declaration line), not_read
and agent_signoffs (commit, agent label and display name).
review_result stays the findings result, and result
also counts the disclosure check.
GitHub Action¶
on: pull_request
permissions:
contents: read
pull-requests: write
jobs:
reviewability:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
- uses: Siddhant-K-code/agent-trace@v0.132.0
with:
review-commits: origin/${{ github.base_ref }}..HEAD
cognitive-debt: auto # off on pull_request; false, report, or check
The defaults are review: "true", post-pr-comment: auto,
github-token: ${{ github.token }} and run-eval: auto. The eval runs only
when its config file (default .agent-evals.yaml) exists, so in a repository
without one this job runs the check alone.
The step posts or updates one PR comment. It leads with the check result and
why, then the evidence headline, each linked session with its source (an
agent-trace session, a review note, or an Entire checkpoint) and how it was
linked, and the five findings. The session summary, flags, and replay commands
follow in a collapsed Session details block. With post-pr-comment: auto,
it posts on pull_request and pull_request_target events. A comment it
cannot post, for example without pull-requests: write, is a warning and
leaves the result unchanged. Set post-pr-comment: "true" to post on any
event and fail the step when the comment is not posted, or "false" to never
post. When trace-dir has no
session, it posts only if a review note or
Entire checkpoints were read, or if the
external evidence from review-commits, review-otel-logs or
review-agent-trace-records shows agent
involvement: shows_agent is true in review.json (see
agent involvement), or if the
disclosure check fails, as on an agent Signed-off-by. That
comment says no agent-trace session was linked and shows the five findings and
the external evidence. A pull request with no note, where every external
signal is missing, or where the range or file could not be read, gets no
comment unless the disclosure check fails, so human pull requests stay quiet. It always writes the table to the step summary. It exits
non-zero per the threshold, so it works as a required status check. Fork PRs
skip the comment because their tokens are read-only, but still run the check.
The Action reads sessions from trace-dir (default .agent-traces), which
git ignores. To review without committing them, publish a
review note. Or commit the sessions, or restore them from an
artifact, before this step.
The ref in uses: decides the CLI version. A release tag vX.Y.Z installs
agent-strace==X.Y.Z from PyPI. If PyPI does not serve it yet, right after a
release, the step retries for about 45 seconds and then installs the Action
checkout of that tag. A branch, commit SHA, or uses: ./ installs the Action
checkout. Set agent-strace-version to install a different version from
PyPI; the step fails if that version is not installable. Use a version no
older than the Action ref: the Action passes review flags, such as --junit
and --change-record, that older versions reject, and the check then ends in
error. The step log names the source and version installed.
To list external evidence, set review-commits to a range such as
origin/${{ github.base_ref }}..HEAD, with fetch-depth: 0 on the checkout,
and review-otel-logs to a Claude Code OpenTelemetry export in the workspace.
They pass --commits and --otel-logs to the check. The range also gives
the PR's changed files. review-commits also
reaches cognitive debt, and the Action fetches refs/notes/ai from the pull
request head repository for its git-ai notes.
Set review-agent-trace-records to an Agent Trace records file in the
workspace to pass --agent-trace-records to the check and to cognitive debt.
Evidence order¶
The check reads the first of these that it finds:
- Agent-trace sessions in
trace-dirlinked to the pull request by branch or by the files it changes. - The Entire checkpoints that
Entire-Checkpointtrailers inreview-commitsname, read as withreview --entire. - The review note on the head commit, when
review-noteistrue.
A plain checkout fetches no refs/entire/ refs, so with review-commits set
the Action fetches them, and refs/notes/ai for the git-ai notes, from the
pull request head repository. review-fetch-agent-refs controls this: auto
(the default) and true fetch, false fetches neither. The fetch is
read-only, and a failed fetch never fails the job. It fetches only the
refs/entire/checkpoints/<shard>/<id> refs for the IDs the trailers name, at
most 50, and skips the network when the clone already has them. When the head
repository has none of those refs but has the entire/checkpoints/v1 branch,
it fetches that branch into
refs/remotes/agent-strace-pr/entire/checkpoints/v1. It never makes the
clone shallow. Checkpoints already in the clone are read even with false.
When review-commits has more than 500 commits, the most review --entire
reads, the Action adds a notice and neither fetches nor reads checkpoints.
The review-note fetch of refs/notes/agent-strace is separate and
unchanged.
When at least one named checkpoint is in the clone, the check runs with
--entire. With review-note on and no session in trace-dir linked to the
pull request, it also fetches the review note and passes --from-note: the
note is read only when no checkpoint session is, for example when every
checkpoint is skipped as unreadable. The check grades checkpoint sessions
like agent-trace sessions, so their findings can fail it per the
threshold. When the check reads the checkpoints
instead of a session in trace-dir that is linked only weakly, the Action
makes no evidence packet or cognitive debt report for that session, so
neither covers a session the check did not review.
Checkpoint transcripts are read into a temporary store that is removed after
the run, never into trace-dir, so upload-traces never
uploads them. A checkpoint is reported by the author and unsigned. The PR
comment says its findings read the Entire checkpoints named in the pull
request's commits, and never quotes transcript text.
To run the disclosure check, set review-disclosure to
report or check. It reads the PR description from the pull_request
event, and the commit messages from review-commits. Add edited to the
event types so that editing the description runs the check again:
on:
pull_request:
types: [opened, synchronize, reopened, edited]
# ...
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
- uses: Siddhant-K-code/agent-trace@v0.132.0
with:
review-commits: origin/${{ github.base_ref }}..HEAD
review-disclosure: check
An empty review-disclosure uses the review block of .agent-strace.yaml,
then off.
Artifacts¶
With review on (the default), the Action takes the first linked session and
writes the files below. share writes one session per packet, so with several
linked sessions the review names the session the packet covers.
| File | Artifact | Made by |
|---|---|---|
evidence-packet.html |
agent-trace-pr-evidence |
share SESSION --output FILE. Metadata only. Prompt and tool content are never included. |
cognitive-debt.json |
agent-trace-pr-evidence |
cognitive-debt --session SESSION --format json |
cognitive-debt-badge.json |
agent-trace-pr-evidence |
cognitive-debt --session SESSION --format badge |
review.json, review.md |
agent-trace-pr-review |
review --format json and --format markdown |
review.junit.xml, change-record.json |
agent-trace-pr-review |
The --format json run, with --junit FILE --change-record FILE. Both are written when the review exits 0 or 1, and neither when it exits 2. See gate merges on any forge and change record. |
The review table links the evidence packet only when the upload returned a URL. Otherwise it says the file is local and not uploaded, or not generated. A failed packet or upload does not fail the step. The step outputs give each path, the review result, and the cognitive debt status and result. See commands.md.
The agent-traces artifact holds the whole trace directory, which can hold
prompt and tool content. Anyone with read access to the repository can
download it, which on a public repository is any signed-in GitHub user. With the
default upload-traces: auto it is uploaded only when the eval step runs, so
the job above uploads it only in a repository with an eval config. Set
upload-traces: "true" to upload it on every run, as earlier versions did.
Cognitive debt¶
cognitive-debt reads schema_version and status from the JSON report. It
never reads the badge color.
| Status | Result | With check |
|---|---|---|
clean, partial |
pass | passes |
above_threshold |
fail | fails |
unknown, missing, or unsupported report |
unavailable | fails |
unknown means review coverage could not be measured. It is never a pass. With
report, the result is shown and does not change the exit code.
The cognitive-debt input defaults to auto: false on pull_request,
pull_request_target and merge_group, report on any other event. Cognitive debt reads
GitHub reviews of merged pull requests only, so before merge it cannot see the
review of the pull request it runs on, and the result is unreviewed or
unknown. Run it on the default branch after merge, or use the
team view on a schedule. An explicit
report or check still runs it on a pull request.
Gate merges on any forge¶
Every forge already gates merges on a CI job's result. review exits 1 when
a finding fails the threshold, so a job that runs it on each pull or merge
request is a merge gate wherever a passing pipeline is required. Run the job
on every pull request, without path filters, so the required result is never
missing.
--junit FILE writes the same review as JUnit XML, which GitLab, Azure
Pipelines, Bitbucket Pipelines and Jenkins show next to the test results:
| JUnit | Review |
|---|---|
| test case | One per finding, named by its label, plus Cognitive debt and Disclosure when those checks are on |
| failure | The finding or check fails the threshold. The message gives the status, confidence and detail. |
| skipped | An inconclusive finding the threshold does not fail, a cognitive debt check in report mode that is not a pass, or the disclosure check in report mode, whatever its state |
| passed | Everything else. The evidence is in system-out. |
| suite properties | result, review_result, evidence, branch, threshold, and each linked session with its source and link |
The report has a failure exactly when review exits 1. It holds no
timestamps, prompt text or command strings, so the same review gives the same
file. When review exits 2, no file is written.
| Forge | Make it required | Show the report |
|---|---|---|
| GitHub | A required status check in a ruleset or branch protection | The Action posts the PR comment and step summary, and gives the JUnit file as the review-junit-path output |
| GitLab | Pipelines must succeed on the project | artifacts:reports:junit |
| Azure DevOps | A build validation branch policy | PublishTestResults@2 with testResultsFormat: JUnit and condition: succeededOrFailed() |
| Bitbucket Cloud | The minimum successful builds merge check. It blocks the merge on Premium and warns on other plans. | Write the file under test-results/, which Pipelines reads automatically |
| Gerrit with Jenkins | A submit requirement on the Verified label, voted from the build result (for example by the Gerrit Trigger plugin) |
The junit step |
GitLab: include the agent-review component from a
release tag, with workflow: rules in .gitlab-ci.yml so that GitLab creates
merge request pipelines (see the component).
workflow:
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
- if: $CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS
when: never
- if: $CI_COMMIT_BRANCH
include:
- remote: 'https://raw.githubusercontent.com/Siddhant-K-code/agent-trace/v0.132.0/templates/agent-review.yml'
Azure Pipelines:
steps:
- checkout: self
fetchDepth: 0
persistCredentials: true
- bash: |
pip install agent-strace
git fetch --no-tags origin '+refs/notes/*:refs/notes/*' \
'+refs/entire/checkpoints/*:refs/entire/checkpoints/*' || true
agent-strace review --from-note --entire \
--commits "origin/${SYSTEM_PULLREQUEST_TARGETBRANCH#refs/heads/}..HEAD" \
--junit "$(Build.ArtifactStagingDirectory)/agent-review.junit.xml"
displayName: Agent review
- task: PublishTestResults@2
condition: succeededOrFailed()
inputs:
testResultsFormat: JUnit
testResultsFiles: $(Build.ArtifactStagingDirectory)/agent-review.junit.xml
testRunTitle: agent-trace review
Bitbucket Pipelines:
pipelines:
pull-requests:
'**':
- step:
name: Agent review
image: python:3.12
clone:
depth: full
script:
- pip install agent-strace
- git fetch --no-tags origin '+refs/notes/*:refs/notes/*' '+refs/entire/checkpoints/*:refs/entire/checkpoints/*' || true
- agent-strace review --from-note --entire --commits "origin/$BITBUCKET_PR_DESTINATION_BRANCH..HEAD" --junit test-results/agent-review.xml
The Bitbucket default image has no Python 3 pip, so the snippet sets
image: python:3.12. The component does the same on GitLab.
The job must see the sessions: commit .agent-traces, restore it before the
step, or fetch a review note and add --from-note. A CI
clone has no notes and no refs/entire/ refs, so the snippets fetch them from
origin. A fetch that finds nothing does not fail the step. review reads
the pull request's branch, head commit and target branch from the CI
variables (see How sessions are linked), so it
finds the note on the head commit although Azure Pipelines and Bitbucket
Pipelines build a merge commit. --commits origin/<target>..HEAD names the
commits whose Entire checkpoints and
git-ai notes are read. It needs the full
history: fetchDepth: 0 on Azure, clone: depth: full on Bitbucket. Azure
removes the checkout's token after checkout unless persistCredentials: true
is set. --entire reads at most 500 commits and exits 2 on a longer range,
so drop it there.
GitLab component¶
templates/agent-review.yml is a GitLab CI/CD component. It adds one job
that runs on merge request pipelines with GIT_DEPTH: "0". The job:
- installs the agent-strace version the release tag pins;
- fetches the review note, the git-ai notes and the Entire checkpoints that
Entire-Checkpointtrailers in the merge request name; - runs
review --junitwith--commitsfromCI_MERGE_REQUEST_DIFF_BASE_SHAto the source branch head,--from-note, and--entirewhen a trailer names a checkpoint; - uploads the report with
artifacts:reports:junit, even when the job fails.
review's exit code is the job's result.
GitLab creates a merge request pipeline only when rules in .gitlab-ci.yml
itself match merge_request_event. Rules in an included file, such as the
job's own, do not count, so without them the job never runs. Add
workflow: rules next to the include. The ones below run merge request
pipelines, and branch pipelines only for branches with no open merge request.
Set inputs under the include:
workflow:
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
- if: $CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS
when: never
- if: $CI_COMMIT_BRANCH
include:
- remote: 'https://raw.githubusercontent.com/Siddhant-K-code/agent-trace/v0.132.0/templates/agent-review.yml'
inputs:
fail-on: missing,partial
| Input | Default | Description |
|---|---|---|
job-name |
agent-review |
Name of the job |
stage |
test |
Stage the job runs in |
image |
python:3.12 |
Image with Python, pip and git |
version |
the tag's version | agent-strace version to install. Empty installs the latest. Use a version no older than the tag: older versions reject review flags the job passes, such as --junit, and the job then fails. |
trace-dir |
.agent-traces |
Directory of committed or restored sessions |
fail-on, min-confidence |
empty | Passed as --fail-on and --min-confidence. Empty uses the threshold from .agent-strace.yaml, then the defaults. |
review-note |
true |
Fetch refs/notes/agent-strace and pass --from-note |
entire |
true |
Fetch the named Entire checkpoints and pass --entire |
git-ai |
true |
Fetch refs/notes/ai for the git-ai notes |
strict-links |
false |
Pass --strict-links. See strict links. |
junit |
agent-review.junit.xml |
Path of the JUnit report |
args |
empty | More review arguments, as shell words |
The head is CI_MERGE_REQUEST_SOURCE_BRANCH_SHA in a merged results
pipeline, else CI_COMMIT_SHA. Like the GitHub Action,
the job fetches exact refs only, from the merge request's source project and
then origin, with no credential prompt and at most 120 seconds per fetch.
A failed fetch prints a notice and never fails the job. Each named checkpoint
is fetched from the first of those projects that has it, so checkpoints split
between a fork and the parent project are all fetched. At most 50 checkpoints
are fetched. When a project has none of the checkpoints still missing but has
the entire/checkpoints/v1 branch, the first such branch is fetched into
refs/remotes/agent-review/entire/checkpoints/v1. Over 500 commits, the job
prints a notice and neither fetches nor reads checkpoints. Without a diff
base, review runs without --commits, so only the review note is fetched.
A merge request from a fork runs its pipeline in the fork project, with the
fork's CI/CD settings and variables, unless a member of the parent project
runs it in the parent from the merge request's Pipelines tab. Either way
the job comes from the .gitlab-ci.yml on the fork's branch, which the
merge request can change, so check changes to it before you rely on the
result.
The repository is on GitHub, so include:remote reads the file from the
release tag. It uses the CI/CD component layout, spec:inputs in
templates/, but is not published in the GitLab CI/CD Catalog.
Change record¶
--change-record FILE writes one agent-strace-change-record/v1 JSON record
for the pull or merge request. Change-management controls such as SOC 2 CC8.1
and ISO/IEC 27001:2022 Annex A 8.32 ask who requested a change, what it
touched, how it was tested and who approved it. An auditor samples a change
and follows it from the request to its approval and pipeline. The record is
the agent part of that trail. Keep it as a pipeline artifact. The GitHub
Action writes it on every review run, uploads it in the agent-trace-pr-review
artifact and gives its path as the change-record-path output.
| Field | Holds |
|---|---|
change |
forge, CI system, repository, pull or merge request ID and URL, source and target branch, head SHA, event and pipeline URL. Read from GitHub Actions, GitLab CI, Bitbucket Pipelines, Azure Pipelines or a Jenkins Gerrit Trigger job. The repository is named as its host names it: owner/repo on GitHub, the project path on GitLab, workspace/repo on Bitbucket, and on Azure Repos the path before /_git/ in BUILD_REPOSITORY_URI (organization and project) and the repository name. A merge queue run names its pull request but no head SHA, because the queue tests a temporary merge commit. Its source branch is the pull request's head branch that review read to link sessions (see merge queues). When review did not read it, because the API call failed or --branch was given, it is the queue's branch, and limits says so. A GitLab merge request from a fork is named in the target project, which owns its ID. The branches and head SHA come from the variables in how sessions are linked, so they match what the review linked: an abbreviated Bitbucket head is expanded, and an Azure pull request build without SYSTEM_PULLREQUEST_SOURCECOMMITID names no head SHA rather than its merge commit. Outside CI, only the head SHA. |
agent_involvement |
the linked branch, the evidence state and each linked session: how it was linked and whether that link is strong, where its evidence came from (trace, review_note or entire_checkpoint), the agent, start and end, driven_by, and source_trace_sha256. A session from a review note gives the note's commit, match, event count and digests instead; one from Entire gives its checkpoint IDs. With --strict-links, strict_links is true and refused_sessions lists each refused session and its link. |
evidence |
request, scope, testing, human_oversight and evidence_health, each from one review finding with its status, confidence, source, facts and whether it fails the gate. With --ci-checks, testing holds the CI read on the head commit, and limits says CI was read. |
approval |
recorded: false and the keys to join the forge's approval on. The forge holds the approval. With --approvals, the GitHub pull request's approvals as they were when the record was written: see approvals. |
gate |
result, exit code, threshold and failing findings, plus the cognitive debt and disclosure results when those checks are on |
maps_to |
the criteria the record is evidence toward. It is not an attestation that they are met. |
limits |
what the record does not show, such as a weakly linked session, an author-reported one, an unattributed one or one --strict-links refused |
integrity |
record_sha256 over the record without that field |
source_trace_sha256 equals the value in that session's evidence packet
manifest, so the record, the packet and the trace can be matched later. It is
the digest of the events the findings were assessed from, so events a running
agent appends after the review read the session do not change it. A
session read from Entire checkpoints gets the same digest on every run, equal
to the packet of the session that import --entire --commits stores from the
same range in the same AGENT_STRACE_WORKSPACE. There is no digest, and limits says why, for an Entire
checkpoint that carries no timestamps (its start and end are left out too) or
for a trace that holds text that is not valid Unicode or a number that is not
valid JSON.
driven_by is written only from explicit attribution (actor, engineer, user
or git author), never from an OS user or host name. A git author can be a name
or an email address, as in the commits, and anyone who can download the
artifact can read it: on a public repository, any signed-in GitHub user. The record holds no prompt
text, command strings or generation time, so the same review gives the same
record.
Like --junit, the record is written before the review prints, and only when
the review exits 0 or 1. With both flags, both files are written or
neither is: a path that is a directory or anything else but a regular file is
refused before either is written, and if a rename still fails after the other
file was replaced, that file gets its previous content back. The two flags
cannot name the same file. On a file system that ignores case, such as the
macOS and Windows defaults, names that differ only in case are the same file.
Approvals¶
--approvals, which needs --change-record, reads the pull request's reviews
and commits from the GitHub API when the record is written, and says whether
someone other than the people who wrote the change approved its head. It reads
only a GitHub pull request that the record's change names. The token comes
from GITHUB_TOKEN, or GH_TOKEN when that is not set, and needs read access
to pull requests: in GitHub Actions, permissions: pull-requests: read. On
GitHub Enterprise Server, GITHUB_API_URL names the API; Actions sets it.
The approval block then holds:
| Field | Holds |
|---|---|
recorded, source |
true and github. source names the API the approvals were read from, not the forge. |
author |
the pull request author's login |
head_sha |
the head approvals are compared with: change.head_sha, the head the findings describe. A merge queue record has no change.head_sha, so it is the pull request's head as GitHub reports it. |
approvals |
each reviewer whose deciding review approved: reviewer, reviewer_type (User or Bot), the commit_id it approved, on_head (that commit is head_sha), is_author, authored_commits (the reviewer authored or committed a commit of the pull request) and matches_operator |
changes_requested |
each reviewer whose deciding review requested changes, with its commit_id and on_head |
commit_authors |
the logins GitHub links to the authors and committers of the pull request's commits, without web-flow, the committer of changes made in GitHub's web UI. No email or name is written. |
independent |
yes when an approval of the head is from someone who is not a bot, is not the author, did not author or commit a commit and does not match a session operator; no when the head has approvals but none of them is; none when no approval is on the head |
truncated |
true when GitHub may list more reviews or commits than were read: the first 1,000 reviews are read, and GitHub lists at most 250 commits |
join_on |
the same keys as without --approvals |
A reviewer's deciding review is their latest one that approved, requested
changes or was dismissed. A comment does not change it, and a dismissed
approval is in neither list. An approval from an account GitHub reports as type
Bot is listed with that reviewer_type, but never makes independent yes:
a bot approves for whoever set it up. When the only approvals of the head are
from bots, independent is no, and limits says how many approvals are from
bots.
matches_operator compares text: it is true when a linked session's
driven_by is the reviewer's login, or an email whose local part is the login
or GitHub's noreply form ID+login, ignoring case. driven_by can be a name or
another email, so false is not proof of a different person. A session with no
driven_by is not compared, and limits says how many there are.
Approvals usually arrive after the pull request opens, so a record written on a
pull_request opened run usually says none. Write it once the approval is
in: on merge_group, or on pull_request_review with types: [submitted].
Approvals can change after that; the forge holds their current state.
The pull request's head on GitHub can move on from change.head_sha before the
record is written: a push lands before the job runs, or an older run is re-run.
Approvals are still compared with change.head_sha, so an approval of the newer
head is not on_head and does not make independent yes, and limits names
both heads.
On pull_request_review, GitHub does not always set GITHUB_HEAD_REF, so the
review may not find the branch to link sessions by. Pass
--branch "${{ github.event.pull_request.head.ref }}", or --commits with the
pull request's base and head, such as
--commits "${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }}"
with enough history fetched for that range, so the sessions still link.
In the GitHub Action, set review-approvals: "true" and give the job
pull-requests: read. The Action passes --approvals to the review run that
writes change-record.json, not to the other runs, and the check result does
not change. On pull_request_review, set review-commits to the pull request's
base and head as above.
When the approvals cannot be read, the block holds recorded: false,
source: github (the API it would have read, also for not_github), a
reason and join_on, limits says why, and one warning line goes to
stderr. The reasons are not_github, no_pull_request, invalid_change (the
repository or pull request number is not valid), no_token, invalid_token
(the token holds a character that is not printable ASCII, such as a newline, so
it is not sent) and unreadable (an HTTP, network or response error). The warning
gives an HTTP error's status and reason or a network error's reason. Any other
error is named only by its type, so the warning never holds the token.
Approvals never change the printed review, its exit code, gate or the JUnit
file.
Review notes¶
The trace directory stays on your machine. A review note carries the review findings to CI without it. On the PR branch, after the last commit:
--publish-note runs the review, then writes the findings to a git note on
HEAD in refs/notes/agent-strace. The note holds:
- the five findings, as the PR comment shows them;
- the session IDs and how they were linked;
- for each session, the event count, a SHA-256 of the event lines and the hash-chain state.
It does not hold prompt or tool content. Only sessions named on the command
line or matched by branch are published. A weak link is refused with exit 2.
Add --commits origin/main..HEAD to record the commits the review covered.
Publish again after new commits. A plain git push does not push notes, and
GitHub does not show them.
In CI, review --from-note and pr-comment --review --from-note read the
note when no session is linked. The Action does this by default. With
review on and no session in trace-dir linked to the pull request, for
example when no recorded session wrote one of its files, it:
- fetches
refs/notes/agent-stracefrom the pull request's head repository, which isoriginor the fork; - passes
--from-note.
Set review-note: "false" to turn this off. To fetch from a private
repository, actions/checkout must keep its credentials, which is its
default. The GitLab component fetches the note and
passes --from-note too, unless its review-note input is false.
The lookup checks the PR head commit, then the commits of review-commits,
newest first. For each commit it uses:
- a note attached to the commit;
- otherwise, a note published for a commit with the same patch ID. This
finds the note after a rebase or force-push that kept the change. It needs
the commit's parent in the clone, so use
fetch-depth: 0on the checkout.
To carry the note to the new commit on git commit --amend and git rebase,
run git config notes.rewriteRef refs/notes/agent-strace. The report names
the commit whose note was used and how many of the commits checked the note
names.
Trust¶
The findings in a note were reported by the author's machine, not derived in CI. The note is unsigned, and CI cannot re-check it against a trace. The terminal text, the Markdown, the PR comment and the JSON all say so.
- A note can turn a check that fails with no session into a pass, for example
under
--fail-on inconclusive --min-confidence low. - With
--ci-checks, a note'spresentvalidation is checked against CI on the head commit: a red CI makes itpartial. See check test claims against CI. - The sessions in a note on the head commit count as observed in the disclosure check. They can make that check fail, never pass.
- Anyone who can push the notes ref can write a note by hand. On a fork pull request, the fork's owner controls it.
If a required check should not accept the author's statement, set
review-note: "false". See
ADR-0017.
To check a note against the sessions on your machine:
agent-strace verify --note # the note on HEAD
agent-strace verify --note abc1234 # the note on another commit
It reports each session as one of:
matchextended, with events added since publishingdiffersmissingunreadable
It exits 1 unless every session is match or extended. It compares
event logs only and does not re-derive the findings.
If the push is rejected because another machine published first:
git fetch origin +refs/notes/agent-strace:refs/notes/origin-agent-strace
git notes --ref=agent-strace merge -s ours refs/notes/origin-agent-strace
git push origin refs/notes/agent-strace
Where both machines noted the same commit, -s ours keeps your note.
Review PRs from Entire users¶
Entire records agent sessions as git
checkpoints and links each commit to one with an Entire-Checkpoint trailer.
review --entire grades those sessions with the same five findings, with no
Entire account, no model and nothing for the contributor to install. It
reads the checkpoints from the clone with git.
In a local clone, fetch the pushed checkpoints, then review the pull request's commits:
git fetch origin 'refs/entire/checkpoints/*:refs/entire/checkpoints/*'
agent-strace review --entire --commits origin/main..HEAD
A repository that keeps checkpoints on the entire/checkpoints/v1 branch
needs no extra fetch after git clone: the remote-tracking
origin/entire/checkpoints/v1 branch is read too. For a pull request from a
fork, fetch from the fork instead of origin.
In the GitHub Action, set review-commits and check out
with fetch-depth: 0. With
review-fetch-agent-refs at its default, auto, the Action fetches the
checkpoints that the trailers name from the pull request head repository,
including a fork. When a named checkpoint is in the clone, the check runs
with --entire. See Evidence order. On GitLab, the
agent-review component does the same.
A session linked by name, by branch or by the pull request's changed files
takes precedence, so a branch with agent-strace sessions is reviewed from
them. The details are in
review --entire.
To use share, cognitive-debt or health on these sessions, copy them into
the trace store first:
A session already in the store, captured by hooks or imported from the agent's
transcript, is not imported twice. See
import --entire.
To hand a reviewer the evidence for one session, write a packet from it:
The packet says it came from an Entire checkpoint and names the checkpoint
and the commits. Values the checkpoint does not record show not recorded.
Files from the checkpoint's files_touched list are marked as listed, not
observed writes. See share.
What to expect:
- The reader reads each session's
metadata.json,prompt.txtand compacttranscript.jsonl. It never readsfull.jsonl, the agent's native transcript. It scrubs the project root and home directories from every string and, unless redaction is turned off, runs agent-strace's secret redaction on it. - Evidence health is
partial, neverpresent: a checkpoint is the session author's own record, read after the session, and unsigned. See Sessions read from a checkpoint. review --entirekeeps the sessions in a temporary store that is removed after the run. The PR comment never quotes transcript text, and the Action never uploads the sessions.- On a public repository, pushed checkpoints can be fetched by anyone. Entire says so when it is enabled.
review --entirecannot be combined with--publish-note. With--from-note, the review note is read when no checkpoint session is.reviewdoes not run Entire's own review, which uses LLM reviewer agents. The two answer different questions and can run on the same pull request.- A weekly format drift check reads the checkpoints that a pinned Entire release and the newest one write, so a change in Entire's checkpoint layout shows up before a reviewer meets it.
Sample comment section¶
Two linked sessions. The second edits a file after the first ran its checks.
In the PR comment, this section follows ## agent-trace review, and a
collapsed Session details block with the session table, flags, and replay
commands follows it.
### Reviewability
Check: **pass**. No finding fails the threshold. Threshold fails on `missing` at `medium` or higher confidence (default).
**Linked sessions**
- `3f9c2a71b0d4` (agent-trace session), linked by `branch`: session git branch matches the PR branch
- `8e1d5b6c4a20` (agent-trace session), linked by `branch`: session git branch matches the PR branch
| Finding | Status | Confidence | Evidence | Source |
|---|---|---|---|---|
| Rationale | present | high | 3 prompts captured in 2 sessions. | user\_prompt events \(content not shown\) |
| Scope | partial | medium | 1 of 2 written files were named in a prompt or read in the session. Not named or read: `src/extra.py` | file and edit tool events, shell redirection targets, prompt path mentions, file reads, shell read targets |
| Validation | partial | medium | Last run: pytest passed, exit 0; ruff passed, exit 0. Files changed after the last run of: pytest \(1 file\), ruff \(1 file\). | shell tool calls and linked results inside the session \(not CI\) |
| Stewardship | present | medium | 3 human turns, 1 after the first tool call, 0 approval decisions. Permission modes: default. | user\_prompt events, approval requests, recorded permission modes |
| Evidence health | partial | high | Health: 2 partial \(claude\). Redaction: on. Linked by: branch. | agent-strace health, capture matrix, session link |
**Artifacts**
- Evidence packet: `evidence-packet.html` in the [workflow artifact](https://github.com/OWNER/REPO/actions/runs/123/artifacts/456). Metadata only. Covers session `3f9c2a71b0d4` only (1 of 2 linked sessions).
- Cognitive debt: `unknown`, review coverage unknown. Unavailable, not a pass. (report only)
Limits¶
- The paper is survey evidence about what reviewers say they want. It does not show that attaching this evidence changes review outcomes.
- The check reports captured evidence only. It does not claim complete capture. Providers differ; see the capture matrix.
- External evidence is read from the clone and the files given. Nothing is fetched, and a trailer alone does not show that the evidence behind it is complete.
- The disclosure check matches fixed phrases. It cannot tell whether a
declaration is accurate, and a human-only change with no declaration and no
evidence reads as
consistent. - Validation is in-session only unless
--ci-checksreads GitHub CI. Claims are found by fixed English phrases, so a claim worded another way is missed. Many hooks do not record exit codes. A run without one is read from the test runner's summary when one of the supported runners printed it, and is reported as unknown otherwise. - Scope uses path matching against prompts and reads. A file can be in scope without being named, and the check will still report it as not named.
- File overlap matches path suffixes. A session whose working directory is outside the repository can match a file with the same relative path.
- Shell file writes are found only through redirection and
tee, and shell reads only through the viewers listed above and<. Other shell commands that write or read files (sed -i,cp,mv,grep, scripts) are not seen, and a redirect in a command that failed still counts. - Cognitive debt measures review coverage, not code quality.
- A review note's findings are reported by the author's machine. CI does not derive them, and the note is not signed.
- Output is deterministic. No LLM writes or summarizes any part of it.