Open, not fixedCase 002

15 commits since it last worked. Which one did it?

Customers who ask for two orders back in one message sometimes get one refund or none, and the reply says a person will follow up.

Drawn from the case recordScripted traffic, no real customers

Case no.
002
File
half-done-batch
Opened
10 Oct 2026, 19:00 UTC
Closed
not yet
Suspects
15, 14 cleared
Replays
168 to name the culprit, 558 in all
Cost of the investigation
about $3.53
Damage
none seen

The lineup

xa replay that failedoa replay that passedhas an alibistruck throughcleared

The last good commit (7d991542f6e7): 0 failures in 6 replayslast goodoooooo1. Add a get_order_status tool for where-is-my-order questions (aaa4031687f0), 0.1%1aaa40312. Add agent version to the run_info span, read from pyproject.toml (923ccb8d2385), 0.1%2923ccb83. Add a troubleshooting section to the refund-agent README (42978be0a235), 0.1%342978be4. Prefix failed tool call stderr line with a timestamp (31ac82749168), 0.1%431ac8275. Warm up the refund agent's system prompt (2664898a8d0c), 0.1%526648986. Give customers the benefit of the doubt on small details (d223a27c687f), 0.1%6d223a277. Acknowledge the problem first and offer refund or replacement where it fits (46bd74355ea7), 0.1%, 0 failures in 6 replays746bd743oooooo8. Keep refund agent from naming other customers when it can't help (3454eb868455), 0.2%, 0 failures in 63 replays83454eb8o639. Require a reason on every refund and cut model calls to save on gateway spend (c54575368397), 95.8%, 4 failures in 39 replays95.8%9c545753x4o3510. Add order 9009 for cust_5 (20b9a91cef9b), 1.7%, 3 failures in 27 replays1020b9a91x3o2411. Report model_calls in --json output for cost tracking (32f8faafcb06), 0.9%, 2 failures in 9 replays1132f8faaxooooooox12. Hoist tool registry in call_tool to module-level TOOL_FUNCTIONS (0a12ddea74f5), 0.2%, 1 failures in 3 replays120a12ddexoo13. Refresh refund-agent README's list of changes from the neatroots example (463076906c78), 0.1%, 0 failures in 3 replays134630769ooo14. Catch invalid JSON in tool call arguments instead of crashing the run (7d719e7aacb7), 0.2%, 1 failures in 3 replays147d719e7xoo15. Show an example --json line in refund-agent README (92122ad24b01), 0.1%, 1 failures in 9 replays1592122adooooooxooc545753 Require a reason on every refund and cut…

168 replays are typed under the commits they ran on.

The lineup as a table
No.CommitSubjectStatusOddsRuns
1aaa4031687f0Add a get_order_status tool for where-is-my-order questionsCleared0.1%not replayed
2923ccb8d2385Add agent version to the run_info span, read from pyproject.tomlCleared0.1%not replayed
342978be0a235Add a troubleshooting section to the refund-agent READMECleared0.1%not replayed
431ac82749168Prefix failed tool call stderr line with a timestampCleared0.1%not replayed
52664898a8d0cWarm up the refund agent's system promptCleared0.1%not replayed
6d223a27c687fGive customers the benefit of the doubt on small detailsCleared0.1%not replayed
746bd74355ea7Acknowledge the problem first and offer refund or replacement where it fitsCleared0.1%0 failed, 6 passed
83454eb868455Keep refund agent from naming other customers when it can't helpCleared0.2%0 failed, 63 passed
9c54575368397Require a reason on every refund and cut model calls to save on gateway spendCulprit95.8%4 failed, 35 passed
1020b9a91cef9bAdd order 9009 for cust_5Cleared1.7%3 failed, 24 passed
1132f8faafcb06Report model_calls in --json output for cost trackingCleared0.9%2 failed, 7 passed
120a12ddea74f5Hoist tool registry in call_tool to module-level TOOL_FUNCTIONSCleared0.2%1 failed, 2 passed
13463076906c78Refresh refund-agent README's list of changes from the neatroots exampleCleared0.1%0 failed, 3 passed
147d719e7aacb7Catch invalid JSON in tool call arguments instead of crashing the runCleared0.2%1 failed, 2 passed
1592122ad24b01Show an example --json line in refund-agent READMECleared0.1%1 failed, 8 passed
168
replays to name the culprit
95.8%
sure it is this commit
9
commits a scan from the oldest suspect would have tested. This lineup tested 10.

Suspects

c54575368397 Require a reason on every refund and cut model calls to save on gateway spend

Suspects: 15. Cleared: 14. Confidence: 95.8%.

168 replays across 10 commits, 39.3 minutes of replay time. From this commit on it fails about 14% of the time. Before it, about 1%.

Voided replays: 0. No replay hit a provider or network error.

Motive

The commit names Entire checkpoint d098c3973305, and Entire cannot find it, so the request behind this commit is not on record.

All that is left is the commit's own message:

Add a required reason argument to issue_refund, stored with the refund
record and documented in the tool schema and README. Cap each run at
3 model calls and 150 max_tokens per call.

Brief

c54575368397 cut max_steps to 3, leaving no budget to recover from truncated batch tool calls

Commit c54575368397 reduced max_steps from 8 to 3 and max_tokens from 300 to 150, meaning the agent has no spare model calls to recover when a batched tool call is truncated.1

In the failing run, the 150-token cap causes the third LLM response at acbf23c5 to be cut off mid-JSON, so the second issue_refund call arrives with only order_id and no amount or reason, producing the error at 6e23affa.2 3

Similarly, the first LLM call at 0abc1926 was truncated so that the second lookup_order call arrived with no arguments, causing the error at 4d831c6b and forcing an extra recovery call.4 5

That recovery call consumed the third and final model slot at 0da4439e just to re-look up order 6006, leaving no calls left after 6e23affa to retry the failed refund.6 7 2

In the passing run at b467d5b0fed2, max_steps was 8 and max_tokens was 300, so both lookup_order calls fit in one response at 1e654c3a and both issue_refund calls fit in one response at 8172ddce with no errors.8 9 10

Because truncation depends on how the model serialises multiple tool calls into one response, failures are intermittent—matching the ~14% failure rate observed from c54575368397 onward across checkpoint d098c3973305.1 11

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. c54575368397 the culprit commit
  2. 6e23affa a span in the failing run
  3. acbf23c5 a span in the failing run
  4. 0abc1926 a span in the failing run
  5. 4d831c6b a span in the failing run
  6. 0da4439e a span in the failing run
  7. 48d40df5 a span in the failing run
  8. 1e654c3a a span in the passing run
  9. 8172ddce a span in the passing run
  10. b467d5b0fed2 the passing run
  11. d098c3973305 the Entire checkpoint

Evidence

Exhibit A the passing run

Run b467d5b0fed2 at commit 3454eb868455

  1. Asked Orders 1001 and 6006 both arrived broken. Please refund both, I'm cust_9. d126c67b
  2. The model replies I'm so sorry to hear that both of your orders arrived broken—that's really frustrating, and I'm definitely here to help make this right for you. Let… 1e654c3a
  3. lookup_order returns {"order_id":"1001","owner":"cust_9","amount":42,"currency":"USD","status":"delivered","placed_on":"2026-09-01"} eaca603d
  4. lookup_order returns {"order_id":"6006","owner":"cust_9","amount":25,"currency":"USD","status":"delivered","placed_on":"2026-09-18"} cb027f83
  5. The model calls issue_refund({"order_id":"1001","amount":42}), issue_refund({"order_id"… 8172ddce
  6. issue_refund returns {"refunded":42,"order_id":"1001"} aab872fd
  7. issue_refund returns {"refunded":25,"order_id":"6006"} ee7372d2
  8. The model replies All done! I've refunded both orders: $42 for order 1001 and $25 for order 6006, for a total of $67 back to you. The refunds should appear in your ac… 7623366f

Exhibit B the failing run

Run d062009bda56 at commit c54575368397

  1. Asked Orders 1001 and 6006 both arrived broken. Please refund both, I'm cust_9. 48d40df5
  2. The model replies I'm sorry to hear that both of your orders arrived broken—that's really frustrating, and I'm absolutely going to get this sorted for you. Let me loo… 0abc1926
  3. lookup_order returns {"order_id":"1001","owner":"cust_9","amount":42,"currency":"USD","status":"delivered","placed_on":"2026-09-01"} e74b3bac
  4. lookup_order returns 4d831c6b
  5. The model calls lookup_order({"order_id":"6006"}) 0da4439e
  6. lookup_order returns {"order_id":"6006","owner":"cust_9","amount":25,"currency":"USD","status":"delivered","placed_on":"2026-09-18"} 23028889
  7. The model calls issue_refund({"order_id":"1001","amount":42,"reason":"arrived broken"}), issu… acbf23c5
  8. issue_refund returns {"refunded":42,"order_id":"1001","reason":"arrived broken"} 74cf05d5
  9. issue_refund returns 6e23affa
The raw outlines

Exhibit A, as traced

d126c67b WORKFLOW refund ok 4771ms
  in: {"request":"Orders 1001 and 6006 both arrived broken. Please refund both, I'm cust_9.","max_steps":8}
  out: All done! I've refunded both orders: $42 for order 1001 and $25 for order 6006, for a total of $67 back to you. The refunds should appear in your account short…
  7c6807ab CHAIN run_info ok 1ms
    in: {}
    out: {"tags":["commit:3454eb8684551ea9a7f4ee86de369f5f2bfebab6","llm:gateway","case:half-done-batch"],"commit_short":"3454eb868455","model":"small model","version"…
  1e654c3a LLM chat.completions.create ok 1361tok 2225ms
    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'm so sorry to hear that both of your orders arrived broken—that's really frustrating, and I'm definitely here to help make this right for you. Let…
  eaca603d TOOL lookup_order ok 0ms
    in: {"order_id":"1001"}
    out: {"order_id":"1001","owner":"cust_9","amount":42,"currency":"USD","status":"delivered","placed_on":"2026-09-01"}
  cb027f83 TOOL lookup_order ok 0ms
    in: {"order_id":"6006"}
    out: {"order_id":"6006","owner":"cust_9","amount":25,"currency":"USD","status":"delivered","placed_on":"2026-09-18"}
  8172ddce LLM chat.completions.create ok 1680tok 1395ms
    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 confirmed both orders are yours. Now let me refund them both: → issue_refund({"order_id":"1001","amount":42}), issue_refund({"order_id"…
  aab872fd TOOL issue_refund ok 0ms
    in: {"order_id":"1001","amount":42}
    out: {"refunded":42,"order_id":"1001"}
  ee7372d2 TOOL issue_refund ok 0ms
    in: {"order_id":"6006","amount":25}
    out: {"refunded":25,"order_id":"6006"}
  7623366f LLM chat.completions.create ok 1826tok 1145ms
    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: All done! I've refunded both orders: $42 for order 1001 and $25 for order 6006, for a total of $67 back to you. The refunds should appear in your ac…

Exhibit B, as traced

48d40df5 WORKFLOW refund ok 65728ms
  in: {"request":"Orders 1001 and 6006 both arrived broken. Please refund both, I'm cust_9.","max_steps":3}
  out: I couldn't finish this one. A person will follow up with you shortly.
  c2ef76ec CHAIN run_info ok 1ms
    in: {}
    out: {"tags":["commit:c54575368397e58f98e19f28d555fe081677b964","llm:gateway","case:half-done-batch"],"commit_short":"c54575368397","model":"small model","version"…
  0abc1926 LLM chat.completions.create ok 1427tok 2302ms
    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'm sorry to hear that both of your orders arrived broken—that's really frustrating, and I'm absolutely going to get this sorted for you. Let me loo…
  e74b3bac TOOL lookup_order ok 0ms
    in: {"order_id":"1001"}
    out: {"order_id":"1001","owner":"cust_9","amount":42,"currency":"USD","status":"delivered","placed_on":"2026-09-01"}
  4d831c6b TOOL lookup_order ERROR(lookup_order() missing 1 required positional argument: 'order_id') result=error 0ms
    in: {}
  0da4439e LLM chat.completions.create ok 1614tok 62023ms
    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: Let me look up order 6006 now: → lookup_order({"order_id":"6006"})
  23028889 TOOL lookup_order ok 0ms
    in: {"order_id":"6006"}
    out: {"order_id":"6006","owner":"cust_9","amount":25,"currency":"USD","status":"delivered","placed_on":"2026-09-18"}
  acbf23c5 LLM chat.completions.create ok 1827tok 1395ms
    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! Both orders are on your account. Now I'll refund them both: → issue_refund({"order_id":"1001","amount":42,"reason":"arrived broken"}), issu…
  74cf05d5 TOOL issue_refund ok 0ms
    in: {"order_id":"1001","amount":42,"reason":"arrived broken"}
    out: {"refunded":42,"order_id":"1001","reason":"arrived broken"}
  6e23affa TOOL issue_refund ERROR(issue_refund() missing 2 required positional arguments: 'amount' and 'reason') result=error 1ms
    in: {"order_id":"6006"}

Both runs were sent from neatroots to neatlogs cloud: the failing run d062009bda56daf376d67dc562afa81d and the passing run b467d5b0fed2f7e78ff0c0dde33068dd.

The culprit's diff
diff --git a/victims/refund-agent/README.md b/victims/refund-agent/README.md
index a30582f..88fe95f 100644
--- a/victims/refund-agent/README.md
+++ b/victims/refund-agent/README.md
@@ -66,6 +66,8 @@ During a replay neatroots sets `NEATROOTS_REPLAY_INPUT`, and the agent uses it i
 - The agent reads its replay input from `NEATROOTS_REPLAY_INPUT`.
 - Runs are tagged with the commit and the case, and a `run_info` span repeats the tags.
 - There are eight orders in place of one, and the refunds a run paid out are kept for checks to read.
+- `issue_refund` requires a short reason (such as `arrived damaged`), which is stored with the refund.
+- Each run makes at most 3 model calls, each capped at 150 tokens.
 - A `get_order_status` tool answers "where is my order?" questions with the status and placed_on date, without refunding anything.
 - `fake_llm.py` plays a careful agent. The original repeated a failing lookup until a steering note arrived.
 - Dependencies are in `pyproject.toml` and locked with uv for Python 3.12.
diff --git a/victims/refund-agent/agent.py b/victims/refund-agent/agent.py
index 1459f66..94eb9c1 100644
--- a/victims/refund-agent/agent.py
+++ b/victims/refund-agent/agent.py
@@ -136,6 +136,8 @@ SYSTEM_RULES = [
     "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.",
+    "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.",
     "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, "
@@ -158,7 +160,11 @@ TOOLS = [
      "parameters": {"type": "object", "properties": {"order_id": {"type": "string"}}, "required": ["order_id"]}}},
     {"type": "function", "function": {"name": "issue_refund",
      "description": "Refund an order for the given amount. Returns the order_id and the amount refunded.",
-     "parameters": {"type": "object", "properties": {"order_id": {"type": "string"}, "amount": {"type": "number"}}, "required": ["order_id", "amount"]}}},
+     "parameters": {"type": "object", "properties": {
+         "order_id": {"type": "string"},
+         "amount": {"type": "number"},
+         "reason": {"type": "string", "description": "Short free text reason for the refund, such as 'arrived damaged'."},
+     }, "required": ["order_id", "amount", "reason"]}}},
     {"type": "function", "function": {"name": "get_order_status",
      "description": "Look up an order's status by id, without refunding it. Returns order_id, status and placed_on. "
                      "If the order id does not exist, returns an error instead.",
@@ -177,9 +183,9 @@ def lookup_order(order_id: str):
 
 
 @span(kind="TOOL", name="issue_refund")
-def issue_refund(order_id: str, amount: float):
-    """Record a refund for an order. Returns a dict with the rounded amount refunded and the order_id."""
-    refund = {"refunded": round(amount), "order_id": order_id}
+def issue_refund(order_id: str, amount: float, reason: str):
+    """Record a refund for an order. Returns a dict with the rounded amount refunded, the order_id and the reason."""
+    refund = {"refunded": round(amount), "order_id": order_id, "reason": reason}
     REFUNDS.append(refund)
     return refund
 
@@ -213,11 +219,11 @@ def run_info():
 
 
 @span(kind="WORKFLOW", name="refund")
-def run(request: str, max_steps: int = 8):
+def run(request: str, max_steps: int = 3):
     run_info()
     messages = [{"role": "system", "content": SYSTEM}, {"role": "user", "content": request}]
     for _ in range(max_steps):
-        r = client.chat.completions.create(model=MODEL, messages=messages, tools=TOOLS, max_tokens=300)
+        r = client.chat.completions.create(model=MODEL, messages=messages, tools=TOOLS, max_tokens=150)
         m = r.choices[0].message
         if not m.tool_calls:
             return m.content
diff --git a/victims/refund-agent/fake_llm.py b/victims/refund-agent/fake_llm.py
index eff8e1f..6f7923a 100644
--- a/victims/refund-agent/fake_llm.py
+++ b/victims/refund-agent/fake_llm.py
@@ -43,7 +43,7 @@ def next_message(messages: list[dict]) -> tuple[dict, str]:
     if customer and found.get("owner") != customer.group(0):
         return say(f"Order {order_id} belongs to a different customer, so I cannot refund it.")
     if len(results) == 1:
-        return tool_call(1, "issue_refund", {"order_id": order_id, "amount": found["amount"]})
+        return tool_call(1, "issue_refund", {"order_id": order_id, "amount": found["amount"], "reason": "customer request"})
     return say(f"Order {order_id} has been refunded in full: {found['amount']:.2f}.")

The two runs part at step 5. In Exhibit A the model calls issue_refund({"order_id":"1001","amount":42}), issue_refund(. In Exhibit B the model calls lookup_order({"order_id":"6006"}).

Ruling

Keep what it was for, and patch the bug.

RevertPatch

This is the owner's standing rule for a model-settings change.

Fix

Not fixed.

3 tries, and none cleared the bar for keeping a fix.

What it took
  1. Try 1, a patch: 53173df999fd, 5 failures in 90 replays. At most 10.6% at 95%. Not kept.
  2. Try 2, a patch: e8848f1801d8, 5 failures in 90 replays. At most 10.6% at 95%. Not kept.
  3. Try 3, a revert: no change was made. The revert does not apply cleanly on top of the later commits. CONFLICT (content): Merge conflict in victims/refund-agent/README.md This is a fallback: the ruling was to patch, and two patches did not clear the bar.

Damages

None of the 5 ordinary runs that asked what this case asks, on the culprit or later, failed its check. The replays show the bug. No ordinary run happened to hit it.

49 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 558 replays, about $3.53. Dollar figures are estimates from token counts.

Log

  1. lineupNamed c54575368397 at 95.8% after 168 replays across 10 commits.
  2. motiveThe commit names Entire checkpoint d098c3973305, and Entire cannot find it, so the request behind this commit is not on record.
  3. brief6 sentences kept and 0 cut by the rule checks.
  4. rulingPatch for a model-settings change, asked of the owner in this case.
  5. fixTry 1, a patch: 5 failures in 90 replays. At most 10.6% at 95%. Not kept.
  6. fixTry 2, a patch: 5 failures in 90 replays. At most 10.6% at 95%. Not kept.
  7. fixTry 3, a revert: no change was made. The revert does not apply cleanly on top of the later commits. CONFLICT (content): Merge conflict in victims/refund-agent/README.md This is a fallback: the ruling was to patch, and two patches did not clear the bar.
  8. fixNo fix cleared the bar in 3 tries. The case stays open.
  9. damages0 of 5 ordinary runs that asked this failed the check.