← Blog

When to Reject Agent Code: Reject or Iterate?

9 min read

Key takeaways

  • Reject agent code when the diff shows scope drift, weakened or empty tests, or refactor noise bundled into a feature change.
  • Iterate when the framing was right and the failure is mechanical, fixable in one actionable sentence.
  • At roughly $8 per merge request, three feedback rounds on a doomed branch cost more than one clean rerun with a sharper prompt.
  • Map rejection reasons to prompt fixes: scope creep means open-ended criteria, wrong-file edits mean missing repo context, hallucinated APIs mean switch models.
  • Log every reject with a one-tag reason so rejection patterns reveal whether task framing or the model is the real problem.

<!-- Meta description: Reject agent code when scope drift, gamed tests, or refactor noise signal a framing failure; iterate when the core approach is right. A reject-versus-iterate framework. -->

When to Reject Agent Code: A Reject-Versus-Iterate Framework for Agent Fleets

The moment to reject agent code is when the diff shows scope drift, missing or tautological tests, or unverifiable claims in the run log; iterate when the core approach is right and the failures are mechanical. At roughly $8 per merge request, a bad feedback loop on a doomed run costs more than a clean rerun, so the decision should hinge on observable signals, not gut feel.

When should you reject agent code outright instead of iterating?

Reject outright when the diff shows the agent misunderstood the task at the framing level: wrong scope, wrong files, invented acceptance criteria, or changes that contradict the original request. Iterate when the framing was right and the execution is what failed: style drift, a flaky retry loop, a missing edge case you can name in one sentence.

The economics decide the marginal cases. A team running up to thirty Claude Code and Codex sessions pays roughly $8 per merge request at API prices, and "the three of us provide the tasks and the direction" (Dev.to, Ticksly). A feedback loop that takes three review rounds costs more than a clean rerun with a sharper prompt. We track that math per repo in our notes on coding agent costs.

Rule of thumb: if you cannot state the fix as one actionable sentence, reject and rerun.

What signals in a diff mean an agent run should be rejected outright?

Most agent runs are salvageable. A few are not, and the diff tells you which before you spend an hour writing feedback. Three signals predict an unsalvageable run reliably enough that rejecting and rerunning beats iterating.

Scope drift: files touched that the task never mentioned

Check the file list first, before reading a single hunk. If the agent touched modules outside the task's scope, the run has already failed the framing. An agent that wandered into auth, config, or a neighboring repo is not one comment away from a clean MR; it is one rerun with a tighter prompt away. Scope drift compounds: each extra file multiplies the review surface and the chance of overwriting a parallel agent's work in a multi-repo fleet.

Tests that assert nothing or were weakened to pass

Open the test diff before the source diff. Deleted assertions, skipped cases, expect(true) style checks, or a snapshot regenerated to absorb the bug all mean the agent optimized for green, not correct. A weakened test suite poisons every future run that depends on it, so iterate-looping here just spreads the damage.

Refactor noise bundled into a feature change

A small feature MR wrapped in renames, reformatting, and moved files hides the actual change. You cannot review it, and feedback on the feature gets lost in the noise. Reject, rerun with "touch only what the task requires," and review the clean diff.

SignalWhat it predictsRight call
Files outside task scopeFraming failure, drift will continueReject and rerun
Weakened or empty testsOptimizing for green, not correctnessReject; rerun with test policy in prompt
Refactor noise in a feature MRUnreviewable change, wasted feedbackReject; rerun with a scope constraint

Each of these costs you a rerun, not a review cycle. At roughly $8 per merge request at API prices, a rerun is the cheap branch; three rounds of feedback on a drifted diff is the expensive one. Aerunit tracks scope and state per run so drifted agents surface before you open the diff, as covered in what a coding agent run really costs.

When is it cheaper to reject and rerun than to give feedback?

The arithmetic: rerun cost vs review-round cost

A feedback round costs your review time plus the agent's next run at full token price. A rerun costs only the run, but only if the new prompt fixes what went wrong. At Ticksly's roughly $8 per merge request at API prices, three iterate loops on a doomed branch cost more than one clean rerun with a tighter prompt.

Signals that a rerun will reproduce the same failure

The decision hinges on one question: did the agent fail because of the prompt, or despite it? If the original task had vague acceptance criteria, a rerun with the same framing will wander the same way. Leave one coding agent alone for an hour and you get a chaotic intern, fast, eager, weirdly confident, and every so often completely wrong (Dev.to, Second Shift). Leaving four alone together means they overwrite each other's work and duplicate effort, because none of them holds the full picture of the branch state. The failure mode is not incompetence at any single step; it is confident drift compounding across steps that no one is watching. If the diff shows that pattern, feedback is a subsidy to the failure.

But if the prompt was sharp and the agent still missed, a feedback round is cheap: one correction, one retry, done. Reject when the framing was the problem and you cannot yet name the missing criterion; iterate when you can. Aerunit's stories for coding agents exist to make that first branch rarer, by pinning acceptance criteria before the run starts.

How does task framing quality predict whether agent code is salvageable?

You can usually tell from the prompt whether a bad diff is fixable. A run with clear acceptance criteria that drifted on one requirement is salvageable with feedback. A run from a vague prompt produced confident, wrong code, and no amount of review comments fixes a missing spec.

Missing acceptance criteria produce confident, wrong diffs

When the task says "add caching" with no hit-rate target, no invalidation rule, and no scope boundary, the agent fills the gaps with guesses. The diff looks plausible because every guess was made confidently. Feedback like "use Redis instead" just swaps one guess for another. If the original prompt lacked acceptance criteria, reject the merge request and rewrite the task.

Splitting the thinking from the doing before the run starts

Plan and execute in separate steps: write the acceptance criteria, the repo scope, and the token budget first, then hand the agent a task it cannot misread. Framing is cheap; a rerun at roughly $8 per merge request is not. Reviewing agent pull requests gets easier when the prompt already answers the reviewer's questions.

Which rejection reasons should change how you write the next prompt?

Some rejections are the agent's fault. Most are the task story's fault, and repeating the same framing guarantees the same rejection.

Mapping rejection signals to prompt fixes

Scope creep in the diff usually means your acceptance criteria were open-ended. Rewrite them as a checklist the agent can verify against the diff. Wrong-file edits point to missing repo context: name the target directories and the files that are off-limits. Hallucinated APIs mean the model itself is out of its depth. Switch models or split the task before you retry.

What belongs in the retry versus what belongs in the task

A retry prompt should carry only new information: the rejection reason, the corrected constraint, the branch state. Everything structural belongs in the task itself. This is the discipline behind running parallel coding agents without the fleet drifting: keep retries cheap, keep task stories getting sharper.

How do you reject agent code without killing useful iterations?

Reject the diff, keep the context

A rejection is not a wipe. The agent's exploration of the repo, the files it read, and the approach it tried are all state worth carrying into the next run. Reject the merge request, but record which acceptance criteria it hit and which it missed. On the next prompt, point the agent at that record so it starts from what worked instead of from scratch.

Feedback that names the signal, not the symptom

"Wrong approach" teaches the agent nothing. Name the observable signal: "the retry loop swallows the 401 case," or "you touched the billing module when the task scoped you to auth." The first tells the agent what to fix; the second tells it where its task interpretation diverged from yours. Symptom feedback produces a patch on a patch. Signal feedback produces a rerun that targets the actual failure, which is how you keep an iterate loop from burning more tokens than a clean rerun would.

What belongs in a team-wide rejection policy for agent PRs?

A written policy stops two reviewers from reaching opposite verdicts on the same diff. With three people running up to thirty Claude Code and Codex sessions, at roughly $8 per merge request at API prices (Ticksly's writeup), inconsistent reject decisions are a direct token-budget leak.

A shared checklist so two reviewers reach the same verdict

Put the reject criteria in your repo, next to your acceptance criteria: wrong problem solved, tests gamed or deleted, scope creep beyond the task, and a diff that touches files the task never mentioned. Each item is observable in the diff and the run log, so the verdict does not depend on who opened the PR.

Tracking rejection reasons as a fleet-level metric

Log every reject with a one-tag reason. If half your rejects are "misread the task," the fix is task framing, not more review cycles. If they cluster on one repo, that repo needs better context files. Rejection reasons are the cheapest telemetry your agent fleet produces.

How does Aerunit fit a reject-versus-iterate workflow?

Aerunit is built for the same workflow this article describes: running a fleet of parallel agents across repos, where the reject-versus-iterate call happens dozens of times a day. It gives each agent a tracked run with state and retry history, so when you reject an MR, the rejection reason travels with the task. That makes the next prompt better and makes reruns cheap to compare against the run you killed.

It does not make the reject-or-iterate decision for you. The signals in the diff and the task framing are still yours to judge; Aerunit keeps the runs, the retries, and the token spend visible so the judgment is fast. If you already review in Linear and pay per merge at Cursor Cloud Agent prices, it sits on top as the orchestration layer that tracks which rejections changed your prompts.

FAQ

Should I reject an agent PR that works but touches twice as many files as the task needed?

Yes. Doubled file touch count is scope drift, and drift is a framing failure, not an execution slip. Even a working diff means the review surface has grown and the agent may overwrite a parallel agent's work. Reject, rerun with the prompt scoped to named directories, and review the clean diff.

How many feedback rounds before I stop iterating and just rerun the agent?

One. If the first feedback round does not fix the run, the framing was probably the problem, and a second round costs your review time plus a full-price run. At roughly $8 per merge request at API prices, three iterate loops on a doomed branch cost more than one clean rerun with a sharper prompt. Reject after round one.

Can I trust an agent's claim that tests pass if I can't run them locally?

No. Open the test diff before the source diff and check for deleted assertions, skipped cases, or snapshots regenerated to absorb the bug. An unverifiable pass claim in the run log is a reject signal on its own. If tests were weakened to go green, the agent optimized for correctness theater, and iterating just spreads the damage.

Do rejection rates say something about which agent model I'm using?

Yes, partly. Rejection reasons cluster by cause: scope creep and misread tasks point to your task framing, while hallucinated APIs point at the model itself. Log every reject with a one-tag reason. If hallucinations dominate, switch models or split the task before retrying; if misreads dominate, rewrite the acceptance criteria instead of blaming the model.

Aerunit

Keep the agents busy. You do the thinking.

Sign-up is open — create an account and start with pay-as-you-go credits. No subscriptions, and teams share one credit pool at no extra cost.

Create account