Skip to content

fix(session): keep running native Pi turns stoppable after reload - #2578

Merged
vastsa merged 2 commits into
vastsa:mainfrom
zszz3:fix/native-running-after-reload
Nov 28, 2026
Merged

vastsa merged 2 commits into
vastsa:mainfrom
zszz3:fix/native-running-after-reload

Conversation

@zszz3

@zszz3 zszz3 commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

问题

修复 #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 通过
  • desktop typecheck / lint / architecture 都通过
  • 真实客户端 E2E:本地假模型服务模拟一直不返回 → 刷新界面 → Stop 按钮出现 → 点 Stop → busy 消失 → 再发一条消息,能正常收到回复。修复前刷新后没有 Stop 按钮,和 issue 截图一致;修复后 4 项检查全部通过

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

@aiuo-codepilot aiuo-codepilot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@aiuo-codepilot aiuo-codepilot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@vastsa
vastsa merged commit 09400b2 into vastsa:main Nov 28, 2026
5 checks passed
zergfff added a commit to zergfff/PI-Desktop-fork that referenced this pull request Nov 30, 2026
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants