fix: reclaim idle remote runtimes and retire replaced agents

Remote tasks could leave idle Runtime processes behind, and replaced Agent
installations lacked a drain-and-exit lifecycle. Keep the current Agent
resident, let displaced Agents finish existing work and reconnect for its
results, then retire them without restarting obsolete installations.

Reclaim Runtime processes when their last active task finishes, preserve
pending questions and shared active tasks, and restore conversation history
when the next turn starts. Remove the Remote Projects technical preview label
from settings, errors, tests, and current documentation; the feature remains
disabled by default.

Validation recorded during implementation: 213 lifecycle tests and 28 focused
UI/IPC tests passed, as did SettingsPanel and lint. Linux x64 real-Host checks
used 8 provider requests. Broader tests and final typecheck encountered
unrelated concurrent changes; details and coverage limits are documented.

Release note: 远程任务结束后自动释放空闲运行进程,下一轮对话恢复历史;更新后的旧 Agent 等待已有任务完成再退出,当前 Agent 保持常驻。远程项目移除“技术预览”标识,仍默认关闭。
This commit is contained in:
mesalogo
2026-09-23 17:37:14 +08:00
parent cdd573778c
commit 83a48a4079
29 changed files with 402 additions and 63 deletions
@@ -231,8 +231,9 @@ Agent 当前 Runtime installation + 兼容配置
竞争读取同一 stdout。消息和 permission 按 sessionId 分派给 binding 的当前 operation。
- `AgentAcpConnection` 统一连接级握手、stdio 解码与退出监听,Prompt
生命周期仍留在 binding。同一 Session 串行,其他 Session 不等待它完成。
- `closeAcpChannel`、取消和 release 只释放所属 binding/Session;最后一个 binding
离开后空闲 60 秒关闭进程。关闭 Session 时等待原生 `closeSession` 和原始 Prompt
- `closeAcpChannel`、取消和 release 只释放所属 binding/Session;以活动 operation
判断共享进程是否空闲,最后一个任务结束即回收,不因历史 binding 保留进程。
待答问题仍占用活动 operation。关闭 Session 时等待原生 `closeSession` 和原始 Prompt
结算,不等待排在 backend 控制队列后面的完成回调。只有原生控制面不响应时才有界
终止共享进程,并向其余请求报告中断,不声称这类故障可以逐 Session 隔离。
- terminal 与物理进程状态分开:取消/失败的 Session 也可返回