让AI Agent学会从失败中吸取经验,自动配置代码仓库运行环境。
SetupX: Can LLM Agents Learn from Past Failures in Functionality-Correct Code Repository Setup?

- 构建可自我演化的经验单元,跨项目复用已验证的修复方案。
- 通过回滚栈实现多步尝试与安全恢复,解决状态不可逆问题。
- 分离验证证据收集与判断,精准区分环境问题与代码缺陷。
功能正确的仓库配置旨在正确设置执行环境(如依赖项、构建脚本),以成功运行仓库文档中的功能。由于存在多种仓库特有的失败情况,包括依赖冲突、工具链缺失、安装不完整和验证策略不匹配,该任务极具挑战性。现有大语言模型代理在稳健解决这些问题方面表现不佳,尤其无法支持(1)跨仓库经验迁移,(2)在不可逆状态变化下的多步试错修复,以及(3)对配置结果的鲁棒验证,难以区分配置引发的失败与仓库本身存在的缺陷。为此,我们提出基于经验学习的配置框架SetupX。首先,构建自演化经验表示(XPU),一种双模态知识单元,编码配置信号、文本指导和可执行操作,动态传递已验证的环境修复方案至未见过的仓库。其次,采用基于后进先出Docker快照栈的经验增强推测执行,使代理能主动尝试修复并安全回滚至已知良好状态。第三,引入检察官-法官验证协议,将证据收集与最终判断分离,实现超越表面构建指标的更可靠验证。在精心设计的基准测试上,SetupX达到最高性能(如92%通过率),优于最强基线超过19%。关键在于,SetupX在需协调多个相互关联服务的复杂多仓库配置任务中表现卓越。代码仓库见:https://github.com/OpenDataBox/SetupX。
原文摘要 · Abstract (English)
Functionality-correct repository setup aims to configure execution environments (e.g., dependencies, build scripts) to successfully execute a repository's documented features. It presents significant challenges due to diverse, repository-specific failures, including dependency incompatibilities, missing toolchains, incomplete installations, and verification-strategy mismatches. Existing LLM agents struggle to robustly resolve these issues, specifically failing to support (1) cross-repository experience transfer, (2) multi-step trial-and-repair under non-invertible state changes, and (3) robust verification of setup outcomes to distinguish setup-induced failures from repository bugs. To address this, we introduce SetupX, an experiential learning-based setup framework. First, we construct a Self-Evolving Experience Representation (XPU), a dual-modality knowledge unit encoding setup signals, textual guidance, executable actions to dynamically transfer verified environment fixes to unseen repositories. Second, we employ Experience-Augmented Speculative Execution backed by a LIFO Docker snapshot stack, enabling the agent to proactively trial fixes and safely roll back to known-good states. Third, we introduce a Prosecutor-Judge Verification Protocol that separates evidence collection from final judgment, enabling more reliable setup verification beyond superficial build-time metrics. Evaluation results on carefully-crafted benchmarks show SetupX achieves highest performance (e.g., 92% pass rate) and outperforms the strongest baseline by over 19%. Crucially, SetupX excels in complex multi-repository setup requiring coordinating multiple interconnected services across different containers. The code repository is available at https://github.com/OpenDataBox/SetupX.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。