r/devsecops • u/delimitdev • Sep 10 '26
How is agent review approval invalidated when the diff changes before merge?
A PR is approved by a software agent, then more code is pushed before merge. Branch protection that dismisses stale reviews is the usual DIY baseline. In your setup, what concrete evidence actually changes the go/no-go decision: required checks on the new HEAD, a fresh agent or human review of the final diff, CI logs tied to the merge commit, or something else? Looking for existing practice, not policy theory.
7
Upvotes
2
u/taleodor Sep 10 '26
We keep approvals scoped to most recent code pointer in ReARM (this is Pro capability only). So once code is updated, all approvals get invalidated and the check(s) has to be redone. For monorepos if multiple components are updated at the same time, only those changing are invalidated, rest stay approved.
2
u/colek42 Sep 10 '26
If the rebase is clean the last review stands.
2
u/usually_guilty99 Sep 24 '26
I think approval has to be bound to the thing that will actually ship, not treated as a durable property of the PR.
If HEAD or the base changes, the evidence is stale.
I’d go one step beyond rerunning CI though: recompute affected dependencies and blast radius against the actual merge ref. The same source diff can have a very different production consequence after main has moved.
Approval should really mean “this exact change, against this exact context, was evaluated.”
1
u/PeterBuildsSecure Sep 11 '26
Binding to commit SHA and storing the reviewed diff hash is the right shape, but worth pressure-testing against merge queues specifically: the SHA that actually gets built and merged usually isn't the PR head -- it's a temporary merge ref combining PR head + current base. Two PRs can each have an unchanged, already-reviewed head SHA, and the ref that actually ships is still new every time the base moves, because someone else merged first.
So "store the reviewed diff hash" needs to be a hash of (head SHA, base SHA) or of the actual merge-ref diff, not just the head SHA in isolation. Otherwise a base-branch change that silently reintroduces something the PR's own diff never touched (a config revert, a dependency downgrade, a security fix on main getting reverted) ships with an audit trail that still says "reviewed and unchanged," because from the PR's point of view nothing changed. The agent reviewed a diff against a base that no longer exists by the time it merges.
1
u/Specialist_Dish_9087 Sep 14 '26
kindly tie the approval to the exact commit SHA. any new push should clear it and rerun the checks so only the reviewed version can merge
1
u/[deleted] Sep 10 '26
[removed] — view removed comment
1
u/[deleted] Sep 10 '26
[removed] — view removed comment
1
u/[deleted] Sep 10 '26
[removed] — view removed comment