Switch-SWE:编码代理在未完成任务间切换时能保持专注吗?

·

研究论文 · 2026/11/04

软件开发会话常涉及多个未完成任务,而非单一问题贯穿始终。编码智能体在仓库级开发中需要在中间工作后恢复先前任务的需求和部分进展。现有仓库级基准通常只评估单一问题到补丁的片段,未直接衡量智能体能否在同一仓库中推进其他未完成任务后恢复任务。我们提出Switch-SWE,一个用于交错未完成任务会话中焦点任务恢复的基准,每个任务有持久化检出。每个焦点任务在匹配的连续和切换会话中评估,焦点要求和可执行验证器相同。切换会话交错同一仓库中其他未完成任务的按序阶段,仅最终焦点补丁被评分。Switch-SWE包含来自19个Python仓库的200个焦点任务,从问题、拉取请求和审查历史重建,并呈现为400个匹配的会话规范。在7个编码智能体上,交错未完成工作导致平均焦点任务解决差距为11.5个百分点,范围从6.0到15.0个百分点。轨迹分析识别出跨任务需求混淆和任务状态丢失是常见的恢复行为。我们引入一个插件式上下文管理模块,选择任务相关历史并维护简洁的任务状态摘要。在OpenCode上,该模块在评估模型中使同仓库任务切换下的焦点任务完成率提高5.5至15.5个百分点。代码见github.com/Miraclecsc/Switch-SWE。

该研究填补了仓库级基准中任务切换恢复能力的评估空白,揭示了编码智能体在真实多任务环境中的关键缺陷,并提供了有效的上下文管理解决方案,对提升智能体实际开发效率有直接意义。

Software development sessions often involve several unfinished tasks rather than one issue carried through to completion. As coding agents take on repository-level development, they need to recover an earlier task's requirements and partial progress after intervening work. Existing repository-level benchmarks typically score one issue-to-patch episode and do not directly measure whether an agent can resume a task after advancing other unfinished work in the same repository. We introduce \ourmethod, a benchmark for focus-task resumption in sessions that interleave unfinished tasks drawn from the same source repository, with a persistent checkout for each task. Each focus task is evaluated in matched uninterrupted and switched sessions with identical focus requirements and executable verifiers. The switched session interleaves ordered stages from other unfinished tasks in the same repository, while only the final focus patch is scored. \ourmethod~contains 200 focus tasks from 19 Python repositories, reconstructed from issue, pull-request, and review histories and rendered as 400 matched session specifications. Across 7 coding agents, interleaved unfinished work produces an average focus-task resolution gap of 11.5 percentage points, ranging from 6.0 to 15.0 percentage points. Trajectory analysis identifies cross-task requirement confusion and loss of task state as recurrent resumption behaviors. We introduce a plug-in context-management module that selects task-relevant history and maintains concise task-state summaries. On OpenCode, the module improves focus-task completion under same-repository task switching by 5.5 to 15.5 percentage points across the evaluated models. Code is available at github.com/Miraclecsc/Switch-SWE.

阅读原文

参与讨论