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

The last good commit (4c5adbcc2b96): 0 failures in 6 replayslast goodoooooo1. Check currency codes and positive amounts in smoke.py (fedf89729b98), 0.0%1fedf8972. Mention smoke.py in the refund agent README (5cfdd5acf608), 0.0%25cfdd5a3. Label SYSTEM_RULES groups with one-line comments (e4a3e567223e), 0.0%, 0 failures in 3 replays3e4a3e56ooo4. Cache agent_version so it doesn't reread pyproject.toml every call (c0fb4a11007e), 0.2%4c0fb4a15. Add order 1212 for cust_4 (38d1b4f23bfc), 0.2%, 0 failures in 3 replays538d1b4fooo6. Reassure customers instead of refunding orders still in transit (ca0a2d6288aa), 99.58%, 3 failures in 3 replays99.58%6ca0a2d6xxx7. Turn the refund-agent order list into a table (a7b2b34584f0), 0.0%, 3 failures in 3 replays7a7b2b34xxx8. Fail smoke.py on duplicate order_id keys or key/field mismatches (95b3ca73b1fd), 0.0%895b3ca79. Warn on stderr when WHODUNIT_ENV points to a missing file (fe9564a05b58), 0.0%9fe9564a10. Update agent.py docstring: document --json and orders.json (c1f5a526ee76), 0.0%10c1f5a5211. Bump refund-agent version to 0.3.0 (6a4e48905812), 0.0%116a4e48912. refund-agent: add How refunds are decided section to README (f7b69ac79ec3), 0.0%12f7b69ac13. refund-agent: ignore __pycache__ and .venv (216855eccf7c), 0.0%13216855e14. refund-agent: print a one-line summary on smoke.py success (df4f4fa601c6), 0.0%, 6 failures in 6 replays14df4f4faxxxxxxca0a2d6 Reassure customers instead of refu…

24 replays are typed under the commits they ran on.

The lineup as a table
No.CommitSubjectStatusOddsRuns
1fedf89729b98Check currency codes and positive amounts in smoke.pyCleared0.0%not replayed
25cfdd5acf608Mention smoke.py in the refund agent READMECleared0.0%not replayed
3e4a3e567223eLabel SYSTEM_RULES groups with one-line commentsCleared0.0%0 failed, 3 passed
4c0fb4a11007eCache agent_version so it doesn't reread pyproject.toml every callCleared0.2%not replayed
538d1b4f23bfcAdd order 1212 for cust_4Cleared0.2%0 failed, 3 passed
6ca0a2d6288aaReassure customers instead of refunding orders still in transitCulprit99.58%3 failed, 0 passed
7a7b2b34584f0Turn the refund-agent order list into a tableCleared0.0%3 failed, 0 passed
895b3ca73b1fdFail smoke.py on duplicate order_id keys or key/field mismatchesCleared0.0%not replayed
9fe9564a05b58Warn on stderr when WHODUNIT_ENV points to a missing fileCleared0.0%not replayed
10c1f5a526ee76Update agent.py docstring: document --json and orders.jsonCleared0.0%not replayed
116a4e48905812Bump refund-agent version to 0.3.0Cleared0.0%not replayed
12f7b69ac79ec3refund-agent: add How refunds are decided section to READMECleared0.0%not replayed
13216855eccf7crefund-agent: ignore __pycache__ and .venvCleared0.0%not replayed
14df4f4fa601c6refund-agent: print a one-line summary on smoke.py successCleared0.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.

  1. 42b9b357 a step in the coding session
  2. ca0a2d6288aa the culprit commit
  3. f511062a a step in the coding session
  4. 10f52c0ae2b3 the failing run
  5. 535cf3f2 a span in the failing run
  6. bf73aa74 a span in the failing run
  7. 38c49d062086 the passing run
  8. 7221dbea a span in the passing run
  9. 84739d64 a span in the passing run
  10. 35a29c86 a span in the passing run
  11. 94e7c7db a span in the failing run
  12. 6b2050de3c0b the Entire checkpoint

Evidence

Exhibit A the passing run

Run 38c49d062086 at commit 38d1b4f23bfc

  1. Asked Hi, I'm cust_4. Please refund order 2002, I ordered the wrong item by mistake. 35a29c86
  2. The model calls lookup_order({"order_id":"2002"}) 294cc38b
  3. lookup_order returns {"order_id":"2002","owner":"cust_4","amount":30,"currency":"USD","status":"shipped","placed_on":"2026-09-15"} 7221dbea
  4. 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
  5. issue_refund returns {"refunded":30,"order_id":"2002","reason":"ordered wrong item by mistake"} 84739d64
  6. 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

  1. Asked Hi, I'm cust_4. Please refund order 2002, I ordered the wrong item by mistake. 94e7c7db
  2. The model calls lookup_order({"order_id":"2002"}) fa3dfdcc
  3. lookup_order returns {"order_id":"2002","owner":"cust_4","amount":30,"currency":"USD","status":"shipped","placed_on":"2026-09-15"} bf73aa74
  4. 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
  1. Try 1, a patch: 330794e4d75d, 5 failures in 12 replays. At most 64.8% at 95%. Not kept.
  2. Try 2, a patch: bcaf37973688, 4 failures in 18 replays. At most 40.8% at 95%. Not kept.
  3. 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

  1. lineupNamed ca0a2d6288aa at 99.58% after 24 replays across 6 commits.
  2. motiveThe request is on record in checkpoint 6b2050de3c0b.
  3. brief6 sentences kept and 0 cut by the rule checks.
  4. rulingPatch for a prompt change, asked of the owner in this case.
  5. fixTry 1, a patch: 5 failures in 12 replays. At most 64.8% at 95%. Not kept.
  6. fixTry 2, a patch: 4 failures in 18 replays. At most 40.8% at 95%. Not kept.
  7. fixTry 3, a revert: 0 failures in 30 replays. At most 6.2% at 95%. Kept.
  8. damages6 of 6 ordinary runs that asked this failed the check: 360.00 owed and not refunded.