AI coding

From Override to Rule Change: A Pull Request for the Prompt

Antonio Evans10 min read

A split-screen scene: on the left, a log viewer with three highlighted rows showing an override (input text, original instruction, replacement instruction); an arrow leads to the right.
Key points

Key points

  1. 1A prompt pull request should carry three artifacts together: the override rows copied from the log, the diff of the prompt file, and a test that fails on the old prompt and passes on the new one.
  2. 2A prompt edit that fixes one complaint can silently break other cases, so the suite must rerun the cases you already care about, not only the one that prompted the change.
  3. 3The test has to be shown red before the fix and green after it; if you cannot make it fail, you have not reproduced a problem and the change is not ready to merge.
  4. 4Human overrides are only useful feedback when they are routed back into an evaluation set, otherwise the same correction gets made by hand again next week.

Start from a logged override, not a hunch

Human override is the ability for a person to review, pause or reverse an automated recommendation before it becomes an operational action, and the same source warns that treating a notification email as an override is a misapplication because nothing actually blocks execution until a reviewer signs off NHI Management Group. Your log is where those blocked or corrected actions accumulate.

Two kinds of involvement get confused here. In human-in-the-loop systems the AI makes the decision and a human corrects it; in "AI in the loop" the human decides and the AI assists, and which one you are building changes what you measure Appen. An override row is the first kind: an input went in, a person rejected the output, and that pairing is the raw material for a change.

Most teams stop at the log. They tally overrides, notice a pattern, then someone edits the system prompt in a console on a Friday afternoon. That edit has no diff, no test and no recorded reason. The next person who touches the prompt has no idea why the wording exists, and when it is removed during a cleanup the original complaint returns. The fix is to make the override produce a commit instead of a console edit.

Collect the override rows before touching the prompt

Pull the cases first. Three to five rows is usually enough, and they must be contiguous: the same input shape recurring, not five unrelated complaints.

FieldWhat to copyWhy the reviewer needs it
InputThe exact user message or tool output, verbatimReviewers must be able to rerun it
Original instructionThe prompt text in force at the time, or its version hashOtherwise you cannot show the change is a change
Model outputThe answer that was producedThe failure has to be visible, not described
Human replacementWhat the reviewer wrote insteadThis is the expected behavior you are encoding
ContextRetrieved passages, tool results, conversation turnsMany failures are context failures, not wording failures
Trace IDThe identifier linking back to the full log recordLets a reviewer trace the whole conversation

The context column is the one people skip and the one that wastes the most effort. When a prompt lacks the information it needs, no rewording fixes it. Build the row set so you can tell an instruction problem from a retrieval problem before spending a week on phrasing.

Overrides cluster, and a cluster is a test category. If you have twelve overrides where the model answered a direct price question with a policy paragraph, you have a category called "direct answer to a direct question" and you write three test cases for it, not twelve.

Diff the prompt like a code change, because it is one

Prompt versioning tracks every change to a prompt over time so teams know which version runs in production, who made the last change, and can roll back if something breaks; prompts also change more often than code, and non-engineers often need to contribute Agenta. The practical consequence is that the prompt must live in a file git can diff, not in a dashboard text box that only holds current state.

A useful diff is small. One or two sentences changed, with the commit message naming the override cluster:

- Answer the customer's question using the policy context.
+ Answer the customer's question directly in the first sentence.
+ If the answer depends on a policy condition, state the condition
+ in the second sentence only.

Two properties make this reviewable. The change is scoped to the cluster rather than rewriting the whole prompt. And it names a behavior, "first sentence direct answer," which a test can assert. "Make the tone warmer" is not testable and should not ride in the same pull request.

Prompt management goes further than versioning, treating prompts as infrastructure with runtime updates, monitoring, access controls and dependency tracking LaunchDarkly. Dependency tracking is what bites in multi-step systems: if prompt one emits a JSON schema that prompt two consumes, changing that schema breaks prompt two, and the dependency has to be visible in the diff discussion.

There is a governance angle. NIST's AI Risk Management Framework addresses accountability, oversight and human responsibility for AI systems, and NIST CSF 2.0 frames governance and oversight as core security management responsibilities NHI Management Group. A prompt change with a linked override row, a reviewer and a test is the evidence trail those functions ask for. A console edit is not.

Write the test so it goes red first

This is the decision rule the whole process turns on: run the new test against the current prompt before changing anything. It must fail. If it passes against the unfixed prompt, the override was not reproducible, and you are about to ship a change with no evidence behind it.

Prompt testing runs a prompt and its model configuration against representative inputs, attaches an explicit expectation to each case, and applies the same scoring method across every run, so each result ties to a specific prompt version Braintrust. The same guide separates assertion types that matter: task correctness, format compliance, behavioral boundaries such as when to refuse or escalate, tool and retrieval behavior, and operational limits like latency and token cost.

The recorded configuration must travel with the test. Model, temperature, tools, response format and retrieval step all affect behavior, so a score difference between runs can come from a model swap as easily as from an edited instruction Braintrust. Pin them or your red-to-green proof means nothing.

A worked example on a support prompt that answers product questions:

StepActionExpected result
1Add the override input and the human replacement as the expectationCase exists in the suite
2Run the suite on the current branch1 failing case, the new one
3Read the failure diffMatches the logged model output, not a new failure
4Apply the prompt diffOne to three lines changed
5Rerun same suite, same pinned config0 failing cases
6Run the full suiteNo previously passing case turns red

Step 3 is where people get sloppy. If the failure message does not resemble the logged output, you have written a test that fails for the wrong reason, most often because the test's context does not match production retrieval. Step 6 is the guard against fixing one thing and breaking another: a prompt tweak that fixes one complaint can quietly break other answers Langfuse.

Use deterministic checks wherever you can. For a structured field, a routing decision or a required phrase, an exact check is cheap and needs no interpretation, the same property that makes unit tests fast and unambiguous Braintrust. For open-ended phrasing you need a judge.

Keep the judge honest, because it is a test too

One analysis puts LLM judge agreement with human reviewers around 85%, higher than two humans agree with each other on the same task Confident AI. That figure comes from the cited research and is not a guarantee about your rubric.

The known distortions are specific and curable. Position bias makes judges favor outputs presented first or last, and swapping presentation order shifts accuracy by more than ten percent in code evaluation, while self-preference bias pushes judges toward outputs more familiar to their own model family and length bias favors longer, more formal responses tianpan.co.

Rules for a judge that behaves like a test rather than a coin:

  • Use a different model family for the judge than for the system under test.
  • Grade against a reference answer (the human replacement) rather than open-ended pairwise comparison.
  • Keep the rubric text in the repository beside the prompt, so a rubric change is also a diff.
  • Pin the judge's temperature and record the judge model in the same config as the prompt config.
  • Spot-check twenty graded results by hand when first introducing the judge, and record how many you disagreed with.

If your judge disagrees with your own reading on a meaningful share of the spot-check, the judge needs fixing, not the prompt. Evidently's guide covers judge construction and the offline versus online split, useful when the same rubric should run in CI and on production traces Evidently AI.

Prompt testing asks whether a configuration still behaves correctly on cases you already care about; prompt evaluation asks how good the output is against criteria; A/B testing asks which variant wins with real users; unit testing asks whether deterministic code returns the expected value Braintrust. The pull request needs the first and the last. The other two do not belong in a merge gate.

Grow the suite from the log, and size it by risk

A test encoding a single override proves one thing. The value comes from the suite growing as your log grows: production failures added back to the test set keep regression coverage aligned with the failures users actually encounter Braintrust. Every time an override cluster appears twice, a new case goes in.

Size by risk. If you have a hundred prompts in production you cannot test them all thoroughly, and versioning pain grows with the number of prompts and the dependencies between them Agenta. Pick the prompts whose failures cost most, usually where a wrong answer reaches a customer, moves money or changes a permission, and give those a real suite. Give the rest a smoke test.

Avoid the tempting shortcut of aggregate metrics. A suite reporting "92 percent pass rate" hides which case regressed. CI needs per-case pass or fail so the red build names the case that broke.

Human review belongs inside the loop for a second reason: when you spot-check graded results you validate not only the judge but the expected behavior you encoded. Reviewers sometimes find the human replacement in the log was itself wrong, which is a more valuable finding than a failed assertion.

If you run several prompts in a chain, check whether disagreement between steps is even visible. Multi-agent designs diverge routinely, with estimates in the twenty to forty percent range depending on task type, and silent failures where an agent returns a confident, well-formatted wrong answer are the most operationally dangerous tianpan.co. A fix for step one will not surface a disagreement in step three, so log the intermediate outputs your test asserts on.

The reviewer checklist

CheckPass conditionFail signal
Override rows presentThree to five rows with input, old instruction, model output, human replacement, trace IDBody says "users complained about tone"
Prompt diff scopedOne to three changed lines tied to the clusterWhole prompt rewritten
Test presentNamed case encoding the override inputTest asserts on a paraphrase
Red before greenCI log shows the case failing on the pre-change commitOnly a passing run is shown
Failure matches the logFailing output resembles the logged model outputFailure is a missing fixture or wrong model
Full suite passesNo previously passing case regressedOnly the new case was run
Config pinnedModel, temperature, tools and judge recordedTest depends on the runner's environment
Downstream namedIf structured output changed, the consuming prompt is identifiedNobody checked the second prompt
Rollback statedOne line on how to revert without a redeployNone

The red-before-green requirement catches the most bad pull requests and attracts the most argument. The argument is always "the case is obviously broken, we all know it fails." That is not evidence. A pasted CI log showing the failing case on the base commit settles the question permanently, because the next reader sees which behavior the commit protects.

Treat prompts with the same care normally applied to application code, since you would not push code to production without version control, testing and proper deployment processes LaunchDarkly. The checklist is what that care looks like when the artifact is a sentence of English.

Wiring the artifacts together

Three conventions make the pattern cheap to repeat.

Keep the prompt, the test config and the rubric in one repository so a single pull request touches all three, the same idea as referencing the prompt by file in a declarative test config so it lives in version control alongside the code promptfoo. Put the log trace link in the commit body, not just the pull request, so the evidence survives after the pull request closes. And when a model judges the change, record the judge model beside the prompt: judge versions drift, and a judge swap that turns a suite green without a prompt change is a regression in disguise. If you serve the system and the judge through one gateway, that model choice becomes a configuration value rather than a hardcoded SDK call, which is part of what Quanta Inference provides across text, image, video, audio and embedding models.

The final discipline is ownership. Someone has to own each prompt suite the way someone owns a service. Without an owner the suite rots: cases get skipped, the judge drifts, the red-before-green check becomes a ritual nobody reads.

FAQ

FAQ

Does every prompt change need a test?

No. Cosmetic edits such as comment lines, whitespace and typo fixes the model reads identically need no new case. The rule concerns behavior: if the change could alter what the model says or when it refuses, it needs a case that fails without the change. If you cannot articulate a behavior difference, you probably do not need the edit.

What if the override cannot be reproduced?

Do not merge. A non-reproducible override usually means production context differed from your replay: different retrieval results, a different model or parameters, or a conversation turn you did not capture. Rebuild the case from the trace with the exact context. If it still will not reproduce, the problem is likely elsewhere in the pipeline and a prompt edit is the wrong fix.

How many override rows should go in the pull request?

Three to five, enough to show a pattern and few enough that a reviewer reads them. One row is an anecdote and twelve is a spreadsheet nobody reviews. If you have twelve distinct inputs, pick the three hardest for the prompt, note the count of the rest in the pull request body, and add the remainder to the suite in a follow-up.

Can I use the human replacement as the expected output?

As a reference answer for a graded assertion, yes. As an exact string match, usually no, because a legitimate answer can be phrased many ways and exact matching fails correct responses. For fields with one acceptable value such as a routing decision or a currency amount, use an exact check. For prose, grade against the reference with a pinned judge and a fixed rubric.

How do I keep the suite fast enough to run on every commit?

Split it. A small gate suite of deterministic checks runs on every commit in seconds, and the model-graded suite runs on pull requests that touch a prompt file or its config. Keep the last failing case in the fast set. Deterministic assertions on format, routing and required values cost nothing and catch a surprising share of real regressions before any model call is made.

Sources

Sources

  1. What Is Human Override? Definition & Examples
  2. Human in the loop: HITL design for ML and AI agents
  3. Prompt Versioning: The Complete Guide
  4. Prompt Versioning & Management Guide for Building AI ...
  5. What is prompt testing? Test cases, datasets, and regression ...
  6. LLM regression testing: fail CI before regressions ship
  7. LLM-as-a-Judge Simply Explained: The Complete Guide to ...
  8. When Your Agents Disagree: Consensus and Arbitration in ...
  9. LLM-as-a-judge: a complete guide to using LLMs for ...
  10. When Your Agents Disagree: Conflict Resolution Patterns for Parallel AI ...
  11. Testing LLM prompts like code: regression evals in CI/CD ...
About the author

About the author

Antonio Evans
Antonio Evans

Antonio Evans is the founder of Quanta Intelligence and a fractional CTO who builds HIPAA-ready AI systems for health and life-science companies. Before that he was technical co-founder of FriendsEAT for twenty years, CEO of Socialdraft, and a data engineer at IBM. Antonio lives with his dog Santino in Lisbon, Portugal.

All articles