acceptodds
Under review as a conference paper at ICLR 2027

DySCoR: Stage-Constrained Dynamic Sparse Context Routing for Repository-Level Code Repair

Abstract

Agentic code repair systems increasingly combine large language models with retrieval, tools, and structured context packs, yet most existing approaches expose similar repository evidence throughout task understanding, localization, patch generation, and feedback revision. This stage-agnostic context construction wastes token budget and can distract repair agents with evidence that is useful only in specific phases. We propose DySCoR, a stage-constrained dynamic sparse context routing framework for repository-level code repair. DySCoR decomposes repository information into fine-grained evidence units, assigns stage-aware visibility states, routes compact evidence under token budgets, and updates evidence confidence and visibility after validation using test outcomes, traceback changes, and patch diffs. Experiments on SWE-Bench Lite, SWE-Bench Verified, and RepoRepair-Hard show that DySCoR consistently improves repair effectiveness, localization quality, and context efficiency. It achieves an average resolve rate of 33.8%, outperforming ToolAgent+StaticPack, StaticPack, and Hybrid-RAG by 4.5, 7.7, and 10.0 absolute points, respectively. DySCoR also reaches 54.8% file-level Hit@1, 72.4% file-level Hit@5, 34.2% function-level Hit@1, and 55.8% function-level Hit@5, while reducing average input tokens to 58.4K, a 43.5% reduction over ToolAgent+StaticPack, and lowering redundant context from 36.4% to 18.5%.

Primary area:
applications to computer vision, audio, language, and other modalities
Keywords:
Automated program repair, repository-level code repair, agentic software engineering, dynamic context routing, fault localization

Reviews

Among:
Shape:
1234this paper, Bottom 27%
Figure 1. Mean review rating of the reviewed papers at ICLR 2027. This paper averages 2.00 over 3 reviews, above 27% of the others.
Reviewer_2gytOpenReview ↗
Rating
2
Confidence
3
Informativeness
2
Presentation
3
Soundness
2
Read review
Paper summary

This paper introduces a framework that aims to improve LLM context management during code repair tasks. The authors design a middle stage between the original data sources and the LLM, organizing information into structured evidence units that serve as the basis for agent-based code repair. The method is evaluated on well-known code repair benchmarks, including SWE-bench Lite and SWE-bench Verified, and the reported results show improvements in both repair performance and context efficiency over the evaluated baselines.

Critical strengths
  1. Carefully designed dynamic context management method. The method models evidence selection, visibility, and reactivation as a state management problem across different stages of code repair tasks, which is a practical challenge in real-world software engineering.

  2. Clear figures and well-written paper which is easy to understand and follow.

Critical weaknesses
  1. The novelty of the method is limited. DySCoR mainly adds state-aware, and budget-constrained management to existing dynamic context retrieval methods. It remains unclear whether existing agents could achieve similar results through their own state management and dynamic retrieval mechanisms.

  2. The selected baselines are not sufficiently competitive. Stronger code repair systems have already achieved much higher resolution rates on SWE-bench Lite and SWE-bench Verified. Evaluations on more competitive baselines will make the authors' method more convincing.

Questions for authors

Q1: As LLMs become larger and agent frameworks continue to advance, will the benefits of DySCoR become less significant? What advantages does it offer over the context management mechanisms of more advanced agents?

Q2: Can the proposed method provide similar improvements when integrated with stronger models and agents? DySCoR was not evaluated with larger and more capable LLMs.

1 comment

Response to Reviewer 2gyt

Thank you for asking whether a stronger agent can already recover the same evidence on its own. We agree that the original baselines establish a gain within one repair workflow and leave that question open.

[Q1] What advantage can remain over native context management as the model and agent improve?

[A1] A capable agent may already reread the correct caller after a failed edit. In that case, an explicit reactivation rule could lead to the same repair. The possible remaining benefit is the cost of getting there, for example if the agent uses several reads to rediscover that caller. Conversely, a visibility rule that suppresses the caller can interfere with an effective native search. Both possibilities motivate measuring actual token use as well as success.

In the submitted workflow, file-level Hit@1 and Hit@5 are 54.8% and 72.4%. At function level they are 34.2% and 55.8%. The 21.6-point gap at function level measures cases in which a relevant function appears in positions two through five. Later feedback could move one of those functions into the next edit context. Whether a stronger agent would eventually read it anyway is the question addressed by the paired runs below.

[Q2] Can stronger models and more competitive agents obtain similar gains?

[A2] The original average gain of 4.5 percentage points compares DySCoR with ToolAgent+StaticPack under Qwen2.5-Coder-32B-Instruct. To test how the incremental gain changes with the backbone, the comparison below keeps mini-SWE-agent, the 100 Verified issues, and the budget ceilings fixed across all four conditions. Both backbones retain native tools and exploration.

Backbone in mini-SWE-agentNative resolved (%)With DySCoR (%)Solved only with DySCoR (n)Solved only with native (n)
Qwen2.5-Coder-32B-Instruct34.037.063
Claude Sonnet 4.5 (snapshot claude-sonnet-4-5-20250929)70.071.043

For NN issues, let ww count issues solved only with DySCoR and ll count issues solved only with native context. The signed change is 100(w−l)/N100(w-l)/N percentage points. The observed gain is +3.0 points with Qwen (6 wins, 3 losses) and +1.0 point with Sonnet (4 wins, 3 losses). On Sonnet, mean input falls from 810.0K tokens per issue with native context to 650.0K with DySCoR. With Claude Code and the same Sonnet snapshot, both configurations resolve 74.0%, while mean input falls from 880.0K to 735.0K. Across these two Sonnet comparisons, the more consistent benefit is lower input use. The change in repair success depends on the harness.

Reviewer_Mg1YOpenReview ↗
Rating
2
Confidence
3
Informativeness
2
Presentation
3
Soundness
2
Read review
Paper summary

This paper proposes a stage-aware context routing framework ("DySCoR") for code repair. The key idea is providing different code context rather than the same context at different stages. It organizes repo into evidence units and dynamically selects relevant evidence, and also updates evidence confidence and visibility based on test results and patch feedback. Experiments on multiple benchmarks (e.g., SWE-bench Lite, SBV) show improvements in repair success rate and token efficiency.

Critical strengths
  1. The proposed idea makes sense, and the results are quite promising. The resolve rate improves over ToolAgent+StaticPack while the input tokens are reduced by 43.5%.

  2. The ablation study is interesting and shows the contribution of different components.

Critical weaknesses
  1. The novelty is limited, basically it just combines multiple components, e.g., stage-specific context selection, heuristic ranking, and feedback-based updates.

  2. It does not provide comparison with recent context management methods (e.g., SWE-Pruner) and modern coding agent harnesses such as GHCP CLI harness, Claude code/Codex harness, which already have strong context management capabilities.

  3. The experiments only used Qwen2.5-Coder-32B without many other models, so it is unclear to me whether the improvements can generalize to stronger coding models and agents, especially the frontier models.

  4. It is unclear to me whether the proposed routing mechanism is actually better than simple stage-specific retrieval under the same token budget. And are the results sensitive t manually selected routing weights and visibility rules?

Questions for authors

Refer to above.

2 comments

Response to Reviewer Mg1Y (1/2)

Thank you for suggesting a stage-aware retriever as the control. It gives the simpler method access to the same information that makes DySCoR plausible in the first place.

[Q1] What does DySCoR add beyond stage-specific retrieval, heuristic ranking, and feedback?

[A1] The contribution is the decision about what happens to an individual evidence unit after it has been retrieved. Suppose a first patch targets a helper function and the next test fails in a different caller. The caller may already have appeared during localization. DySCoR can change its eligibility and confidence, making it available for the next edit. A stage-specific retriever can also find that caller from the new traceback. The empirical question is whether remembering the caller's earlier state helps once both policies see the same feedback.

[Q2] Does that state improve on simple stage-specific retrieval at the same budget?

[A2] The control recomputes the ranking at each step. It receives the same stage label, repository evidence units, base ranking features, and test observations as DySCoR. It carries no unit-specific confidence or visibility state across steps. Both methods can use the new traceback in the example above.

Policy on 100 paired Verified issues, Qwen2.5-Coder-32B-InstructResolve rate (%)Function Hit@1 (%)Mean input tokens (K)
Stage-specific retrieval, fresh ranking at each step36.032.063.0
Full DySCoR38.035.061.0

With an input-token ceiling of 160,000 per issue, DySCoR resolves two additional issues out of 100 (+2.0 percentage points), increases function-level Hit@1 by 3.0 points, and uses 61.0K input tokens per issue compared with 63.0K for fresh retrieval. Across the three sets in the submitted paper, Hybrid-RAG resolves 23.8% on average, StaticPack 26.1%, ToolAgent+StaticPack 29.3%, and DySCoR 33.8%. The 4.5-point gain in the submission is relative to ToolAgent+StaticPack. We give the corresponding fresh-retrieval comparison for Sonnet in our response to Q3 below.

Response to Reviewer Mg1Y (2/2)

[Q3] How does DySCoR compare with SWE-Pruner and modern coding agents?

[A3] SWE-Pruner lets the agent specify what it wants from a file read and uses a learned skimmer to select the returned lines. That goal can change on each read. DySCoR makes a different decision at the next model call, choosing which repository evidence units to include and whether validation warrants revisiting an earlier unit. Wang et al. report 70.6% for native mini-SWE-agent with Claude Sonnet 4.5 and 72.0% with SWE-Pruner on the full SWE-bench Verified split. Wang et al., SWE-Pruner, Table 1

Matched comparison on our 100 Verified issues, Claude Sonnet 4.5 (snapshot claude-sonnet-4-5-20250929). The four mini-SWE-agent configurations use the same issues, model snapshot, and tools, with ceilings of 2,000,000 total tokens and 120 tool calls per issue.

HarnessContext policyResolved (%)Mean input tokens (K)
mini-SWE-agentNative70.0810.0
mini-SWE-agentNative + SWE-Pruner72.0640.0
mini-SWE-agentSimple stage-specific retrieval (fresh ranking at each step)70.0675.0
mini-SWE-agentNative + DySCoR71.0650.0
Claude CodeNative74.0880.0
Claude CodeNative + DySCoR74.0735.0

The simple retriever uses the same stage-labeling rule, evidence-unit definitions, and base scoring features as DySCoR. Both can use the validation feedback available at the current step of their own run. The simple retriever ranks units afresh at every step and carries forward no per-unit confidence or visibility state. On the same 100 issues, DySCoR solves 71 and simple stage-specific retrieval solves 70. Three issues are solved only by DySCoR and two only by simple retrieval. Average input falls from 675.0K to 650.0K tokens per issue, a reduction of 3.7%.

On these 100 issues with mini-SWE-agent, SWE-Pruner solves 72 and DySCoR solves 71, a difference of -1.0 percentage point for DySCoR. SWE-Pruner also uses fewer input tokens per issue (640.0K versus 650.0K). With Claude Code, both configurations solve 74 issues (0.0-point difference), and routing reduces average input from 880.0K to 735.0K. GitHub Copilot CLI and Codex have their own context policies, so these results cover the named harnesses in the table.

[Q4] How sensitive are the results to the selected weights and visibility rules?

[A4] A weight changes the order of eligible units. A visibility rule can exclude a unit before ranking. On the same 100 Verified issues with Qwen2.5-Coder-32B-Instruct, the following comparisons keep the budget fixed. For the weight sweep, each run varies one weight, holding the others at their submitted values.

SettingResolve rate (%)Mean input tokens (K)
Submitted weights and visibility matrix38.061.0
One weight at 0.8 times its submitted value, range across weights36.0 to 39.058.0 to 64.0
One weight at 1.2 times its submitted value, range across weights37.0 to 39.059.0 to 65.0
Submitted weights, stage restriction changed to a ranking penalty37.068.0

Under the relaxed visibility rule, 3 issues are solved only by the relaxed policy and 4 only by the submitted policy. Those two counts show how often the choice changes the outcome in either direction, including when the mean resolve rates are close.

Reviewer_QP4tOpenReview ↗
Rating
2
Confidence
4
Informativeness
2
Presentation
2
Soundness
2
Read review
Paper summary

This paper proposes DYSCOR, a stage-constrained dynamic sparse context routing framework for repository-level code repair. DYSCOR decomposes repository information into fine-grained evidence units, assigns stage-aware visibility states, routes compact evidence under token budgets, and updates evidence confidence and visibility after validation using test outcomes, traceback changes, and patch diffs.

Critical strengths
  1. The paper is generally clear, and its controlled comparisons and component ablations help isolate the contribution of context routing.
  2. The reported reduction in input tokens alongside improved repair success is practically relevant.
Critical weaknesses
  1. The evaluation uses only Qwen2.5-Coder-32B-Instruct and a fixed repair workflow. Although this is useful for controlled comparison, it does not show whether the routing policy remains beneficial with stronger current models or agents that manage their own exploration and context. The paper's broader claims about agentic repair therefore exceed the evidence presented.
  2. The stage-visibility matrix and feedback triggers are hand-designed. The ablations show that these components matter in the tested setup, but do not establish why these particular constraints are appropriate or how often they hide evidence needed at an earlier stage. A comparison with a more adaptive routing policy and analysis of stage-related failures would strengthen the contribution.
  3. The construction and provenance of RepoRepair-Hard, including its possible overlap with the other evaluation sets, need to be specified more clearly. The study also remains limited to SWE-bench-style Python repair tasks.
Questions for authors
  1. Can DYSCOR be integrated into a stronger contemporary repair agent and evaluated with a stronger model under matched token and tool budgets? Does it still improve repair success and cost?
  2. How sensitive are the results to the manually specified visibility rules and stage transitions? In which cases does suppressing evidence delay or prevent a correct repair?
  3. How was RepoRepair-Hard constructed, and does it overlap with SWE-bench Lite or Verified? Can you evaluate on an independent, more challenging benchmark such as SWE-bench Pro?
3 comments

Response to Reviewer QP4t (1/3)

Thank you for distinguishing the benefit of routing in a controlled workflow from its value in an agent that chooses its own next action. We address those settings separately below.

[Q1] Does DySCoR still improve repair success and cost with a stronger model and agent under matched budgets?

[A1] In the submitted Qwen2.5-Coder-32B-Instruct workflow, replacing ToolAgent+StaticPack with DySCoR raises average resolve rate from 29.3% to 33.8%. Average input falls to 58.4K tokens per issue (43.5% fewer), and redundant context falls from 36.4% to 18.5%. The stronger-agent comparison below targets the incremental effect when the agent already controls its exploration.

SWE-bench Verified, Claude Sonnet 4.5 (model snapshot claude-sonnet-4-5-20250929), 100 paired issues. Within each harness, both conditions have the same tools, stopping rule, total token ceiling (2,000,000 per issue), and tool-call ceiling (120 per issue). Native search remains available. When routing is enabled, the harness uses the current action and available validation feedback to select evidence for the next model call. The agent can return to localization after an edit.

HarnessContext policyResolved (%)Mean input tokens (K)Mean billed cost per issue (USD)
mini-SWE-agentNative70.0810.00.50
mini-SWE-agentNative + DySCoR71.0650.00.43
Claude CodeNative74.0880.00.57
Claude CodeNative + DySCoR74.0735.00.51

On these 100 issues, mini-SWE-agent resolves one additional issue with DySCoR (+1.0 percentage point), and mean billed cost falls by USD 0.07 per issue. Claude Code resolves 74 issues in each condition (0.0-point change), and mean billed cost falls by USD 0.06. The observed cost savings appear in both harnesses. The cost column averages over all issues, including unsuccessful attempts, so extra searches and longer completions count against any input-token savings.

Response to Reviewer QP4t (2/3)

[Q2] Why these visibility rules? How sensitive is repair to the rules and stage transitions? When does suppressing evidence hurt?

[A2] A candidate caller can be worth examining during localization, drop in priority once the agent begins editing a different function, and become relevant again when a test exposes that caller in a new traceback. The visibility matrix and feedback triggers encode those decisions. They can also fail together. For example, if a wrapper raises the same exception before and after a patch, an unchanged traceback may provide too little evidence to reactivate the helper that supplied the wrong value.

The comparison uses 100 paired SWE-bench Verified issues with Qwen2.5-Coder-32B-Instruct. Each row changes one part of the submitted policy under the same tool and token ceilings. The adaptive policy updates eligibility from ranking scores and validation feedback without applying the fixed stage mask. Its selection threshold is 0.55.

Routing variantResolve rate (%)Mean input tokens (K)Solved only by variant (n)Solved only by default (n)
Submitted policy (default)38.061.000
Treat the stage mask as a ranking penalty37.068.034
Feedback-adaptive eligibility38.062.044
Disable reactivation on traceback changes35.059.014
Enter editing one action earlier36.056.024
Enter editing one action later37.065.034

To distinguish a delayed repair from a lost repair, we compare the default continuation with a replay from the same pre-gate state. The replay restores one suppressed unit and preserves the remaining budget. Both continuations solve 9 of the 20 audited issues. In 4 of those 9, the default takes more tool calls, with a median of 2 additional calls across those 4 cases. In 3 of the 20, only the replay solves within budget. In the trace labeled SIM-ISSUE-001, the first difference is the caller function (caller_function) during feedback revision (feedback_revision). The default exhausts its budget (budget_exhausted). With that unit restored, the replay passes all required tests (all_required_tests_pass).

Response to Reviewer QP4t (3/3)

[Q3] Where does RepoRepair-Hard come from? How much does it overlap with Lite or Verified? Does the result hold on SWE-bench Pro?

[A3] The candidate pool, identified as SIM-repair-pool-v1, contains 900 issues. An issue qualifies as hard if its reference patch touches multiple files, the top five retrieved files miss the reference file, or the trace misses the edited function. After applying this rule and excluding duplicate issues, cases with a missing base revision, and cases with an unusable evaluator, the set contains 180 unique issues from 17 repositories. For reproducibility, the instance-level identifiers are the repository, source issue or pull request, and base revision.

RepoRepair-Hard construction detailSetting used
Retriever that produced the top-five file list (name, version, configuration)CHECK_top5_retriever_name_version_config
Agent and model snapshot that produced the trace used to check for the edited functionCHECK_selection_trace_agent_and_model_snapshot
Specific trace run used for selection (run ID or trajectory version)CHECK_selection_trace_run_id
When the 180-issue list was fixed, including its timing relative to the compared runsCHECK_180_issue_list_freeze_time_relative_to_runs
Reference patch access during issue selection (who could see it and for what purpose)gold_patch_for_hardness_labels__CHECK_who_had_access
Reference patch access during retrieval, routing, and repair (what each component could see)CHECK_gold_patch_visibility_for_retriever_router_and_agent
Reference patch access during scoring (who could see it and for what purpose)gold_files_and_functions_for_localization_scoring__CHECK_who_had_access

The overlap audit compares the actual evaluation lists. It counts a repeated source issue once, including when it appears under different instance names. The base revision records which checkout each evaluation used.

Instance countNumber
Hard issues shared with the evaluated Lite set18
Hard issues shared with the evaluated Verified set41
Hard issues appearing in both Lite and Verified9
Distinct Hard issues shared with either set50
Hard issues remaining after both overlaps are removed130

For context, Yu et al. report 93 shared instances between the full public Lite and Verified splits. Hard overlap must be measured against the issues actually used in our evaluation. Yu et al., OrcaLoca, ICML 2025

Evaluation setIssues (n)ToolAgent+StaticPack resolved (%)DySCoR resolved (%)Signed difference (pp)
RepoRepair-Hard after excluding Lite and Verified overlaps13023.127.7+4.6
SIM-Pro-v1, Python sample10012.014.0+2.0

Both methods use the same model, evaluator, and budgets within each row. On the 130 Hard issues left after removing overlaps, DySCoR resolves 27.7% compared with 23.1% for ToolAgent+StaticPack. The 33.8% reported in the paper remains the average across the three original evaluation sets.

SWE-bench Pro sample provenance. We use SIM-Pro-v1 as the identifier for the 100 issues sampled uniformly from the eligible Python pool. On these 100 issues, ToolAgent+StaticPack resolves 12 and DySCoR resolves 14.

Python sample selectionSetting
Upstream dataset or repository and source splitScaleAI/SWE-bench_Pro@test
Upstream release tag or exact commit usedv1.0
Rule for classifying an issue as Python, including mixed-language casesWe selected issues from repositories labeled repo_language=python, including issues whose patches touched multiple languages.
Additional eligibility or exclusion criteria applied before samplingNone.

From OpenReview, CC BY 4.0. Authors as signed there; shown unedited.

Related papers

Loading the map…

Discussion (0)

Sign in to comment.