Skip to content

Gather and stamp the commit review from agentrepo commit #852

Description

@tbhb-agent

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

  1. 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.
  2. 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."
  3. 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.
  4. 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.
  5. AC5: Given --amend during a base merge, when the review runs, then it refuses with the HELD message.
  6. 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.
  7. 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.
  8. 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."
  9. 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.
  10. 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.bats and tests/skills/commit/scripts/commit-workflow.bats ported.
  • 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-by trailer and the pull request has the provenance:agent-assisted label. 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 final Status: 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.

Activity

  1. tbhb-agent commented on Oct 27, 2026

    @tbhb-agent
    ContributorAuthor

    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:139 and packages/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.

    • D1 The author verified each AC on the merged head, and the Verification section of the pull request cites each AC ID with its evidence: the command and its result, or a link.
    • D2 An independent reviewer approved the exact merged head, and the author resolved each finding or filed it as a follow-up.
    • D3 The required checks pass on that head, and any loosened gate has the owner's approval of that exact head.
    • D4 The leak scans come back clean: gitleaks, devtools' check-leaks.sh with the repository's private-strings list, and the leak review of each post.
    • D5 The author signed each commit, the squash included.
    • D6 The docs match the change (README, docs/, CHANGELOG or help text), or the Verification section says "No doc impact" and why.
    • D7 The commits and the squash have Assisted-by trailers, and the pull request has the provenance:agent-assisted label.
    • D8 The pull request stays within the size limits, or the owner approved its exact head over the hard limit.
    • D9 The author files follow-ups and deferred findings as issues with at least a Problem and numbered AC and lists them under the Related section of the pull request. Any work left in the code links its issue.
    • D10 The merge closes the issue through a closing reference and the board shows Done. The final Status: comment names the merge commit.
    • devtools-1 mise run check is green, and so are the coverage floors mise run cover-go-check and mise run cover-py-check, which check doesn't run.
    • devtools-2 A change to skill sources under packages/agents/source/ commits what mise run generate-skills, then mise run skill-tokens, then apm install rewrite, in that order, and check-generated-skills (part of lint) passes.
    • devtools-3 A consumer-visible change (the vendored payload, a skill, a reusable workflow, a task or a pin) has its consumer steps in docs/agent-skills-migration.md or the adoption docs, or the PR's Verification says "No consumer impact" and why.

    Round: 3 of 3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    refinement:readyPassed the Definition of Ready; may be picked up

    Fields

    Priority

    None yet

    Work type

    None yet

    Projects

    • Status
      Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions