After a prompt fix, re-run past cases as a deterministic job: pinned inputs, versioned decision records, a diff report, keyed effects and compensation.
The fix is deployed. What about the last three weeks?
A support agent at Belgavi's Book Store has been handling return requests for three weeks when Geetha finds a prompt bug: damaged-copy cases are sometimes treated as out-of-policy returns and declined. The fix is a two-line change to the instructions, it passes the evaluation set, and it goes live on Monday. New cases are now handled correctly.
The harder question is what to do about the 200 cases the old version already decided. Some of those decisions were wrong and customers are waiting. Others were right, and re-running them could turn a right answer into a wrong one. Some of the old decisions already had effects in the world: a refund was issued, a replacement was shipped, a decline email was sent. A naive "just run the new version over everything" repeats those effects or contradicts them.
Older systems have a name for this kind of job: reprocessing, or replay. Event-sourced systems replay events through new projection code all the time. The established rules for doing that safely carry over to agents almost unchanged, with one addition: the decision step is no longer deterministic, so the job has to measure what changed before it is allowed to do anything.
What stays deterministic
The agent makes one judgement per case. Everything around that judgement should be ordinary, deterministic code:
- Input selection. Which cases are in scope, chosen by a query recorded with the job.
- Input pinning. Each case is re-run on the inputs the old version saw, read from a stored snapshot, not from today's live records.
- Decision records. Every run writes a new record keyed by case and agent version. Old records are never overwritten.
- The diff. Comparing the version-1 and version-2 decisions, and classifying each change, is plain code.
- Effects. Refunds, shipments and emails are executed by a separate step with idempotency keys and explicit compensation, never by the agent loop during reprocessing.
If those parts are deterministic, a reprocessing run can be repeated, audited and stopped halfway without harm.
Record decisions as versioned facts
The prerequisite is that the original run stored enough to replay. A decision record for this pattern needs at least the case id, the agent version (prompt, model and tool versions together), a reference to the input snapshot, the decision, and the effect it triggered with its idempotency key.
{"case": "CASE-4030", "agent_version": "returns-agent@2026-11-07.3",
"inputs": "snapshot://cases/CASE-4030/2026-11-09T10:14:02Z", "decision": "deny",
"effect": {"key": "CASE-4030:decline-email", "status": "done"}}If your current system only keeps the final status on the case row, start writing these records now. You cannot reprocess safely without knowing what the old version saw and what it already did.
Step one: a report, not a replay
The first run of the new version over past cases writes only decision records under the new version and produces a diff report. It executes nothing. The companion lab models this with 200 synthetic cases and three rate inputs: version 1 errs on about 12% of cases, the fix corrects about 80% of those, and it regresses about 3% of the cases version 1 got right. With the default seed, version 1 is wrong on 25 cases; version 2 fixes 17 of them and regresses 8 of the 175 it previously got right.
With pinned inputs and report-only policy, 25 decisions change: 17 fixes and 8 regressions. Accuracy against the synthetic ground truth moves from 87.5% to 92%. All 25 go to a review queue; no effect runs.
Eight regressions out of 25 changes is the number that justifies the whole design. Accuracy went up overall, yet almost a third of the changed decisions are new mistakes. Applying all 25 automatically would fix 17 customers and wrong 8 who were previously handled correctly. The diff report is where a person, or a stricter automated check, decides which changes to act on.
Classifying a change as a fix or a regression needs ground truth, which you usually do not have for every case. In practice, review a sample of changed decisions per category, estimate the regression rate, and only then decide whether to apply changes in bulk, per category, or one by one.
Why inputs must be pinned
Re-running on live records is tempting because it is easy. It also changes the question. Suppose 10% of the 200 cases have since been resolved by hand, so the live record says "already resolved". A version that reads live data declines those cases, not because its judgement changed, but because its inputs did.
In the lab, switching off pinning raises the changed count from 25 to 40. The extra 15 are input drift, and they drag measured accuracy down to 84%, below version 1. One drifted case was also a genuine fix, so the 17 fixes become 16. A reviewer looking at that report would conclude the fix made things worse. It did not; the comparison was broken.
Pinned inputs answer "what would the new version have decided then?" That is the question you need to evaluate the fix and to decide on remediation. If you also want "what should we do now?", run it as a separate, clearly labelled pass over current records.
Effects: keys, compensation and never repeating
When the team decides to act on changed decisions, effects need two rules.
First, every effect has a key derived from the case and the effect type, such as CASE-4030:refund. The effect executor refuses a key it has already completed. In the lab's naive-replay policy, which runs every version-2 decision as if it were new, all 200 effects execute: 175 of them repeat an effect version 1 already performed, and 25 conflict with an earlier effect that still stands. Eight of the newly executed effects are wrong. Keyed effects execute only for the 25 changed cases, repeat none and skip the other 175.
Second, a changed decision usually needs the old effect undone. Declining a case that was refunded means the refund has to be reversed or written off; approving a case that was declined means sending a correction. The lab queues a compensation for each executed change. Compensation is a business action, often needing approval, not a database rollback.
The worst combination in the lab is keyed effects with unpinned inputs: 40 effects execute and 24 of them are wrong, because input drift turned into real actions. Pin inputs before you allow any effect.
Migration steps for an existing agent
- Start recording versioned decision records and input snapshots for every new case, including the agent version string.
- Move effects out of the agent loop into an executor with idempotency keys. The agent proposes; the executor acts.
- Build the reprocessing job in report-only mode first: select cases, pin inputs, run the new version, write records, produce the diff.
- Add a review step for changed decisions, with sampling to estimate regressions per category.
- Only then add an apply step that executes approved changes through the keyed executor and queues compensations.
When this is too much machinery
If the old decisions had no external effects, for example a classifier that only tagged cases for reporting, re-run and overwrite the tags; keep the old ones for comparison. If only a handful of cases are affected, a person can review them directly. And if the fix is a deterministic rule change, such as a threshold or a lookup table, you do not need an agent to reprocess at all: compute the new outcome with the rule and diff it.
Verification checklist
- Re-run the reprocessing job twice on the same scope; the decision records and diff must match exactly when the model is run deterministically, and the diff must be explained when it is not.
- Confirm no effect executes in report-only mode, by counting executor calls.
- Feed the executor a duplicate key and confirm it refuses.
- Sample changed decisions in each category and record the estimated regression rate before applying.
- Check that every applied change has a compensation record for the effect it replaces.
Interactive experiment
Reprocessing past agent cases: changed decisions and repeated effects. Synthetic browser-local fixtures, adjustable inputs, decision traces and JSON export.