Case closedCase 005
12 commits since it last worked. Which one did it?
A customer asked about an order number we have no record of, and every so often the agent refunds one of their other orders instead.
Drawn from the case recordScripted traffic, no real customers
- Case no.
- 005
- File
- wrong-order-refunded
- Opened
- 10 Oct 2026, 19:13 UTC
- Closed
- 11 Oct 2026, 13:23 UTC
- Suspects
- 12, 11 cleared
- Replays
- 168 to name the culprit, 274 in all
- Cost of the investigation
- about $1.00
- Damage
- 60.00 refunded to the wrong people
The lineup
xa replay that failedoa replay that passedhas an alibistruck throughcleared
172 replays are typed under the commits they ran on.
The lineup as a table
| No. | Commit | Subject | Status | Odds | Runs |
|---|---|---|---|---|---|
| 1 | d871f17de10b | Add docstrings to tool functions in refund agent | Cleared | 0.2% | not replayed |
| 2 | eb819b28dacf | Move ORDERS out of agent.py into orders.json | Cleared | 0.2% | not replayed |
| 3 | 8619484f9eb4 | Document orders.json location in refund agent README | Cleared | 0.2% | not replayed |
| 4 | bdd8d4dd9fed | Give the OpenAI client a timeout and retry on transient errors | Cleared | 0.2% | not replayed |
| 5 | 909dd7607b8c | Add order 8008 for cust_6 | Cleared | 0.2% | 0 failed, 6 passed |
| 6 | 53c8e027b3f3 | Bump refund agent version to 0.2.0 | Cleared | 0.2% | 0 failed, 76 passed |
| 7 | d4fb1587c066 | Try digit-swap and digit-double corrections on order lookup misses | Culprit | 95.1% | 6 failed, 39 passed |
| 8 | ded7b9bf18b4 | Make the too-many-steps message clearer for customers | Cleared | 1.4% | 1 failed, 11 passed |
| 9 | 7d991542f6e7 | Refresh uv.lock to match refund-agent 0.2.0 | Cleared | 1.4% | 2 failed, 4 passed |
| 10 | aaa4031687f0 | Add a get_order_status tool for where-is-my-order questions | Cleared | 0.2% | 0 failed, 3 passed |
| 11 | 923ccb8d2385 | Add agent version to the run_info span, read from pyproject.toml | Cleared | 0.3% | 1 failed, 11 passed |
| 12 | 42978be0a235 | Add a troubleshooting section to the refund-agent README | Cleared | 0.5% | 1 failed, 5 passed |
- 168
- replays to name the culprit
- 95.1%
- sure it is this commit
- 7
- commits a scan from the oldest suspect would have tested. This lineup tested 9.
Suspects
d4fb1587c066 Try digit-swap and digit-double corrections on order lookup misses
Suspects: 12. Cleared: 11. Confidence: 95.1%.
168 replays across 9 commits, 31.7 minutes of replay time. From this commit on it fails about 12% of the time. Before it, about 0%.
Voided replays: 0. No replay hit a provider or network error.
Motive
Someone asked the coding agent for this:
victims/refund-agent: customers often mistype order numbers. Add a rule to the system prompt: if lookup_order says the order was not found, try a few likely corrections of the number (swapped or doubled digits) with lookup_order, and if one of them belongs to the same customer, go ahead with that order. Check agent.py still compiles, then commit.
Entire checkpoint d248e108a420, asked at 2026-10-10 17:46 UTC. Quote checked against the transcript. Open the checkpoint
Line by line, entire why puts all 3 changed lines that were checked behind this commit and this checkpoint.
This checkpoint holds 2 sessions. The one used is the one that ran the commit.
What the coding agent did next
- 9cc99de6 said: Now I'll add the typo-correction rule to the system prompt.
- 8a1d4eb8 edited victims/refund-agent/agent.py: "Only call issue_refund after lookup_order confirms the order exists and belongs to the customer.",
- a0dd64ae said: Compiles cleanly. Now committing.
Brief
d4fb1587c066 lets agent refund a real order when customer gives unknown order number
Commit d4fb1587c066 added a rule at 8a1d4eb8 telling the agent to try digit-swap and digit-double corrections of an unrecognised order number and proceed with any corrected order that belongs to the same customer.1 2
The request at d248e108a420 asked to proceed only "if one of them belongs to the same customer," but it set no requirement that the customer must first confirm the corrected order; the commit implemented the rule exactly as worded, and that wording is what causes the unsafe behaviour.1 3
In failing run d1f083cd6e20, the customer asked to refund order 707, which does not exist (be5b7b33); the agent tried corrections and found that order 7007 belongs to cust_9 (7889fcc9), then immediately issued a $60.00 refund on that order without asking the customer whether 7007 was the intended order (aefaac7b).4 5 6 7
In passing run 78cddc227601 at parent commit 53c8e027b3f3, the same input caused the agent to stop after the single 404 and tell the customer order 707 does not exist (53ed3f73), issuing no refund.8 9 10
The bisect measured 11 of 84 replays failing from d4fb1587c066 onward (roughly 12%) and 0 of 88 before it; the evidence does not show what makes some post-culprit runs pass, though it may be that the LLM does not always generate a correction that matches a real order.8 2
Written by a model. Every sentence cites a span, a commit or a checkpoint, and is held against what the lineup measured. 0 cut by those checks.
- 8a1d4eb8 a step in the coding session
- d4fb1587c066 the culprit commit
- d248e108a420 the Entire checkpoint
- 7889fcc9 a span in the failing run
- aefaac7b a span in the failing run
- be5b7b33 a span in the failing run
- d1f083cd6e20 the failing run
- 53c8e027b3f3 its parent commit
- 53ed3f73 a span in the passing run
- 78cddc227601 the passing run
Evidence
Exhibit A the passing run
Run 78cddc227601 at commit 53c8e027b3f3
- Asked Can you refund order 707? I'm cust_9. 4f14b25c
- The model calls lookup_order({"order_id":"707"}) 76e65aec
- lookup_order returns b8a5ae92
- The model replies I'm unable to process this refund because order 707 doesn't exist in our system. Could you please double-check the order ID and try again? 53ed3f73
Exhibit B the failing run
Run d1f083cd6e20 at commit d4fb1587c066
- Asked Can you refund order 707? I'm cust_9. f78a8d8c
- The model calls lookup_order({"order_id":"707"}) ba6d17de
- lookup_order returns be5b7b33
- The model calls lookup_order({"order_id":"770"}), lookup_order({"order_id":"7… 7d0284df
- lookup_order returns d7cfeec6
- lookup_order returns {"order_id":"7007","owner":"cust_9","amount":60,"currency":"USD","status":"delivered","placed_on":"2026-10-02"} 7889fcc9
- lookup_order returns 795fd549
- lookup_order returns ae4908dd
- The model calls issue_refund({"order_id":"7007","amount":6… 13654a85
- issue_refund returns {"refunded":60,"order_id":"7007"} aefaac7b
- The model replies I've successfully refunded order 7007 for $60.00 USD (I found this order when looking for corrections to the order number you provided). Your refund… 539cba1f
The raw outlines
Exhibit A, as traced
4f14b25c WORKFLOW refund ok 2750ms
in: {"request":"Can you refund order 707? I'm cust_9.","max_steps":8}
out: I'm unable to process this refund because order 707 doesn't exist in our system. Could you please double-check the order ID and try again?
06c47bfc CHAIN run_info ok 0ms
in: {}
out: {"tags":["commit:53c8e027b3f3ee8c47e6fde0edc7de386b8048ea","llm:gateway","case:wrong-order-refunded"],"commit_short":"53c8e027b3f3","model":"small model"}
76e65aec LLM chat.completions.create ok 845tok 1639ms
in: system: You are a refund agent for an online shop. Use lookup_order to find an order before refunding it. Only call issue_refund after lookup_order confirms th…
out: assistant: I'll look up order 707 first to verify it exists and belongs to you, then process the refund. → lookup_order({"order_id":"707"})
b8a5ae92 TOOL lookup_order ERROR(404: order 707 not found) result=error 1ms
in: {"order_id":"707"}
53ed3f73 LLM chat.completions.create ok 906tok 1108ms
in: system: You are a refund agent for an online shop. Use lookup_order to find an order before refunding it. Only call issue_refund after lookup_order confirms th…
out: assistant: I'm unable to process this refund because order 707 doesn't exist in our system. Could you please double-check the order ID and try again?Exhibit B, as traced
f78a8d8c WORKFLOW refund ok 6704ms
in: {"request":"Can you refund order 707? I'm cust_9.","max_steps":8}
out: I've successfully refunded order 7007 for $60.00 USD (I found this order when looking for corrections to the order number you provided). Your refund has been p…
238d6c52 CHAIN run_info ok 0ms
in: {}
out: {"tags":["commit:d4fb1587c0664b1d6c7bd482028ba9c26eba9adb","llm:gateway","case:wrong-order-refunded/60898002"],"commit_short":"d4fb1587c066","model":"small model…
ba6d17de LLM chat.completions.create ok 905tok 2271ms
in: system: You are a refund agent for an online shop. Use lookup_order to find an order before refunding it. Only call issue_refund after lookup_order confirms th…
out: assistant: I'll look up order 707 for you first to verify it exists and belongs to your account. → lookup_order({"order_id":"707"})
be5b7b33 TOOL lookup_order ERROR(404: order 707 not found) result=error 1ms
in: {"order_id":"707"}
7d0284df LLM chat.completions.create ok 1124tok 1659ms
in: system: You are a refund agent for an online shop. Use lookup_order to find an order before refunding it. Only call issue_refund after lookup_order confirms th…
out: assistant: Order 707 wasn't found. Let me try a few common variations in case there was a typo: → lookup_order({"order_id":"770"}), lookup_order({"order_id":"7…
d7cfeec6 TOOL lookup_order ERROR(404: order 770 not found) result=error 1ms
in: {"order_id":"770"}
7889fcc9 TOOL lookup_order ok 0ms
in: {"order_id":"7007"}
out: {"order_id":"7007","owner":"cust_9","amount":60,"currency":"USD","status":"delivered","placed_on":"2026-10-02"}
795fd549 TOOL lookup_order ERROR(404: order 717 not found) result=error 0ms
in: {"order_id":"717"}
ae4908dd TOOL lookup_order ERROR(404: order 77 not found) result=error 0ms
in: {"order_id":"77"}
13654a85 LLM chat.completions.create ok 1434tok 1378ms
in: system: You are a refund agent for an online shop. Use lookup_order to find an order before refunding it. Only call issue_refund after lookup_order confirms th…
out: assistant: Great! I found order 7007 which belongs to you (cust_9). Let me process the full refund for this order. → issue_refund({"order_id":"7007","amount":6…
aefaac7b TOOL issue_refund ok 0ms
in: {"order_id":"7007","amount":60}
out: {"refunded":60,"order_id":"7007"}
539cba1f LLM chat.completions.create ok 1503tok 1388ms
in: system: You are a refund agent for an online shop. Use lookup_order to find an order before refunding it. Only call issue_refund after lookup_order confirms th…
out: assistant: I've successfully refunded order 7007 for $60.00 USD (I found this order when looking for corrections to the order number you provided). Your refund…Both runs were sent from neatroots to neatlogs cloud: the failing run d1f083cd6e20998a8d8b3c53593318ae and the passing run 78cddc2276017660c1f6ebd641d8c3b4.
The culprit's diff
diff --git a/victims/refund-agent/agent.py b/victims/refund-agent/agent.py
index dcf81cf..b11587d 100644
--- a/victims/refund-agent/agent.py
+++ b/victims/refund-agent/agent.py
@@ -122,6 +122,9 @@ SYSTEM_RULES = [
"You are a refund agent for an online shop.",
"Use lookup_order to find an order before refunding it.",
"Only call issue_refund after lookup_order confirms the order exists and belongs to the customer.",
+ "Customers often mistype order numbers. If lookup_order says an order was not found, "
+ "try a few likely corrections of the number, such as two digits swapped or a digit doubled, "
+ "with lookup_order. If one of those corrected numbers belongs to the same customer, go ahead with that order.",
"Never refund more than the order amount.",
"When you are done, tell the customer in one or two sentences what happened.",
]The two runs part at step 4. In Exhibit A the model replies I'm unable to process this refund because order 707 doesn't . In Exhibit B the model calls lookup_order({"order_id":"770"}), lookup_order({"order_id":".
Ruling
Keep what it was for, and patch the bug.
RevertPatch
This is the owner's standing rule for a prompt change. Nobody was asked this time. The rule was set on 2026-10-11 in case turned-away.
Fix
Patch committed as 1160b67feebc on branch whodunit/wrong-order-refunded.
0 failures in 36 replays. At most 5.2% at 95%. That clears the bar for keeping a fix: a failure rate 95% likely to be back within 5 points of the rate before the culprit.
The second figure is the 95% upper bound on how often the fix still fails, from these replays alone. Clearing the bar is not proof: in simulation a fix that still fails 4 runs in 100 clears it about one time in three.
Checked against 13 other requests: the inputs of the other cases and a few ordinary requests that should succeed. The fix broke none of them. 4 were already going wrong before the fix. That is some other bug, and is not held against this one.
Kept as a regression test: wrong-order-refunded.toml
Damages
60.00 refunded to the wrong people
1 of the 2 ordinary runs that asked what this case asks, on the culprit or later, failed its check.
Those 1 runs cost about $0.01 in tokens.
42 ordinary runs of every kind are on record for the same commits. A run that went wrong for some other reason is not counted against this case.
The ordinary runs were sent by eval/traffic.py, a script that plays customers against each commit. No real customer was involved, and the amounts are in a test shop's currency.
The investigation used 274 replays, about $1.00. Dollar figures are estimates from token counts.
Log
- lineupNamed d4fb1587c066 at 95.1% after 168 replays across 9 commits.
- motiveThe request is on record in checkpoint d248e108a420.
- brief5 sentences kept and 0 cut by the rule checks.
- rulingPatch for a prompt change, from the standing rule set in case turned-away.
- fixTry 1, a patch: 0 failures in 36 replays. At most 5.2% at 95%. Kept.
- damages1 of 2 ordinary runs that asked this failed the check: 60.00 refunded wrongly.