ReTerm: Recovery Training for Self-Improving Terminal Agents

Wei Xie, Kaituo Feng, Shiming Fu, Yong Liu, Xiangyu Yue +1 more
10/13/2026
cs.AIcs.LGcs.SE
rlhf-rlvr-dpo

Official code: twothsnd/ReTerm (22 stars, Python, last commit 2026-10-14).

Abstract

Terminal agents have shown strong abilities in complex coding tasks. However, they often struggle to recover from errors during long-running execution (e.g., command errors, faulty implementations), eventually leading to task failures.

Show full abstract

To this end, we present ReTerm, a self-improving terminal agent trained by learning how to recover from its own failed terminal tasks. To support its training, we construct a customized data pipeline and produce ReTerm-10K, a high-quality dataset that provides effective recovery demonstrations for SFT cold start. Furthermore, we propose ReTerm-GRPO, an online RL algorithm that forks from the agent's own failure states to generate multiple independent self-recovery attempts. By learning from whether these attempts successfully complete the task, the agent self-improves through its own recovery experience. Built on Qwen3.5-9B, our ReTerm-9B achieves 34.8% Pass@1 on Terminal-Bench 2.0, improving over the base model by 14.6 points. Further analysis shows that our method achieves consistently higher recovery rates across diverse error categories compared with standard GRPO training. All code, data and model are released at https://github.com/twothsnd/ReTerm.

View on arXivView PDF

Code Implementations(1)

twothsnd/ReTermOfficial100%

Training terminal agents to recover from failed executions

220Python, ShellOct 6, 20261 months ago

Similar Papers

Cite this paper

@article{xie2026reterm,
  title  = {ReTerm: Recovery Training for Self-Improving Terminal Agents},
  author = {Wei Xie and Kaituo Feng and Shiming Fu and Yong Liu and Xiangyu Yue and Shuangjia Zheng},
  year   = {2026},
  eprint = {2610.18484},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2610.18484v2}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2610.18484.svg)](https://codeofpaper.com/paper/2610.18484)

Discussion