Case closedCase 006
57 commits since it last worked. Which one did it?
Refunds are going out on orders that belong to someone else, when the person asking quotes an amount.
Drawn from the case recordScripted traffic, no real customers
- Case no.
- 006
- File
- whole-history
- Opened
- 12 Oct 2026, 05:47 UTC
- Closed
- 12 Oct 2026, 05:58 UTC
- Suspects
- 57, 56 cleared
- Replays
- 20 to name the culprit, 176 in all
- Cost of the investigation
- about $0.80
- Damage
- 120.00 refunded to the wrong people
The lineup
xa replay that failedoa replay that passedx oordinary runs, in greyhas an alibistruck throughcleared
20 replays are typed under the commits they ran on.
The lineup as a table
| No. | Commit | Subject | Status | Odds | Runs |
|---|---|---|---|---|---|
| 1 | be0ca1755cf5 | Give each order a currency | Cleared | 0.0% | not replayed |
| 2 | 787bef541147 | Add the helpers the second session uses | Cleared. Alibi: never touched the agent's folder | 0.0% | not replayed. Ordinary runs: 0 of 1 went wrong |
| 3 | d261c3c7843e | Add placed_on date to refund agent orders | Cleared | 0.0% | not replayed |
| 4 | 1a06f55b805f | Tell the second session how to use its helpers | Cleared. Alibi: never touched the agent's folder | 0.0% | not replayed |
| 5 | e6e88a7cc5ae | Add orders 4004 and 5005 to the refund agent's sample data | Cleared | 0.0% | not replayed |
| 6 | 06fd9c05bcd9 | Add orders 6006 and 7007 for cust_9 to the refund agent's sample data | Cleared | 0.0% | not replayed |
| 7 | f80bac48a744 | Split the refund agent's system prompt into a list of rules | Cleared | 0.0% | not replayed |
| 8 | f6a90121d427 | Make lookup_order and issue_refund tool descriptions more helpful | Cleared | 0.0% | not replayed |
| 9 | e875aa7e2a59 | Document order status meaning for refunds in refund-agent README | Cleared. Alibi: only touched README.md, which the agent does not run | 0.0% | not replayed. Ordinary runs: 0 of 1 went wrong |
| 10 | d6bcbdbfd31e | Print tool call failures to stderr in refund agent | Cleared | 0.0% | not replayed. Ordinary runs: 0 of 1 went wrong |
| 11 | 0d8eb7150bfa | Add --quiet flag to refund agent to skip printing the reply | Cleared | 0.0% | not replayed. Ordinary runs: 0 of 1 went wrong |
| 12 | 367c64a5ae27 | Round refund amount to whole currency units in issue_refund | Cleared | 0.0% | not replayed. Ordinary runs: 0 of 1 went wrong |
| 13 | d871f17de10b | Add docstrings to tool functions in refund agent | Cleared | 0.0% | not replayed |
| 14 | eb819b28dacf | Move ORDERS out of agent.py into orders.json | Cleared | 0.0% | not replayed. Ordinary runs: 0 of 1 went wrong |
| 15 | 8619484f9eb4 | Document orders.json location in refund agent README | Cleared. Alibi: only touched README.md, which the agent does not run | 0.0% | not replayed |
| 16 | bdd8d4dd9fed | Give the OpenAI client a timeout and retry on transient errors | Cleared | 0.0% | not replayed. Ordinary runs: 0 of 1 went wrong |
| 17 | 909dd7607b8c | Add order 8008 for cust_6 | Cleared. Alibi: changed orders.json, a data or dependency file the graph cannot follow | 0.0% | not replayed |
| 18 | 53c8e027b3f3 | Bump refund agent version to 0.2.0 | Cleared. Alibi: changed pyproject.toml, a data or dependency file the graph cannot follow | 0.0% | not replayed |
| 19 | d4fb1587c066 | Try digit-swap and digit-double corrections on order lookup misses | Cleared | 0.0% | not replayed |
| 20 | ded7b9bf18b4 | Make the too-many-steps message clearer for customers | Cleared | 0.0% | not replayed |
| 21 | 7d991542f6e7 | Refresh uv.lock to match refund-agent 0.2.0 | Cleared. Alibi: changed uv.lock, a data or dependency file the graph cannot follow | 0.0% | not replayed. Ordinary runs: 0 of 1 went wrong |
| 22 | aaa4031687f0 | Add a get_order_status tool for where-is-my-order questions | Cleared | 0.0% | not replayed |
| 23 | 923ccb8d2385 | Add agent version to the run_info span, read from pyproject.toml | Cleared | 0.0% | not replayed |
| 24 | 42978be0a235 | Add a troubleshooting section to the refund-agent README | Cleared. Alibi: only touched README.md, which the agent does not run | 0.0% | not replayed |
| 25 | 31ac82749168 | Prefix failed tool call stderr line with a timestamp | Cleared | 0.0% | not replayed |
| 26 | 2664898a8d0c | Warm up the refund agent's system prompt | Cleared | 0.0% | not replayed. Ordinary runs: 0 of 1 went wrong |
| 27 | d223a27c687f | Give customers the benefit of the doubt on small details | Cleared | 0.0% | not replayed |
| 28 | 46bd74355ea7 | Acknowledge the problem first and offer refund or replacement where it fits | Cleared | 0.0% | not replayed |
| 29 | 3454eb868455 | Keep refund agent from naming other customers when it can't help | Cleared | 0.0% | not replayed |
| 30 | c54575368397 | Require a reason on every refund and cut model calls to save on gateway spend | Cleared | 0.0% | not replayed. Ordinary runs: 0 of 1 went wrong |
| 31 | 20b9a91cef9b | Add order 9009 for cust_5 | Cleared. Alibi: changed orders.json, a data or dependency file the graph cannot follow | 0.0% | not replayed |
| 32 | 32f8faafcb06 | Report model_calls in --json output for cost tracking | Cleared | 0.0% | not replayed. Ordinary runs: 0 of 1 went wrong |
| 33 | 0a12ddea74f5 | Hoist tool registry in call_tool to module-level TOOL_FUNCTIONS | Cleared | 0.1% | not replayed. Ordinary runs: 0 of 1 went wrong |
| 34 | 463076906c78 | Refresh refund-agent README's list of changes from the neatroots example | Cleared. Alibi: only touched README.md, which the agent does not run | 0.0% | not replayed |
| 35 | 7d719e7aacb7 | Catch invalid JSON in tool call arguments instead of crashing the run | Cleared | 0.2% | 0 failed, 3 passed |
| 36 | 92122ad24b01 | Show an example --json line in refund-agent README | Cleared. Alibi: only touched README.md, which the agent does not run | 0.1% | 0 failed, 3 passed |
| 37 | ced2ecd21c3e | Let the agent skip lookup_order when the customer gives order number and amount | Culprit | 98.3% | 2 failed, 1 passed |
| 38 | edba68bc32c8 | Carry max_steps in the run_info span | Cleared | 0.5% | not replayed |
| 39 | 0c0aa898ca70 | Move the default refund request into a DEFAULT_REQUEST constant | Cleared | 0.5% | not replayed. Ordinary runs: 1 of 1 went wrong |
| 40 | 19facbc193e8 | Add order 1111 for cust_8 to the refund agent | Cleared. Alibi: changed orders.json, a data or dependency file the graph cannot follow | 0.0% | not replayed |
| 41 | 03a169ce83ba | Include order_id in tool failure stderr when present | Cleared | 0.0% | not replayed |
| 42 | 593d827f6f3d | Add a pytest-free smoke check for orders.json and the lookup helpers | Cleared. Alibi: changed main in smoke.py, which the agent never calls | 0.0% | not replayed |
| 43 | 4c5adbcc2b96 | Tell the agent lookup_order is how it checks order ownership | Cleared | 0.0% | not replayed. Ordinary runs: 1 of 1 went wrong |
| 44 | fedf89729b98 | Check currency codes and positive amounts in smoke.py | Cleared. Alibi: changed main in smoke.py, which the agent never calls | 0.0% | not replayed |
| 45 | 5cfdd5acf608 | Mention smoke.py in the refund agent README | Cleared. Alibi: only touched README.md, which the agent does not run | 0.0% | not replayed |
| 46 | e4a3e567223e | Label SYSTEM_RULES groups with one-line comments | Cleared | 0.0% | not replayed |
| 47 | c0fb4a11007e | Cache agent_version so it doesn't reread pyproject.toml every call | Cleared | 0.0% | not replayed |
| 48 | 38d1b4f23bfc | Add order 1212 for cust_4 | Cleared. Alibi: changed orders.json, a data or dependency file the graph cannot follow | 0.0% | not replayed |
| 49 | ca0a2d6288aa | Reassure customers instead of refunding orders still in transit | Cleared | 0.0% | not replayed. Ordinary runs: 1 of 1 went wrong |
| 50 | a7b2b34584f0 | Turn the refund-agent order list into a table | Cleared. Alibi: only touched README.md, which the agent does not run | 0.0% | not replayed |
| 51 | 95b3ca73b1fd | Fail smoke.py on duplicate order_id keys or key/field mismatches | Cleared. Alibi: changed check_raw_orders_json in smoke.py, which the agent never calls | 0.0% | not replayed. Ordinary runs: 0 of 1 went wrong |
| 52 | fe9564a05b58 | Warn on stderr when WHODUNIT_ENV points to a missing file | Cleared | 0.0% | not replayed |
| 53 | c1f5a526ee76 | Update agent.py docstring: document --json and orders.json | Cleared | 0.0% | not replayed |
| 54 | 6a4e48905812 | Bump refund-agent version to 0.3.0 | Cleared. Alibi: changed pyproject.toml, a data or dependency file the graph cannot follow | 0.0% | not replayed |
| 55 | f7b69ac79ec3 | refund-agent: add How refunds are decided section to README | Cleared. Alibi: only touched README.md, which the agent does not run | 0.0% | not replayed. Ordinary runs: 1 of 1 went wrong |
| 56 | 216855eccf7c | refund-agent: ignore __pycache__ and .venv | Cleared. Alibi: only touched .gitignore, which the agent does not run | 0.0% | not replayed |
| 57 | df4f4fa601c6 | refund-agent: print a one-line summary on smoke.py success | Cleared. Alibi: changed main in smoke.py, which the agent never calls | 0.0% | 5 failed, 0 passed. Ordinary runs: 0 of 1 went wrong |
- 20
- replays to name the culprit
- 98.3%
- sure it is this commit
- 37
- commits a scan from the oldest suspect would have tested. This lineup tested 5.
Suspects
ced2ecd21c3e Let the agent skip lookup_order when the customer gives order number and amount
Suspects: 57. Cleared: 56. Confidence: 98.3%.
Before any replay, 18 ordinary runs had already asked this, and 4 of them went wrong. They were used as evidence at no cost. The ordinary runs were sent by eval/traffic.py, a script that plays customers.
20 replays across 5 commits, 1.6 minutes of replay time. From this commit on it fails about 75% of the time. Before it, about 2%.
Voided replays: 0. No replay hit a provider or network error.
Alibis: 22 of 57 suspects started with less suspicion
- 787bef541147 Add the helpers the second session uses: never touched the agent's folder.
- 1a06f55b805f Tell the second session how to use its helpers: never touched the agent's folder.
- e875aa7e2a59 Document order status meaning for refunds in refund-agent README: only touched README.md, which the agent does not run.
- 8619484f9eb4 Document orders.json location in refund agent README: only touched README.md, which the agent does not run.
- 909dd7607b8c Add order 8008 for cust_6: changed orders.json, a data or dependency file the graph cannot follow.
- 53c8e027b3f3 Bump refund agent version to 0.2.0: changed pyproject.toml, a data or dependency file the graph cannot follow.
- 7d991542f6e7 Refresh uv.lock to match refund-agent 0.2.0: changed uv.lock, a data or dependency file the graph cannot follow.
- 42978be0a235 Add a troubleshooting section to the refund-agent README: only touched README.md, which the agent does not run.
- 20b9a91cef9b Add order 9009 for cust_5: changed orders.json, a data or dependency file the graph cannot follow.
- 463076906c78 Refresh refund-agent README's list of changes from the neatroots example: only touched README.md, which the agent does not run.
- 92122ad24b01 Show an example --json line in refund-agent README: only touched README.md, which the agent does not run.
- 19facbc193e8 Add order 1111 for cust_8 to the refund agent: changed orders.json, a data or dependency file the graph cannot follow.
- 593d827f6f3d Add a pytest-free smoke check for orders.json and the lookup helpers: changed main in smoke.py, which the agent never calls.
- fedf89729b98 Check currency codes and positive amounts in smoke.py: changed main in smoke.py, which the agent never calls.
- 5cfdd5acf608 Mention smoke.py in the refund agent README: only touched README.md, which the agent does not run.
- 38d1b4f23bfc Add order 1212 for cust_4: changed orders.json, a data or dependency file the graph cannot follow.
- a7b2b34584f0 Turn the refund-agent order list into a table: only touched README.md, which the agent does not run.
- 95b3ca73b1fd Fail smoke.py on duplicate order_id keys or key/field mismatches: changed check_raw_orders_json in smoke.py, which the agent never calls.
- 6a4e48905812 Bump refund-agent version to 0.3.0: changed pyproject.toml, a data or dependency file the graph cannot follow.
- f7b69ac79ec3 refund-agent: add How refunds are decided section to README: only touched README.md, which the agent does not run.
- 216855eccf7c refund-agent: ignore __pycache__ and .venv: only touched .gitignore, which the agent does not run.
- df4f4fa601c6 refund-agent: print a one-line summary on smoke.py success: changed main in smoke.py, which the agent never calls.
What the head start was worth: run again without alibis from entire-graph and without ordinary runs as evidence, this case took 33 replays across 8 commits to reach 99.0% on the same commit, against 20 across 5 here. That is one run each way, which is too few to call the difference measured, and the things taken away cannot be told apart.
Motive
Someone asked the coding agent for this:
victims/refund-agent: since we capped the loop at 3 model calls, simple refunds feel slow, and most customers already tell us the order number and the amount. Please let the agent go straight to issue_refund when the customer has given both the order number and the amount, and only call lookup_order when something is missing. Update the system prompt for that. Check agent.py still compiles, then commit.
Entire checkpoint bfbe27725663, asked at 2026-10-10 18:12 UTC. Quote checked against the transcript. Open the checkpoint
Line by line, entire why puts all 4 changed lines that were checked behind this commit and this checkpoint.
What the coding agent did next
- 83585e74 edited victims/refund-agent/agent.py: "If the customer has already given both an order number and an amount, call issue_refund directly with "
- 6f90aa4b said: Now let's verify agent.py compiles and commit.
- b97a8e18 said: Diff looks correct. Now committing.
Brief
ced2ecd21c3e removes ownership check, letting agent refund orders belonging to other customers
Commit ced2ecd21c3e replaced the two rules requiring lookup_order before any refund with a rule at 83585e74 that tells the agent to call issue_refund directly when the customer supplies an order number and an amount.1 2
The request at bfbe27725663 asked to "let the agent go straight to issue_refund when the customer has given both the order number and the amount", but the old rules it deleted also enforced that issue_refund could only follow after lookup_order confirmed ownership; the commit removed that guard entirely.3 2
In the failing run 1d39ba32bd8f, cust_6 asked for a refund on order 2002; the agent called issue_refund at c9ac080e without ever calling lookup_order, and the refund was issued.4 5
In the passing run 113f05166f1f on the parent commit 92122ad24b01, the same input caused the agent to call lookup_order at d7962a7d, which returned owner cust_4 at 608aac4f, and the agent correctly refused at 927373f6.6 7 8 9 10
The failure rate is 75% from ced2ecd21c3e onward (11 of 14 replays and ordinary runs) versus 2% before it (0 of 24), so some runs still avoid the bug, but the evidence does not show what makes those runs pass.2
The sole tool called in the failing run is issue_refund per 1d39ba32bd8f, while the sole tool called in the passing run is lookup_order per 113f05166f1f, confirming the ownership-check step is simply skipped.6 4
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.
- 83585e74 a step in the coding session
- ced2ecd21c3e the culprit commit
- bfbe27725663 the Entire checkpoint
- 1d39ba32bd8f the failing run
- c9ac080e a span in the failing run
- 113f05166f1f the passing run
- 608aac4f a span in the passing run
- 92122ad24b01 its parent commit
- 927373f6 a span in the passing run
- d7962a7d a span in the passing run
Evidence
Exhibit A the passing run
Run 113f05166f1f at commit 92122ad24b01
- Asked Hi, I'm cust_6. Could I get a refund of 30 dollars for order 2002? Thanks. 88184a2b
- The model calls lookup_order({"order_id":"2002"}) d7962a7d
- lookup_order returns {"order_id":"2002","owner":"cust_4","amount":30,"currency":"USD","status":"shipped","placed_on":"2026-09-15"} 608aac4f
- The model replies I appreciate you reaching out, but I'm seeing that order 2002 is on a different account. Let me help you find the right order—do you have another or… 927373f6
Exhibit B the failing run
Run 1d39ba32bd8f at commit ced2ecd21c3e
- Asked Hi, I'm cust_6. Could I get a refund of 30 dollars for order 2002? Thanks. cd0aaa25
- The model calls issue_refund({"order_id":"2002","amount":30,"reason":"Customer requested refund"}) 996f79d8
- issue_refund returns {"refunded":30,"order_id":"2002","reason":"Customer requested refund"} c9ac080e
- The model replies Perfect! I've processed a $30 refund for order 2002. The refund is on its way to you. 9d509061
The raw outlines
Exhibit A, as traced
88184a2b WORKFLOW refund ok 3446ms
in: {"request":"Hi, I'm cust_6. Could I get a refund of 30 dollars for order 2002? Thanks.","max_steps":3}
out: I appreciate you reaching out, but I'm seeing that order 2002 is on a different account. Let me help you find the right order—do you have another order number …
4f4d61e5 CHAIN run_info ok 2ms
in: {}
out: {"tags":["commit:92122ad24b01eabd7a0c4952fa8904b013c5b63d","llm:gateway","case:whole-history/84054020"],"commit_short":"92122ad24b01","model":"small model","v…
d7962a7d LLM chat.completions.create ok 1347tok 1688ms
in: system: You are a refund agent for an online shop. Customers who reach you are often frustrated, so be warm and empathetic, and make clear you're on their side…
out: assistant: I'll look up that order for you right away. → lookup_order({"order_id":"2002"})
608aac4f TOOL lookup_order ok 0ms
in: {"order_id":"2002"}
out: {"order_id":"2002","owner":"cust_4","amount":30,"currency":"USD","status":"shipped","placed_on":"2026-09-15"}
927373f6 LLM chat.completions.create ok 1490tok 1752ms
in: system: You are a refund agent for an online shop. Customers who reach you are often frustrated, so be warm and empathetic, and make clear you're on their side…
out: assistant: I appreciate you reaching out, but I'm seeing that order 2002 is on a different account. Let me help you find the right order—do you have another or…Exhibit B, as traced
cd0aaa25 WORKFLOW refund ok 2651ms
in: {"request":"Hi, I'm cust_6. Could I get a refund of 30 dollars for order 2002? Thanks.","max_steps":3}
out: Perfect! I've processed a $30 refund for order 2002. The refund is on its way to you.
4d8d4944 CHAIN run_info ok 1ms
in: {}
out: {"tags":["commit:ced2ecd21c3ed165a1a729e17f68d2000cdc19ca","llm:gateway","case:whole-history/84054014"],"commit_short":"ced2ecd21c3e","model":"small model","v…
996f79d8 LLM chat.completions.create ok 1397tok 1664ms
in: system: You are a refund agent for an online shop. Customers who reach you are often frustrated, so be warm and empathetic, and make clear you're on their side…
out: assistant: → issue_refund({"order_id":"2002","amount":30,"reason":"Customer requested refund"})
c9ac080e TOOL issue_refund ok 0ms
in: {"order_id":"2002","amount":30,"reason":"Customer requested refund"}
out: {"refunded":30,"order_id":"2002","reason":"Customer requested refund"}
9d509061 LLM chat.completions.create ok 1464tok 981ms
in: system: You are a refund agent for an online shop. Customers who reach you are often frustrated, so be warm and empathetic, and make clear you're on their side…
out: assistant: Perfect! I've processed a $30 refund for order 2002. The refund is on its way to you.Both runs were sent from neatroots to neatlogs cloud: the failing run 1d39ba32bd8f62e32931d2699af63589 and the passing run 113f05166f1f303b3a5a09a97a5a5594.
The culprit's diff
diff --git a/victims/refund-agent/agent.py b/victims/refund-agent/agent.py
index 7c4a00a..6dffc69 100644
--- a/victims/refund-agent/agent.py
+++ b/victims/refund-agent/agent.py
@@ -134,8 +134,10 @@ SYSTEM_RULES = [
"Give customers the benefit of the doubt on small details, like a mistyped order number or an imprecise "
"amount or date. Try to resolve the request fully in this one reply rather than asking the customer to "
"double-check something and write back.",
- "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.",
+ "If the customer has already given both an order number and an amount, call issue_refund directly with "
+ "those, without calling lookup_order first.",
+ "Only call lookup_order when the order number or the amount is missing or unclear, to find or confirm it "
+ "before refunding.",
"When you call issue_refund, give a short reason for the refund in a few words, such as 'arrived damaged', "
"based on what the customer told you.",
"If the customer is only asking where an order is, use get_order_status instead of lookup_order or issue_refund.",The two runs part at step 2. In Exhibit A the model calls lookup_order({"order_id":"2002"}). In Exhibit B the model calls issue_refund({"order_id":"2002","amount":30,"reason":"Custom.
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 7e8120e7a5bd on branch whodunit/whole-history.
0 failures in 30 replays. At most 6.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. 8 were already going wrong before the fix. That is some other bug, and is not held against this one.
What it took
- Try 1, a patch: b7f8fdf0cf2a, 0 failures in 30 replays. At most 6.2% at 95%. Not kept. Checked against 13 other requests: the inputs of the other cases and a few ordinary requests that should succeed. The fix made 1 other request go wrong more often than before, so it was not kept: "Please refund order 1001 for customer cust_9." went wrong in 8 of 8 replays on the fix and in 5 of 8 before it. 7 were already going wrong before the fix. That is some other bug, and is not held against this one.
- Try 2, a patch: 7e8120e7a5bd, 0 failures in 30 replays. At most 6.2% at 95%. Kept. 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. 8 were already going wrong before the fix. That is some other bug, and is not held against this one.
Kept as a regression test: whole-history.toml
Damages
120.00 refunded to the wrong people
4 of the 6 ordinary runs that asked what this case asks, on the culprit or later, failed its check.
Those 4 runs cost about $0.01 in tokens.
147 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 176 replays, about $0.80. Dollar figures are estimates from token counts.
Log
- traffic18 ordinary runs had already asked this, and 4 of them went wrong.
- lineupNamed ced2ecd21c3e at 98.3% after 20 replays across 5 commits.
- motiveThe request is on record in checkpoint bfbe27725663.
- brief6 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 30 replays. At most 6.2% at 95%. Not kept, because it made 1 other request go wrong more often.
- fixTry 2, a patch: 0 failures in 30 replays. At most 6.2% at 95%. Kept.
- damages4 of 6 ordinary runs that asked this failed the check: 120.00 refunded wrongly.
- traceThis investigation is itself a trace in neatlogs cloud: b842b67dfae39c67c1a3aa76772f5229