Repository navigation
fix(sessions): 停止请求失败时保留运行状态 - #2225
Conversation
远端连接失败并不能确认会话已停止,原 finally 无条件清除运行状态会隐藏仍运行的会话。请求成功后才更新停止状态,错误继续交给调用方处理并允许重试。 Refs vastsa#1990
There was a problem hiding this comment.
AIUO CodePilot · Preliminary review
Diff-only preliminary review: `abortSession` now clears running state only after a successful `api.abort`, preserving state and propagating errors on failure; new test and EN/zh-CN spec updates match the stated intent. No concrete defect is evidenced on added lines from this diff alone. Verification limits: no repository access, no test execution, and no validation of surrounding slice/terminal-event behavior outside the patch.
No evidenced findings in the supplied diff.
Head: 3717ef3
Base: ab56bfe
CI: pending; mergeable: true.
Validation: code/tests NOT EXECUTED. Diff-only preliminary analysis; not approval. Human review and repository gates remain required.
vastsa
left a comment
There was a problem hiding this comment.
独立审查通过,验证对象为 3717ef3。
在 main ab56bfe 上运行新增回归,停止请求拒绝后 running 错误变为 false;候选通过。停止、terminal ownership 及可见状态测试 18/18,通过 Desktop tsc --noEmit 和 diff-check。
额外通过真实 Electron BrowserWindow 渲染 ProjectDeleteDialog,使用生产 useAppStore/abortSession,仅控制 API 外部边界:点击确认后拒绝停止,错误回调触发且不删除项目、运行状态保留;再次点击成功停止后清除状态并完成一次删除。Electron 用户路径通过,未连接真实远端。本次修复作用于项目删除调用的 abortSession,聊天输入框另有 abort 路径,不扩大修复声明。
实际 merge ref 3312af5 父提交为当前 main ab56bfe 与该 head,树与已验证候选一致;六项远端 CI 成功。移除 finally 的改动范围最小,失败不再伪造停止确认,成功和权威结束路径保持原行为。
会话 Stop 的 API 请求失败时,
abortSession的 finally 仍无条件清除运行标记。远端断连会因此把未确认停止的会话显示为已停止。仅在 Stop 请求成功后清除标记,失败保留最后已知状态并传播错误,用户可以重试;权威 terminal event 路径保持原行为。
验证:旧代码回归错误清除 running 状态,修复后拒绝请求保持运行、重试成功清除状态。Stop/terminal ownership 共 13 项与 Desktop TypeScript 检查通过;真实生产 slice、仅 API 边界受控。未连接真实远端或运行完整 Electron E2E。基线 ab56bfe,候选 3717ef3。
Refs #1990。修复失败停止请求的一种误显示路径,不声称覆盖该综合报告全部性能/子代理问题。