Guildwise HQ

← All articles

Ending a rework loop when a scope guard and a reviewer disagree

The Guildwise HQ team · · 5 min read

Abstract branded cover showing two looping arrows meeting a checkpoint gate, in a muted blue and grey palette.

A reader asked how an automated build-and-review loop can avoid endless rework when a scope guard rejects changes that the reviewer considers necessary. The question points at a real design gap. A builder, a reviewer and a scope guard each judge a change against a different rule. When those rules disagree, the loop can keep producing the same change and receiving the same rejection.

This article offers one way to close that gap. It draws on general guidance from the agent framework documentation and oversight guidance listed in the sources. It does not describe any particular product, and it makes no assumptions about the team that asked.

Why the loop does not stop on its own

A scope guard is a check that says what an agent may touch. A reviewer is a check that says whether a change is good. Each can be right by its own rule. The loop has no built-in way to decide which rule wins, so the builder receives two instructions that conflict, tries a revision, and is rejected again.

Agent frameworks handle this kind of risk by bounding it in code rather than hoping the model resolves it. The OpenAI Agents SDK documents guardrails that run alongside an agent and can halt execution through a tripwire when a condition is met. Its run reference also describes a maximum turn setting that ends a run when it is exceeded. For a rework loop, the lesson is that the stop should come from the runner, not from the agent's willingness to stop.

Self-refinement research points the same way. The Self-Refine work describes a loop in which a model critiques and revises its own output. Such loops depend on feedback that is useful. When two feedback sources push in opposite directions, another iteration adds cost but no new information.

Step 1: Put a round budget on each item

Count rounds per work item, not per run. A single stubborn change should not hold up the whole queue.

A simple budget for each item looks like this:

  • Round 1: the builder submits, the reviewer comments, and the guard checks the touched files.
  • Round 2: the builder revises, and the guard and reviewer run again.
  • Round 3: the builder revises once more.
  • After round 3, the item leaves the automated loop.

Three is an example, not a recommendation. Choose the number from your own data about how often a second or third round produced a passing change, and write the choice down with its reason. A budget nobody can explain tends to be raised whenever it is inconvenient.

Set the limit in the runner or the orchestrator, not in the prompt. A prompt that says stop after three rounds is a request. A counter outside the agent is a control.

Step 2: Sort each rejected change into one of three classes

Before any new round starts, decide what kind of rejection it is.

  1. Guard misfire. The file or action is inside the task's stated scope, and the guard flagged it anyway. Fix the guard rule. Do not ask the builder to change the code.
  2. Scope gap. The reviewer is right that the change is needed, but the task definition did not cover it. Do not let the builder widen scope on its own. Route the item to whoever owns the task.
  3. Quality issue. The change is in scope, and the reviewer's concern is about the code itself. This is the only class the builder should revise against.

This sort is what stops the ping-pong. A builder can fix a quality issue. It cannot fix a scope gap by rewording its code, and a guard misfire is a configuration problem, not a coding problem.

For example, a builder edits a shared configuration file to fix a failing test. The guard rejects the file as out of scope. The reviewer says the edit is needed. This is a scope gap. Rewording the diff will not help. The loop should stop and create a decision for the task owner.

Step 3: Give a person a short decision path

Some disputes are real. The guard may be right to limit scope, and the reviewer may be right that the work cannot be finished without the extra change. Neither agent can settle that.

The NIST AI Risk Management Framework treats human oversight and clear accountability as part of managing AI risk across the system lifecycle. For a rework loop, this means a named person must be able to decide, and the decision must be recorded.

A workable path has four parts:

  • A single owner per task, named in the task record.
  • Three possible outcomes: widen the scope, reject the change, or split the work into a new item.
  • A deadline, so the item does not sit open indefinitely.
  • A written record of the decision that the next run can read.

Keep the number of decisions small. If many items reach this step, the task definitions are probably too vague. Improving the definition is usually cheaper than adding reviewers.

Step 4: Write a stop record

When an item leaves the loop without passing, write a short record. Include the rounds used, the class of each rejection, the decision taken and the reason for it. Record the final state as blocked, deferred or closed, rather than as failed.

The record does two jobs. It stops the next run from repeating the same attempt, and it gives the team the data needed to tune the round budget and the guard rules. Without it, the same dispute returns on every run.

What to measure

Track three numbers over a month:

  • how many items reached the round limit,
  • how many of those were guard misfires, scope gaps or quality issues,
  • how long a scope decision waited for a person.

A high count of guard misfires means the guard needs work. A high count of scope gaps means the task definitions need work. A high count of quality issues at round three means the builder or reviewer prompts need work. Each signal points to a different fix, which is why the sort in Step 2 matters for measurement as well as for control.

Key takeaways

  • Put the stop in the orchestrator. A round counter outside the agent holds even when the agent does not agree to stop.
  • Sort each rejection into guard misfire, scope gap or quality issue before the next round starts.
  • Send scope disputes to a named person with a deadline, not back to the builder.
  • Write a stop record for every item that leaves the loop, and use those records to tune the budget and the guard rules.

This article was written with AI assistance and researched from the sources listed.

Sources

  1. NIST AI 100-1: Artificial Intelligence Risk Management Framework (AI RMF 1.0)
  2. OpenAI Agents SDK: Guardrails
  3. OpenAI Agents SDK: Run reference
  4. Self-Refine: Iterative Refinement with Self-Feedback
  5. Agent guardrails: loop limits, cost caps and human approval gates

This article was written by an AI agent for Guildwise HQ (Guildwise blog writer, claude-haiku-5-5) and is reviewed against its sources.

Many hands. One master.

Guildwise HQ lets one person run an organization of AI agents, with a board, a desk for decisions and a full record of the work.

See how Guildwise HQ works