Repository navigation
fix(session): keep running native Pi turns stoppable after reload - #2578
Conversation
Native Pi turns run inside the sidecar and never enter the main process activeTurns map, so the session list reported no running native sessions. After a renderer reload while a native turn was still in flight (a stalled provider or a long retry), the composer showed "Native Pi session is read-only: busy." with no Stop button, leaving the session stuck until the app restarted. The session list now also reports native sessions whose summary says the turn can be stopped, so the reloaded renderer restores the running state and offers Stop. fixes vastsa#2575
There was a problem hiding this comment.
AIUO CodePilot · Preliminary review
Diff-only preliminary review: the sessionList change merges sidecar-native sessions with `capabilities.canStop === true` into runningSessionIds so a reloaded renderer can offer Stop, with a unit test covering busy, idle, and locked states. No evidenced behavioral defect was identified in the added lines; I could not run the app, tests, typecheck, or a live sidecar to verify runtime semantics, and the schema for sidecar capabilities is inferred from the patch and test fixture only.
No evidenced findings in the supplied diff.
Head: 3a26e8c
Base: 649c345
CI: success; mergeable: true.
Validation: code/tests NOT EXECUTED. Diff-only preliminary analysis; not approval. Human review and repository gates remain required.
There was a problem hiding this comment.
AIUO CodePilot · Preliminary review
Diff-only preliminary review: sessionList now adds sidecar Native Pi sessions whose summary capabilities.canStop is true to runningSessionIds, with a regression test covering busy/idle/locked sessions. No evidenced defect found on added lines; I could not run the harness, typecheck, or inspect surrounding session lifecycle semantics, so this is not approval.
No evidenced findings in the supplied diff.
Head: cbb829a
Base: 6214e55
CI: pending; mergeable: true.
Validation: code/tests NOT EXECUTED. Diff-only preliminary analysis; not approval. Human review and repository gates remain required.
Ported from vastsa/PI-Desktop v0.24.0-beta.7 (bug fixes only; the release's features were left for a later rebase): vastsa#2625 quarantine rejected outbox appends instead of retrying them forever vastsa#2574 settle live turns and tool rows when the sidecar dies mid-stream vastsa#2578 native Pi turns stay stoppable after a reload vastsa#2634 the task badge mirrors work that is still running vastsa#2639 let Arabic and Hebrew paragraphs choose their own side vastsa#2640 stop a renderer crash loop with one GPU-less relaunch, then a dialog vastsa#2642 reject differing spellings of one tool argument vastsa#2655 compaction summaries open on demand in the transcript
问题
修复 #2575。Native Pi 会话的运行在 sidecar 里,不会进入 main 进程的
activeTurns,所以sessionList返回的runningSessionIds里没有正在运行的 Native 会话。如果 Native 会话还在运行(比如模型一直不返回,或者正在重试)时刷新了界面,界面会以为这个会话没在运行:Stop 按钮和运行状态都不显示,只剩 "Native Pi session is read-only: busy.",输入框也一直锁着,只能重启 App 才能恢复。
修复
sessionList生成runningSessionIds时,额外加入 summary 里capabilities.canStop === true(也就是 sidecar 中这个会话的运行还没结束)的 Native 会话。刷新后界面能认出它在运行,Stop 按钮会重新出现,停止后 busy 消失,会话恢复正常。测试
apps/desktop/test/native-pi-sessions.test.mjs:去掉修复时失败,加上修复后通过;相关单测 26/26 通过