Stale Approvals: Why Agent Reviews Need a Sequence
Stale approvals are approvals that no longer match the thing they approved. A reviewer reads a change at 10:02 and clicks approve at 10:09. At 10:05 the author pushed again. The approval now covers code the reviewer never saw. With human authors this happens now and then. With agents that push every few minutes and respond to feedback instantly, it is the normal case unless the system prevents it. This guide explains the problem, the standard fix (optimistic concurrency with a sequence number) and how Forkit applies it to reviews of agent work.
How stale approvals happen
An approval is a statement about a state: "I looked at this and it is fine". The state can move between the look and the click. Common ways:
- New commits. The agent, or another agent, pushes while the reviewer reads.
- Feedback loops. One reviewer asks for changes; the agent complies at once; a second reviewer, still on the old view, approves.
- Failed checks. Tests were green when the reviewer opened the page and went red before they approved.
- Late information. The agent posts "I also changed the migration" as a message after the review request.
- Rebase or merge. The diff the reviewer saw is no longer the diff.
Each is harmless alone. Together, at agent speed, they mean a reviewer's click says less than everyone assumes. The danger of a stale approval is that it looks identical to a real one.
Why agents make it worse
Three things change when the author is an agent.
Speed. An agent acts on a comment within a minute or two. The window in which a reviewer's view is current is short.
Volume. More pull requests, more pushes per pull request.
Initiative. Agents fix things nobody asked about. A push that "addresses the comment" may also touch three other files.
Cognition describes its agent fixing review comments on its own pull requests automatically. That loop is valuable, and it makes the question sharper: after the automatic fix, whose approval still counts?
The fix: approve a version, not a thing
The remedy is old and comes from databases. It is called optimistic concurrency.
The idea: do not lock the item while someone looks at it. Instead, give every state a version number. When someone writes, they say which version they read. If the current version is different, the write is refused, and they look again.
"Optimistic" because it assumes conflicts are rare and checks only at the moment of writing. Nobody is blocked from pushing while a review is open. The only cost falls on an approval that would have been wrong.
Cursor's research on coordinating many agents reports moving from locks to exactly this: agents read state freely, and a write fails if the state changed since it was read. They found it simpler and more robust than locking.
Applied to code review, the rule is one sentence: an approval must name the state it approves, and is refused if that is no longer the current state.
A sequence number per thread
To implement the rule you need a number that goes up whenever anything relevant happens.
In Forkit, every agent session is a thread, and a thread is an append-only list of events: prompts, commands, files changed, messages, review requests, decisions. Each event gets the next sequence number, and the thread stores the latest one as last_seq.
Events that advance it include:
- A message from the agent or a person.
- A new review request.
- A request for changes.
- With Forkit's GitHub App installed: new commits on the pull request, and a failed check.
That last point matters. The App receives signed webhooks from GitHub, records the pull request and its check runs against the thread, and adds events written by a system actor. So a push or a red check moves the number even though no person or agent posted anything to Forkit.
The expected sequence on approval
When a reviewer opens a thread, the page knows the sequence number it is showing. Approving sends that number along. Forkit's routes call it expected_seq. The demo on Forkit's site shows it in the button itself: "Approve event 41".
On the server:
- Read the thread's current
last_seq. - If it equals the expected sequence, record the approval.
- If it is greater, refuse. The reviewer sees that something changed and looks again.
Forkit's documentation states it directly: approval carries the last_seq the reviewer saw, and any newer event refuses it.
Make the check and the write one step
There is a trap. If the server checks the number and then writes the approval as two separate steps, an event can arrive between them. The check passes, the event lands, the approval is written, and it is stale after all.
The check and the write have to be atomic. Forkit does this in one database batch, so nothing can slip between. If you build your own, use a conditional write:
UPDATE threads
SET state = 'approved', last_seq = last_seq + 1
WHERE id = ? AND last_seq = ?; -- the reviewer's expected sequence
If no row changed, the approval was stale. Report that, do not retry silently.
What the reviewer should see on refusal
A refusal is only useful if it is clear and cheap to recover from.
- Say that something changed since they looked.
- Show what: the new events, the new commits, the failed check.
- Let them approve again once they have read it.
Do not auto-approve the new state, and do not ask "approve anyway?" with one click. The point is that they look.
Approvals from several people
When approval rules require more than one person (say, the owner of *.sql and the owner of src/auth/**), approvals accumulate. Each one is still tied to a sequence.
In Forkit, each pattern that matches a changed file needs one of its people, and approvals accumulate until every pattern is met. If the work changes after the first approval, later approvals are checked against the new state like any other.
What should not invalidate an approval
Not every event should reset a review. If trivial activity invalidates approvals, people learn to dislike the mechanism.
Forkit handles one case explicitly: when another agent messages the author's thread, the usual record of that message is skipped while the thread is in review. Chatter between agents does not disturb a review in progress.
When you design your own list, sort events into two groups. Changes to the code or the checks, and new statements from the agent about what it did, belong in the "invalidates" group. Read receipts and status pings do not.
The same rule elsewhere
The principle applies beyond review.
- Permission requests. An approval of a command should cover that exact command. Forkit shows the literal command, and an answer applies to the request as asked.
- Plans. If you approve an agent's plan and the plan is then edited, the approval should not carry over.
- Task claims. Claiming a task only if it is still unclaimed is the same pattern: a conditional write against the state you read.
On GitHub
GitHub has its own controls for this at the merge gate, in branch protection settings. If you rely on pull request approvals for agent work, check how your repository treats approvals when new commits are pushed. The comparison in CODEOWNERS for agent pull requests vs approval rules covers how GitHub's rules and Forkit's fit together.
A checklist
- Every reviewable item has a version or sequence that advances on change.
- Pushes and check results advance it, not only comments.
- The approval action sends the version the reviewer saw.
- The server compares and writes in one atomic step.
- A refused approval shows what changed.
- Agents cannot approve. Only a person's action counts.
Related: how to review agent pull requests and AI code review vs human review.
Where Forkit fits
Forkit ties every approval to the sequence number the reviewer saw and refuses it if the thread moved, including for commits and failed checks reported by its GitHub App. It is free to try. More at forkit-mcp.com.