]> acesimba.cloud Git - codebuddy-web.git/commitdiff
fix: 修复会话恢复失败(No conversation found,进程秒退)
authorCodebuddy <codebuddy@localhost>
Tue, 1 Sep 2026 08:25:52 +0000 (16:25 +0800)
committerCodebuddy <codebuddy@localhost>
Tue, 1 Sep 2026 08:25:52 +0000 (16:25 +0800)
codebuddy 近期在交互式 pty 下,仅传 --resume <sid> 会报
"No conversation found with session ID" 并 exit 1,导致任务一启动就退出。
必须 --session-id <sid> 与 --resume <sid> 同时传才能可靠恢复会话。

- _launch_process 的 resume 分支改为同时传 --session-id 与 --resume
- 现象上表现为"切换模型后进不去":换模型会重启进程,重启时暴露该 resume 失败

Co-Authored-By: CodeBuddy <noreply@codebuddy.ai>
backend/app.py

index 76fb73b1adbe8e1f7c12cba5992eafaca3f6116b..35055434dbf03a2c5228cdb4ad5e62bdd5ec8f90 100644 (file)
@@ -388,7 +388,9 @@ def _load_agent_guidelines() -> str:
 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]
     # 注入“修改前先确认”的行为准则,使每个会话自带该纪律