SWE-smith command timeouts leave child processes running

未关闭
#697 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 3 天内回复

@liuzhengyang699 已经在做这个了。

开始于 2026年11月6日。

  • #698 来自 @liuzhengyang699 —— 未关闭

评估

难度
4/5
预计耗时
1-2 天
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
停滞
技术栈
python
领域
backend, testing

调研方向

Find smith_agent._run() and inspect how it launches bash -c with a timeout. Start by reading the existing subprocess tests, then run the two regressions described in the issue: a foreground shell with descendants and descendants that keep captured pipes open. Done means timed out commands terminate their process group while preserving exit code 124 and the existing timeout message.

由索引模型根据 Issue 内容生成。

描述

smith_agent._run() executes bash -c with subprocess.run(timeout=...). On timeout, Python kills the shell process, but its child commands can survive. The helper returns exit code 124 while those commands continue modifying /testbed during later turns or evaluation. The final pytest evaluation uses the same helper, so its worker processes can also outlive the evaluation timeout.

I reproduced this on bc3a9e8 with a temporary Python command that waits and then writes a marker:

# slow_command.py
from pathlib import Path
import time

time.sleep(2)
Path("late-write").write_text("command still running")

Calling _run("python slow_command.py && echo done", timeout=1) reports a timeout after about one second, but late-write appears afterward. The && keeps the shell as a separate parent. A background child can also hold the captured output pipes open after the shell exits.

Expected behavior: timing out an agent command should terminate its process group before the next action begins, while retaining the existing timeout message and exit code 124.

A focused POSIX fix and real subprocess regressions are ready. Two original regressions fail on main: foreground shell → child → grandchild, and descendants holding pipes after the shell exits. Additional tests cover normal output/status, a process-group exit race, startup failure, and discarded non-UTF-8 timeout output.

This was found during a follow-up audit of the coding example with AI assistance, which was also used for the fix and review. The reproduction uses temporary local files and CPU subprocesses; it does not run a SWE-smith dataset rollout.

主要语言
Python
星标
18.9k
派生
1.7k
平均合并
5 天 18 小时
30 天内合并 PR
12

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

microsoft/agent-lightning 的其他 Issue

查看 microsoft/agent-lightning 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。