Case closedCase 004
14 commits since it last worked. Which one did it?
Customers asking for a refund on an order that has shipped get a kind reply and no refund.
Drawn from the case recordScripted traffic, no real customers
- Case no.
- 004
- File
- turned-away
- Opened
- 10 Oct 2026, 19:11 UTC
- Closed
- 11 Oct 2026, 13:19 UTC
- Suspects
- 14, 13 cleared
- Replays
- 24 to name the culprit, 171 in all
- Cost of the investigation
- about $0.95
- Damage
- 360.00 owed and not refunded
The lineup
xa replay that failedoa replay that passedhas an alibistruck throughcleared
24 replays are typed under the commits they ran on.
The lineup as a table
| No. | Commit | Subject | Status | Odds | Runs |
|---|---|---|---|---|---|
| 1 | fedf89729b98 | Check currency codes and positive amounts in smoke.py | Cleared | 0.0% | not replayed |
| 2 | 5cfdd5acf608 | Mention smoke.py in the refund agent README | Cleared | 0.0% | not replayed |
| 3 | e4a3e567223e | Label SYSTEM_RULES groups with one-line comments | Cleared | 0.0% | 0 failed, 3 passed |
| 4 | c0fb4a11007e | Cache agent_version so it doesn't reread pyproject.toml every call | Cleared | 0.2% | not replayed |
| 5 | 38d1b4f23bfc | Add order 1212 for cust_4 | Cleared | 0.2% | 0 failed, 3 passed |
| 6 | ca0a2d6288aa | Reassure customers instead of refunding orders still in transit | Culprit | 99.58% | 3 failed, 0 passed |
| 7 | a7b2b34584f0 | Turn the refund-agent order list into a table | Cleared | 0.0% | 3 failed, 0 passed |
| 8 | 95b3ca73b1fd | Fail smoke.py on duplicate order_id keys or key/field mismatches | Cleared | 0.0% | not replayed |
| 9 | fe9564a05b58 | Warn on stderr when WHODUNIT_ENV points to a missing file | Cleared | 0.0% | not replayed |
| 10 | c1f5a526ee76 | Update agent.py docstring: document --json and orders.json | Cleared | 0.0% | not replayed |
| 11 | 6a4e48905812 | Bump refund-agent version to 0.3.0 | Cleared | 0.0% | not replayed |
| 12 | f7b69ac79ec3 | refund-agent: add How refunds are decided section to README | Cleared | 0.0% | not replayed |
| 13 | 216855eccf7c | refund-agent: ignore __pycache__ and .venv | Cleared | 0.0% | not replayed |
| 14 | df4f4fa601c6 | refund-agent: print a one-line summary on smoke.py success | Cleared | 0.0% | 6 failed, 0 passed |
- 24
- replays to name the culprit
- 99.58%
- sure it is this commit
- 6
- commits a scan from the oldest suspect would have tested. This lineup tested 6.
Suspects
ca0a2d6288aa Reassure customers instead of refunding orders still in transit
Suspects: 14. Cleared: 13. Confidence: 99.58%.
24 replays across 6 commits, 5.3 minutes of replay time. From this commit on it fails about 93% of the time. Before it, about 2%.
Voided replays: 0. No replay hit a provider or network error.
Motive
Someone asked the coding agent for this:
victims/refund-agent: one more for friendlier replies. When someone asks for a refund on an order that's still shipped and hasn't arrived yet, the agent is a bit blunt about it. Customers in that spot are usually just anxious it's lost. Make the agent warmer there: reassure them the order is on its way, tell them when it was placed, and let them know they're welcome to come back for a refund if it doesn't turn up or they still don't want it once it arrives. Check agent.py still compiles, then commit.
Entire checkpoint 6b2050de3c0b, asked at 2026-10-10 18:30 UTC. Quote checked against the transcript. Open the checkpoint
Line by line, entire why puts all 9 changed lines that were checked behind this commit and this checkpoint.
What the coding agent did next
- 70fa4267 said: Now I'll add the new rule to `SYSTEM_RULES` so shipped (not yet delivered) orders get a warmer, reassuring reply instead of a blunt refund.
- f511062a edited victims/refund-agent/agent.py: # Lookups and ownership: when to call lookup_order vs issue_refund, and whose order it is
- 42b9b357 edited victims/refund-agent/agent.py: # Shipped orders: a refund request before the order has even arrived
- ded41f9e said: Now let's check that agent.py still compiles.
- a34065e6 said: Compiles fine. Now committing.
- a4215d0f said: Good, the repo root is `.` and the cwd is already inside it, so no `cd` is needed.
Brief
ca0a2d6288aa blocks refunds on shipped orders even when customer's reason is unrelated to delivery
Commit ca0a2d6288aa added a SYSTEM_RULES entry at line 166 that tells the agent never to issue a refund if the order status is 'shipped', regardless of the customer's reason.1 2
The rule was intended for anxious customers who might just be worried the order is lost, but it also fires when the customer explicitly states a different reason, such as ordering the wrong item.1 3
In the failing run, the agent called lookup_order, saw status 'shipped', then applied the new rule and sent a reassurance reply instead of calling issue_refund.4 5 6
The passing run on parent commit 38d1b4f23bfc shows the same lookup returning the same 'shipped' status, after which the agent correctly called issue_refund and completed the refund.7 8 9
The comparison confirms the failing run made only one tool call (lookup_order) while the passing run made two (lookup_order and issue_refund).10 11
The rule added in ca0a2d6288aa contains no carve-out for cases where the customer's stated reason has nothing to do with delivery anxiety, making the block unconditional on order status alone.1 12
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.
- 42b9b357 a step in the coding session
- ca0a2d6288aa the culprit commit
- f511062a a step in the coding session
- 10f52c0ae2b3 the failing run
- 535cf3f2 a span in the failing run
- bf73aa74 a span in the failing run
- 38c49d062086 the passing run
- 7221dbea a span in the passing run
- 84739d64 a span in the passing run
- 35a29c86 a span in the passing run
- 94e7c7db a span in the failing run
- 6b2050de3c0b the Entire checkpoint
Evidence
Exhibit A the passing run
Run 38c49d062086 at commit 38d1b4f23bfc
- Asked Hi, I'm cust_4. Please refund order 2002, I ordered the wrong item by mistake. 35a29c86
- The model calls lookup_order({"order_id":"2002"}) 294cc38b
- lookup_order returns {"order_id":"2002","owner":"cust_4","amount":30,"currency":"USD","status":"shipped","placed_on":"2026-09-15"} 7221dbea
- The model replies I totally understand—ordering the wrong item is frustrating! I'm glad you caught it and reached out. Let me process that refund for you right away. … 0f9d0d48
- issue_refund returns {"refunded":30,"order_id":"2002","reason":"ordered wrong item by mistake"} 84739d64
- The model replies Perfect—I've refunded the full $30 to your account for order 2002. You should see that money back within a few business days depending on your bank. 34fa4ae4
Exhibit B the failing run
Run 10f52c0ae2b3 at commit ca0a2d6288aa
- Asked Hi, I'm cust_4. Please refund order 2002, I ordered the wrong item by mistake. 94e7c7db
- The model calls lookup_order({"order_id":"2002"}) fa3dfdcc
- lookup_order returns {"order_id":"2002","owner":"cust_4","amount":30,"currency":"USD","status":"shipped","placed_on":"2026-09-15"} bf73aa74
- The model replies I can see your order is on its way to you – it was placed on September 15th and is currently shipped. Here's what I'd suggest: since it's still in t… 535cf3f2
The raw outlines
Exhibit A, as traced
35a29c86 WORKFLOW refund ok 4140ms
in: {"request":"Hi, I'm cust_4. Please refund order 2002, I ordered the wrong item by mistake.","max_steps":3}
out: Perfect—I've refunded the full $30 to your account for order 2002. You should see that money back within a few business days depending on your bank.
cbed3529 CHAIN run_info ok 1ms
in: {"max_steps":3}
out: {"tags":["commit:38d1b4f23bfcdcc9756fcf59dd23407c3e36df0f","llm:gateway","case:turned-away"],"commit_short":"38d1b4f23bfc","model":"small model","version":"0.…
294cc38b LLM chat.completions.create ok 1435tok 1566ms
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: → lookup_order({"order_id":"2002"})
7221dbea 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"}
0f9d0d48 LLM chat.completions.create ok 1629tok 1368ms
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 totally understand—ordering the wrong item is frustrating! I'm glad you caught it and reached out. Let me process that refund for you right away. …
84739d64 TOOL issue_refund ok 0ms
in: {"order_id":"2002","amount":30,"reason":"ordered wrong item by mistake"}
out: {"refunded":30,"order_id":"2002","reason":"ordered wrong item by mistake"}
34fa4ae4 LLM chat.completions.create ok 1704tok 1202ms
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 refunded the full $30 to your account for order 2002. You should see that money back within a few business days depending on your bank.Exhibit B, as traced
94e7c7db WORKFLOW refund ok 4073ms
in: {"request":"Hi, I'm cust_4. Please refund order 2002, I ordered the wrong item by mistake.","max_steps":3}
out: I can see your order is on its way to you – it was placed on September 15th and is currently shipped. Here's what I'd suggest: since it's still in transit, let…
ed7e2b57 CHAIN run_info ok 1ms
in: {"max_steps":3}
out: {"tags":["commit:ca0a2d6288aad40896ccd6d015ef5bd43c4e56fd","llm:gateway","case:turned-away"],"commit_short":"ca0a2d6288aa","model":"small model","version":"0.…
fa3dfdcc LLM chat.completions.create ok 1571tok 1909ms
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 understand – it's so easy to order the wrong thing by mistake! Let me sort that refund out for you right away. → lookup_order({"order_id":"2002"})
bf73aa74 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"}
535cf3f2 LLM chat.completions.create ok 1746tok 2160ms
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 can see your order is on its way to you – it was placed on September 15th and is currently shipped. Here's what I'd suggest: since it's still in t…Both runs were sent from neatroots to neatlogs cloud: the failing run 10f52c0ae2b315f6a2bc037a9f318b98 and the passing run 38c49d062086a3f05468c95f9d3fab48.
The culprit's diff
diff --git a/victims/refund-agent/agent.py b/victims/refund-agent/agent.py
index b3de501..0f0bb1a 100644
--- a/victims/refund-agent/agent.py
+++ b/victims/refund-agent/agent.py
@@ -143,9 +143,10 @@ SYSTEM_RULES = [
"double-check something and write back.",
# Lookups and ownership: when to call lookup_order vs issue_refund, and whose order it is
"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.",
+ "those, without calling lookup_order first, unless you still need to check whether the order has been "
+ "delivered yet.",
+ "Only call lookup_order when the order number or the amount is missing or unclear, or when you need to "
+ "check whether the order has been delivered yet, 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.",
@@ -161,6 +162,11 @@ SYSTEM_RULES = [
"another customer or any internal id. Don't suggest the customer did anything wrong. Just let them know you "
"can't apply it to their account and that you'll get them sorted, and ask for whatever you need to find the "
"right order.",
+ # Shipped orders: a refund request before the order has even arrived
+ "If a refund request is for an order that's still shipped, not yet delivered, don't issue the refund yet. "
+ "Reassure the customer it's on its way, tell them when it was placed (the placed_on date), and let them "
+ "know they're welcome to come back for a refund if it doesn't turn up or they still don't want it once it "
+ "arrives.",
# Refunds: what issue_refund can and can't do
"Never refund more than the order amount.",
"You can only issue a refund, not send a replacement. If a replacement would make sense for what the "The two runs part at step 5. In Exhibit A issue_refund returns {"refunded":30,"order_id":"2002","reason":"ordered wrong ite. In Exhibit B has already stopped.
Ruling
Keep what it was for, and patch the bug.
RevertPatch
This is the owner's standing rule for a prompt change.
Fix
Revert committed as 0c65edc56b85 on branch whodunit/turned-away.
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 12 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: 330794e4d75d, 5 failures in 12 replays. At most 64.8% at 95%. Not kept.
- Try 2, a patch: bcaf37973688, 4 failures in 18 replays. At most 40.8% at 95%. Not kept.
- Try 3, a revert: 0c65edc56b85, 0 failures in 30 replays. At most 6.2% at 95%. Kept. Checked against 12 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.
This is a fallback: the ruling was to patch, and two patches did not clear the bar.
Kept as a regression test: turned-away.toml
Damages
360.00 owed and not refunded
6 of the 6 ordinary runs that asked what this case asks, on the culprit or later, failed its check.
Those 6 runs cost about $0.03 in tokens.
63 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 171 replays, about $0.95. Dollar figures are estimates from token counts.
Log
- lineupNamed ca0a2d6288aa at 99.58% after 24 replays across 6 commits.
- motiveThe request is on record in checkpoint 6b2050de3c0b.
- brief6 sentences kept and 0 cut by the rule checks.
- rulingPatch for a prompt change, asked of the owner in this case.
- fixTry 1, a patch: 5 failures in 12 replays. At most 64.8% at 95%. Not kept.
- fixTry 2, a patch: 4 failures in 18 replays. At most 40.8% at 95%. Not kept.
- fixTry 3, a revert: 0 failures in 30 replays. At most 6.2% at 95%. Kept.
- damages6 of 6 ordinary runs that asked this failed the check: 360.00 owed and not refunded.