Skip to content

fix(desktop): preserve plugin crash diagnostics - #766

Merged
vastsa merged 2 commits into
mainfrom
fix/pr-756-crash-report
Sep 21, 2026
Merged

vastsa merged 2 commits into
mainfrom
fix/pr-756-crash-report

Conversation

@vastsa

@vastsa vastsa commented Sep 21, 2026

Copy link
Copy Markdown
Owner

基于 PR #756 的修复版,包含原始提交并修复审查发现的问题:

  • stdout/stderr 按流缓冲,按真实换行保留最近 3 行;退出时 flush 未换行尾部。
  • Windows 负退出码统一为无符号值,并在审计与 plugin 日志中带 exitCodeHex。
  • 增加多行 chunk、无换行 flush、Windows hard-fault exit code 回归测试。

验证:

  • JS build:通过
  • desktop typecheck:通过
  • lint:通过
  • docs:check:通过
  • plugin-services.test.mjs:17/17 通过
  • plugin-* 测试:323 通过;plugin-work-panel-views.test.mjs 因 worktree 缺少 src/components/workpanel/WorkPanel.tsx 在收集阶段失败
  • test:e2e:supervision:环境缺少 Electron binary,未能启动

zhangqingkun976 and others added 2 commits September 21, 2026 11:24
A report could only ever say `plugin host process exited: <id>`: the runtime
already had the process's exit code but kept it in the audit record, so the
sentence a user can paste carried no diagnosis at all (issue #747 was exactly
that line, with no logs).

- The exit code now reaches the load error, the `failed` service state, the
  `plugin.crash` audit record and the `plugin` log channel. On Windows a hard
  fault (0xC0000005 and friends, which Electron delivers as a negative signed
  int) and a plugin's own `process.exit(1)` are different bugs; the code is
  printed with its unsigned hex form so both readings agree.
- The plugin's newest output line rides with it. The runtime keeps the last
  three stdout/stderr lines per plugin (each bounded at 400 characters) and
  quotes the newest in the load error and the audit record, because a plugin
  that died on a thrown error usually printed the reason first. Every line still
  lands in the audit thread as `plugin.stdio`.
- Nothing new is persisted and no permission, API or protocol surface changes.

The fixture in `plugin-services.test.mjs` now writes a line to stderr before
exiting, and asserts the exit code on the service state and both the code and
the stderr line on the crash audit record.
Copilot AI lite review requested due to automatic review settings September 21, 2026 03:41

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@vastsa
vastsa merged commit ec944a7 into main Sep 21, 2026
4 of 5 checks passed
@vastsa
vastsa deleted the fix/pr-756-crash-report branch September 21, 2026 03:48

This branch had an error being deployed

1 failed deployment
Preview — 9c89b931 Deployed Sep 21, 2026 by vercel[bot]
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.

3 participants