def _launch_process(task: dict, sid: str, model: str, cwd: str, codebuddy_path: str) -> dict:
"""启动 codebuddy 进程,登记到 RUNNING 并开始后台 drain。"""
if session_exists(sid):
- cmd = [codebuddy_path, "--model", model, "--resume", sid]
+ # 近期 codebuddy 在交互式 pty 下仅传 --resume 时会报"No conversation found"而退出;
+ # 必须 --session-id 与 --resume 同时传才能可靠恢复会话。
+ cmd = [codebuddy_path, "--model", model, "--session-id", sid, "--resume", sid]
else:
cmd = [codebuddy_path, "--model", model, "--session-id", sid]
# 注入“修改前先确认”的行为准则,使每个会话自带该纪律