Apply to my task
arXiv:2610.28834 ★ 89 Oct 20, 2026

Information, Not Reruns: What to Give a Stuck Agent So It Finally Fixes the Code

Key result

The paradox: nearly all strong models ask to run the tests and read what failed 95–100% of the time. That’s the weakest of the three resources. The spec for a stuck agent method lets you fix code faster when the agent is going in circles and keeps editing something next to the bug. Instead of one more test run, give a short description in two blocks: WHERE to change and WHAT should happen. On its own, “where” gives nothing, “what” gives about half the effect, and together they give the whole effect.

01

TL;DR

This study shows where to spend the next step when a coding agent gets stuck. There are three options: “think some more” (compute), “here’s what the code should do” (information), and “run the tests and see what failed” (feedback). The authors tested each option on its own and in every combination, on the exact same broken states. What helps most by far is a description of the required behavior: what exactly the code should do and where to change it.

Agents don’t behave the way that would help them. Nearly all strong models ask to run the tests and read what failed 95–100% of the time, even though that’s the weakest of the three resources. Picking blindly would, on average, deliver more value. “Think longer” helps weak models but does almost nothing for strong ones: they’ve already squeezed everything they can out of reasoning. Code dug up by search doesn’t help at all. Neither does off-topic text of the same length: content matters, not volume.

The practical takeaway: when an agent is going in circles, don’t ask it to run the tests again. Stop it and hand it a short spec. It has two blocks: where to change things (files and functions) and what should happen (the cause of the bug, the required behavior, edge cases). On its own, “where” gives you nothing, “what” gives you about half the effect, and together they give you the whole thing.

Want this for your own case? Apply this study to your task: AI adapts its method to what you are working on and writes the prompt.

02

Method Blueprint

Here’s how the study works. The method is called BRA (Banzhaf Resource Attribution, i.e. breaking down each resource’s contribution):

STEP 1: Take a “frozen” failed state of the agent (task + wrong code)
STEP 2: Clone it into 8 copies — every combination of three resources:
        think (C) / get information (I) / run tests (F)
STEP 3: In every copy — the same single final code edit
STEP 4: Measure the share of hidden tests that pass → contribution of each resource
        on its own and paired with the others
STEP 5: Separately: let the model pick a resource itself and compare with the real benefit

You don’t need to replicate this design. What you need is the practical conclusion:

Agent is stuck
  → NOT “run the tests again” and NOT “think longer”
  → Give it: WHERE to change + WHAT should happen (behavior, cause, edge cases)
  → One edit based on that description
03

Example in Practice

Task: You’re a developer on a Django online store. For the third time, the agent in Claude Code is trying to fix the shipping calculation: free shipping on orders over $50 is checked against the total before the promo code is applied. The test test_free_shipping_after_promo fails. The agent keeps rerunning it and changing something nearby each time.

Prompt:

Stop. Don’t run the tests again and don’t try random edits.
Here is a description of what should happen.

WHERE to change:
- file orders/services/delivery.py, function calculate_delivery_cost()
- called from orders/views.py → CheckoutView.get_context_data()

WHAT should happen:
- Cause of the bug: the free-shipping threshold ($50) is compared
  against cart.subtotal, i.e. the total before the discount.
- Required behavior: the threshold is compared against the total AFTER
  the promo code is applied. A $55 cart with a -$10 promo code = $45 → shipping
  is paid ($5.99).
- Edge cases:
  1) total after the promo code is exactly $50 → shipping is free;
  2) 100% promo code → total is $0, shipping is paid;
  3) no promo code → behavior doesn’t change.

Make one edit based on this description. Then show the diff
and briefly explain how it covers each edge case.

Result: The agent stops trying random edits and makes one targeted edit in the specified function. The reply includes the diff and a walkthrough of the three edge cases. If the spec is right, the test passes on the first try. If it isn’t, you’ll immediately see the gap between your description and what the agent understood.

04

Why It Works

The weakness. After a failure, the agent doesn’t know what it doesn’t know. Running the tests only gives it the fact that “it failed” plus a chunk of output. It sees a symptom, not a requirement. So it edits code around the symptom and burns turns for nothing. “Think some more” adds no data: the model ponders the same set of facts. Searching the repo brings back a lot of code but doesn’t say what in it should change.

The strength. If the model is told plainly what behavior is required and where to change it, it writes the actual code well. What it lacks isn’t skill but knowledge of the goal. That’s why information keeps its value even for the strongest models, while the value of reasoning drops almost to zero.

How the method exploits this. The spec fills exactly the missing piece: both what and where. The two parts complement each other. A location without understanding the cause gives nothing, the cause without a location gives about half, and both together give the full effect.

Control knobs: - The “where” block (files, functions) → drop it if the location is obvious, but never send it alone. - The “what” block (cause, behavior) → the most important part: it delivers most of the effect. - Edge cases → add them for functions with conditions and thresholds. In the function-level part of the study, the spec included an input–output contract and edge cases. - Length → don’t pad it. Off-topic text of the same length had no effect. Every line should carry a requirement. - “One shot” → ask for one edit based on the description, not an endless loop. That’s how the study did it: exactly one final revision.

05

Prompt Template

Stop. Don’t run the tests again and don’t try random edits.
Below is a description of what should happen.

WHERE to change:
- {files and functions that need to change}

WHAT should happen:
- Cause of the problem: {why it doesn’t work right now — in your own words, no ready-made code}
- Required behavior: {what the code should do — with 1–2 examples using concrete numbers}
- Edge cases: {2–3 cases where it’s easy to get wrong, and the correct result for each}

Make one edit based on this description. Show the diff and briefly explain
how it covers each edge case.

What to fill in: - {files and functions} — where the problem lives. If you don’t know, ask the agent to first show which functions are involved in the scenario. - {cause} — an explanation of “what’s really going on,” not a ready-made patch. In the study, the description didn’t name specific files or variables; it described behavior. - {required behavior} — ideally with real-world numbers: “$55 cart, -$10 promo code → …”. - {edge cases} — thresholds, zero, empty input, “exactly on the boundary.”

For the agent’s instructions file (CLAUDE.md / AGENTS.md) — this is my adaptation, not wording from the paper:

If a test is still failing after two attempts:
1. Don’t run the same test a third time.
2. Spell out exactly what you don’t know about the required behavior
   (where to change it? what’s the correct result? which edge cases?).
3. Ask me those questions and wait for a description.
06

Limitations

⚠️ The spec in the study is perfect: the authors wrote it from the reference fix, checking what behavioral information delivers at best. The authors explicitly call the top rungs of the ladder “instruments,” not something the system could obtain on its own. Your spec will be less precise, and a wrong description can lead the agent astray. The paper didn’t measure that risk.

⚠️ Code only: it was tested on Python tasks: functions from MBPP+ and HumanEval+ and fixes in SWE-bench repositories. Carrying it over to writing, analysis or other areas is still a guess.

⚠️ Models without hidden reasoning: all models ran without a built-in “thinking” mode. On models with long internal reasoning, the value of “think more” may turn out differently.

⚠️ Feedback isn’t useless across the board: they only measured a report on public tests, up to five failing cases, and one edit after it. Detailed feedback in real work, where the agent runs the program many times, may behave differently. But the “tests only” choice consistently lost in the study.

⚠️ One edit only: the agent edited once, with no loops. How it all plays out over a long chain of turns, the paper doesn’t test.

⚠️ The paper text was truncated: some results (token economics, a full cost comparison of the resources, the arguments about greedy allocation) aren’t visible in the available excerpt. The conclusions above rely on what’s there.

07

How They Studied It

The idea was simple: instead of comparing whole agents, freeze the moment of failure and see what would actually have helped. The authors took 194 failed functions (first attempts by the small Qwen3-4B model on MBPP+ and HumanEval+) and 126 failed agent fixes on SWE-bench Verified. Each failed state was cloned into 8 copies: every combination of “think / get information / run tests.” Then the same single final edit ran in every copy. Results were checked against hidden tests that never made it into the prompt.

This made it possible to separate the value of the resource itself from side effects like “well, you just made one more edit.” To check whether content matters, they added a placebo: neutral text of the same length. It delivered roughly zero. Information was broken into rungs: repo search, location only, behavior only, and the full spec. That produced a surprising picture: search and “location only” didn’t help, “behavior only” gives about half, and both parts together give the full effect.

Six models (from Qwen3-4B to GPT-5.6 and Claude Sonnet 4.5) showed a common pattern: for weak models, “think” was worth 0.13 in share of tests passed; for the strongest, about 0.01. The value of information drops less (0.06–0.14). On the 24 hardest states, where every model failed, information delivered 0.12–0.25 for each. The decline in the overall sample is explained by a “ceiling”: strong models more often solve tasks without help.

Next, the authors let four strong models choose a resource themselves. Three of the four picked feedback almost every time and got less benefit than random choice would have given. The study pre-registered the hypothesis that the resources reinforce each other, and the data didn’t support it. The resources mostly substitute for each other: 21 of 36 pairwise interactions are significantly negative, and none are significantly positive. In other words, you don’t need several “crutches” at once: the most valuable one is enough.

08

Adaptations and Extrapolations

🔧 Technique: forbid “run it again” → fewer wasted turns

Add this to the start of your message to the agent: “Don’t run the tests until you’ve described in your own words what behavior should result.” This forces the agent to articulate the missing knowledge first. This is my adaptation; the paper has no such trick.

🔧 Technique: strip ready-made names from the description → describe behavior

The authors required the behavior block not to name specific files, functions or variables. It described the cause and the required behavior. Stick to this: that way you give the substance, not a ready-made patch, and the agent doesn’t blindly copy the hint.

Extrapolation: a question instead of picking a resource. If the agent itself asks to “run the tests,” that’s a sign it doesn’t know what you want. Swap its choice for a question (my idea, not measured):

Before proposing the next step, answer three questions:
1) What behavior is expected here? Did I describe it clearly enough?
2) Where in the code does the behavior need to change?
3) Which edge cases are missing from my description?
If you can’t answer any of these — ask me instead of running the tests.
09

Resources

  • Paper: Where Should a Stuck Agent Spend Its Next Tokens? Causal Attribution of Inference-Time Resources (NeurIPS 2026, Long-Context Foundation Models workshop).
  • Authors: Saiyue Lyu, Jerrold Huang, Yunbei Zhang, Janet Wang, Zhenting Wang, Yingqiang Ge, Haibo Zhang. Universities: University of British Columbia, University of Toronto, Tulane University, Rutgers University, Kyushu Institute of Technology.
  • Data: MBPP+ and HumanEval+ (EvalPlus), SWE-bench Verified.
  • Method foundation: the Banzhaf value from cooperative game theory, Möbius decomposition for interactions between resources.

Research digest

Key result

The paradox: nearly all strong models ask to run the tests and read what failed 95–100% of the time. That’s the weakest of the three resources. The spec for a stuck agent method lets you fix code faster when the agent is going in circles and keeps editing something next to the bug. Instead of one more test run, give a short description in two blocks: WHERE to change and WHAT should happen. On its own, “where” gives nothing, “what” gives about half the effect, and together they give the whole effect.

Principle

Don’t rerun the tests and don’t ask it to “think more.” Stop and give the agent knowledge of the goal. The researchers froze the agent’s failed state and cloned it into 8 copies. Each got its own combination of three resources: think, get information, run tests. Then they all made the same single final edit. Information about the required behavior won. A test only shows the fact that “it failed” plus a chunk of output. The agent sees a symptom, not a requirement. “Think more” adds no data; the model ponders the same set of facts. Searching other code in the repo didn’t help at all. Think of a navigator and a driver. The test says “you went off the road.” The spec says “turn left in 200 yards.” What the agent lacks isn’t the skill to write code, but knowing what exactly the result should be.

Why it works

A strong model knows how to write code. What it lacks is knowledge of the goal. That’s why information stays useful even for the strongest models. Their value from reasoning drops almost to zero: whatever can be squeezed out of thinking, they’ve already squeezed. For weak models, “think longer” still helps. Another finding: off-topic text of the same length doesn’t help. Content works, not volume: every line should carry a requirement. Picking a resource blindly would on average deliver more than the agents’ habit of asking for tests. Agents pick the worst option on their own.

When to apply

Coding agents (Claude Code, Cursor and the like) → fixing bugs when the agent has already run the same test 2–3 times. Especially good for functions with thresholds, conditions and edge cases. There you can see right away where the agent misunderstood the requirement. NOT a fit if you yourself don’t know what the correct behavior is. A wrong description can lead the agent astray. The study didn’t measure that risk. Only Python tasks (MBPP+, HumanEval+, SWE-bench) and models without a built-in “thinking” mode were tested. Carrying it over to other languages and areas is still a guess.

Mini recipe

1. Break the loop: tell the agent “stop, don’t run the tests and don’t try random edits.” 2. Say where: the file and function to change. If you don’t know, ask the agent to first show the functions involved in the scenario. 3. Name the cause: in your own words, why it doesn’t work right now. Don’t paste a ready-made patch. 4. Describe the required behavior: with 1–2 examples using real numbers. For example, “$55 cart, −$10 promo code → ...”. 5. Add 2–3 edge cases: zero, empty input, “exactly on the boundary.” Give the correct result for each. 6. Limit it to one edit: ask for the diff and a brief explanation of how it covers each case. In the study there was also exactly one edit. 7. For lasting protection: add a rule to the agent’s instructions file (CLAUDE.md or AGENTS.md). After two failed attempts, the agent doesn’t run the test a third time but asks you questions: where to change, what’s the correct result, which edge cases exist. This is my adaptation; the paper has no such wording.

Examples

[BAD]: `The test test_free_shipping_after_promo is still failing. Run it again and see what’s wrong.` [GOOD]: `Stop. Don’t run the tests again and don’t try random edits. WHERE to change: orders/services/delivery.py, function calculate_delivery_cost(), called from CheckoutView.get_context_data(). WHAT should happen: cause of the bug — the $50 free-shipping threshold is compared against the total before the promo code. It should be compared against the total after the promo code: a $55 cart with a −$10 promo code = $45, shipping is paid, $5.99. Edge cases: 1) exactly $50 after the promo code — shipping is free; 2) 100% promo code — total is $0, shipping is paid; 3) no promo code — behavior doesn’t change. Make one edit based on this description. Show the diff and briefly explain how it covers each edge case.`

In plain words

When an AI coding agent gets stuck on a bug, making it “think one more time” or rerun the tests forever is flushing tokens down the drain. The model simply doesn’t understand what it doesn’t know. A failing test only shows it a symptom; it doesn’t reveal the original intent. So the agent thrashes around the codebase, rewrites neighboring lines and botches the same spot again and again.

It’s like sending an intern to fix a broken machine without handing over the blueprints. The kid pokes a screwdriver wherever, sparks are flying, and he goes: “okay, it’s sparking on the left, so let me whack it with a hammer on the right.” The intern sees that it’s broken but has no clue how the thing is supposed to work normally.

The researchers took this dead end apart with a method called BRA (Banzhaf Resource Attribution). They compared three resources: letting the model think, feeding it the test trace, or giving it a description of the required behavior. The third option won by a mile. To get the agent out of the loop, it doesn’t need failure logs; it needs a concrete spec: exactly what logic the system expects and exactly where to change it.

The experiment was run on code, but the principle is universal for any autonomous system. If an agent is spinning its wheels on a spreadsheet, a report or data parsing, there’s no point writing "try again" or rubbing its nose in the error. Targeted task context beats raw compute and blind feedback every single time.

Bottom line: stop hoping the model will “figure it out on its own” if you feed it a red test log. Stop pointing the agent at symptoms — give it the reference behavior. One clear paragraph describing the business logic will save you hours of debugging while everyone else burns their budget on endless edit loops.

AI lab assistant

Apply this study to your task

Describe what you're working on. AI takes the method and the measured results from this paper and adapts them to your case, or writes a ready prompt built on them.

Based on Information, Not Reruns: What to Give a Stuck Agent So It Finally Fixes the Code arXiv:2610.28834

Sign in to apply this study New accounts get 50 free credits.