Repository navigation
Description
Problem
review.sh assembles what the independent commit reviewer reads: the staged paths and diff against the right parent (the head, the amended commit's parent, or the empty tree), the base-merge reconstruction against both parents and the automatic merge tree, the recent subjects, the operator note and its digest, and trusted review policy. It then runs the reviewer and stamps the result bound to the draft, tree, head, mode and merge head. That logic is 126 lines of shell under the freeze in #588.
Part of #322, within #588. Child 03 in #322's Children list. Delivers in Go the behavior of packages/agents/source/skills/commit/shared/scripts/review.sh as agentrepo commit review.
Acceptance criteria
- AC1: Given a normal commit, when the review inputs are gathered, then the diff is taken against the head, or against the empty tree on an unborn head.
- AC2: Given
--amend, when inputs are gathered, then the diff is taken against the parent of the head, or the empty tree when the head has none; given an unborn head, then it refuses with "There is no commit to amend yet." - AC3: Given a base merge in progress, when inputs are gathered, then the staged diff shows each conflict path against both parents plus the changes from the automatic merge tree, including edits, additions and deletions outside the conflict paths.
- AC4: Given a clean base merge whose staged tree equals the automatic tree, when inputs are gathered, then the context says the conflict diff is empty by design; given any other empty diff beside named paths, then it refuses.
- AC5: Given
--amendduring a base merge, when the review runs, then it refuses with the HELD message. - AC6: Given
--note <file>, when the review runs, then the note is copied into the review inputs and its digest is bound into the stamp; given a note that is not a file, then it refuses naming the path. - AC7: Given the index, head, merge head, copied note, draft bytes, the copied draft supplied to the reviewer or trusted-policy authority change while the reviewer runs, when the review ends, then no stamp is written; the draft and its copy are each compared with their snapshot, as the shell does.
- AC8: Given the reviewer returns findings, an unreadable verdict or times out, when the review ends, then no stamp is written and a findings result prints "Fix every finding in COMMIT_AGENTMSG, then run review.sh again."
- AC9: Given a reviewed draft, when the stamp is written, then it binds the draft digest, tree, head, mode, merge head, parents, note digest, and the applied review-policy ref, commit, digest and status, in the form the commit step checks today.
- AC10: Non-functional: the reviewer runs read-only and is selected only from machine configuration, never from repository files.
Scope and non-goals
Scope: agentrepo commit review: gathering review inputs and invoking the reviewer and stamp functionality that #321 delivers.
Non-goal: the stamp, prompt, verdict and freshness-validation implementations themselves, which #321 delivers; this child verifies that its guarantees stay active for these inputs. Non-goal: invalidating an approval when the original note file changes after the review, which is new behavior and not parity; the current stamp binds the copied note. Non-goal: changing the review criteria skill text. Non-goal: switching any shell wrapper, which child 07 does once.
Approach
Meet AC1 to AC10 with failing cases first. Base-merge cases use real scratch repositories with conflicting branches, as tests/skills/agent-commit/base-merge.bats does. Use the review snapshot, verdict and stamp functionality from #321 rather than duplicating it.
Dependencies
Blocked by: #850.
Prerequisite: the review snapshot, verdict and stamp deliverables of #321, including its freshness validation. This child needs no confirmation deliverable.
Size
M. One pull request.
Verify plan
- AC1, AC2, AC3, AC4, AC5: Go tests over scratch repositories; the base-merge and amend cases from
tests/skills/agent-commit/base-merge.batsandtests/skills/commit/scripts/commit-workflow.batsported. - AC6: a test copies a note, decodes the stamp's note digest, and refuses a non-file note.
- AC7: tests with a stub reviewer that, one case at a time, moves the index, moves the head, moves the merge head, rewrites the copied note, edits the draft, edits the copied draft the reviewer was given, and changes the trusted policy while it runs.
- AC8: tests with a stub reviewer that returns findings, an unreadable verdict, or hangs.
- AC9: a test decodes the stamp and compares its bindings with the ones the commit step requires.
- AC10: a test sets a repository-file reviewer and shows it is ignored, and that the reviewer process cannot write to the repository.
- Definition of done: D1 each AC is verified at the merged head, with the commands and results cited in the pull request's Verification. D2 an independent review approves the exact merged head, and every finding has a recorded disposition. D3 required checks pass with no gate loosened. D4 the leak scans the repository specifies are clean, and every post made for this work passes the per-post leak review before it is posted. D5 every commit is signed. D6 the documentation matches the change or the Verification says why there is no impact. D7 every commit has an
Assisted-bytrailer and the pull request has theprovenance:agent-assistedlabel. D8 the pull request stays within the size limits. D9 follow-ups are filed as issues and listed under Related. D10 the merge closes the issue through a closing reference, the board shows Done, and the finalStatus:comment names the merge commit.
Risks
A stamp that binds less than before would let a stale review pass. The binding and freshness tests (AC7, AC9) and the gates child's freshness cases are the controls. Undo: revert the change; no caller uses the subcommand until child 07.
Operator authority
None.
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Work type
Projects
- StatusShow more project fieldsBacklog
Activity
tbhb-agent commentedon Oct 27, 2026
Refinement: READY — Gather and stamp the commit review from agentrepo commit
Model: gpt-6-astra
Child 03 Gather and stamp the commit review from agentrepo commit
Verdict: READY
Checked: The amendment explicitly covers mutation of the copied draft supplied to the reviewer, closing the remaining freshness gap. Independent comparisons of the live draft and copied draft are present at
packages/agents/source/lib/lib.sh:604.Copied-note freshness, merge reconstruction, trusted-policy bindings, reviewer selection and read-only execution all have verification assignments. Evidence:
packages/agents/source/skills/commit/shared/scripts/review.sh:98,packages/agents/source/skills/commit/shared/scripts/review.sh:139andpackages/agents/source/lib/lib.sh:585.The #321 dependency names supplied outcomes without duplicating their implementation. Wrapper switching remains exclusively in 07. Scope, authority, risks and undo are consistent.
Gaps: None.
Split: None. M remains credible for gathering inputs and integrating shared review machinery.
Definition of done
The definition of done for this issue (Feature). Tick each item and give its evidence.
check-leaks.shwith the repository's private-strings list, and the leak review of each post.docs/, CHANGELOG or help text), or the Verification section says "No doc impact" and why.provenance:agent-assistedlabel.Status:comment names the merge commit.mise run checkis green, and so are the coverage floorsmise run cover-go-checkandmise run cover-py-check, whichcheckdoesn't run.packages/agents/source/commits whatmise run generate-skills, thenmise run skill-tokens, thenapm installrewrite, in that order, andcheck-generated-skills(part oflint) passes.docs/agent-skills-migration.mdor the adoption docs, or the PR's Verification says "No consumer impact" and why.Round: 3 of 3