-
Notifications
You must be signed in to change notification settings - Fork 1.7k
fix: session restore crash causes white screen on conversation switch #1790
Copy link
Copy link
Closed
Description
Description
ACP session restore can bind a stale session to the wrong conversation, causing a renderer crash (white screen).
Context
User reported repeated white-screen crashes on Windows. Root cause analysis from logs:
- Session ownership mismatch:
conversationId → acpSessionIdmapping persists across conversation switches. When opening conversation B, the app restores a session that belongs to conversation A. - Unhandled protocol type:
user_message_chunkupdates from session restore fall to the default branch, logging warnings but allowing half-processed data into the renderer. - No crash circuit-breaker: After
render-process-gone, the main process continues sending to the dead renderer viawebFrameMain.send(), causingRender frame was disposederrors and permanent white screen.
Log Evidence
1. Session ID 和 Conversation ID 映射串了
日志中保存过两组关系:
L176:019d2d52-5561-75f0-9324-749f78e45a13 → conversation 98fcdba3L428:019d2d5c-0e41-7531-a856-38cb2bebc996 → conversation 89b03389
但崩溃前恢复的始终是旧 session:
[2026-03-27 11:56:23.087] [info] [ACP codex] session/load completed { sessionId: '019d2d52-5561-75f0-9324-749f78e45a13' }
而 Sentry breadcrumb 中当前窗口 URL 已是:
window.blur ... url: app:///out/renderer/index.html#/conversation/89b03389
当前窗口对应 89b03389,但恢复的是属于 98fcdba3 的旧 session。
2. 协议兼容层漂移
崩溃前重复出现:
[2026-03-27 11:56:23.080] [warn] Unknown session update type: user_message_chunk
[2026-03-27 11:56:23.080] [warn] Unknown session update type: user_message_chunk
[2026-03-27 11:56:23.082] [warn] Unknown session update type: user_message_chunk
user_message_chunk 已定义在 AcpSessionUpdate 联合类型中,但 AcpAdapter.convertSessionUpdate() 的 switch 未处理,落入 default 分支。
3. Renderer 崩溃三次,主进程无熔断
三次崩溃均为:
[2026-03-27 11:56:23.936] [error] [AionUi] render-process-gone: { reason: 'crashed', exitCode: -1073741819 }
-1073741819 即 Windows STATUS_ACCESS_VIOLATION (0xC0000005)。
崩溃后主进程继续向已死的 frame 发送消息:
[2026-03-27 11:56:27.802] [error] Error sending from webFrameMain: Error: Render frame was disposed before WebFrameMain could be accessed
at s.send (node:electron/js2c/browser_init:2:94445)
at b.send (node:electron/js2c/browser_init:2:78883)
at emit (app.asar/out/main/index.js:2475:23)
...
at AutoUpdaterService.broadcastStatus (app.asar/out/main/index.js:53733:12)
4. GPU 不是根因
已做过禁用 GPU、软件光栅、GPU 合成、Direct Composition 的启动实验,仍然复现同样的 render-process-gone。
5. 对照实验
- 原用户目录:白屏(有旧恢复数据)
- 新用户目录(
--user-data-dir指向干净目录):正常
同一版本 AionUi 1.9.1、Electron 37.10.3、Chromium 138.0.7204.251,唯一差异是旧目录有恢复数据。
Code Locations
| 问题 | 文件 | 行号 |
|---|---|---|
| session 恢复无归属校验 | src/process/agent/acp/index.ts |
createOrResumeSession() L1415 |
| session ID 持久化 | src/process/task/AcpAgentManager.ts |
saveAcpSessionId() L1148 |
user_message_chunk 未处理 |
src/process/agent/acp/AcpAdapter.ts |
convertSessionUpdate() L127 default |
| renderer 崩溃只打日志 | src/index.ts |
render-process-gone handler L317 |
| adapter emit 无 isDestroyed 防护 | src/common/adapter/main.ts |
emit() L31 |
Crash Chain
旧 session 恢复到错误 conversation
→ user_message_chunk 半处理进入 renderer
→ Chromium 138 native crash (ACCESS_VIOLATION)
→ render-process-gone
→ 主进程继续 webFrameMain.send() 到死 frame
→ 白屏,无恢复
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels