Skip to content

A team of long-lived bots for DeepSeek Harness, with main bots, bot-to-bot messages and group chats.

Show an uncaught main-process error on the failure page, not a native box

AdamPlatin123783bd4c40d97
diff --git a/app/src/main.mjs b/app/src/main.mjs
index fd6b5899..877223dd 100644
--- a/app/src/main.mjs
+++ b/app/src/main.mjs
@@ -210,6 +210,13 @@ if (canonical !== undefined) {
// A second launch shows the window that is showing: the start window until the hand-off
// (also after a failed start), then the team window, built anew when it is gone.
app.on('second-instance', () => { if (!startWindow.focus()) shell.open() })
+ // An error that nothing caught would get Electron's own message box (start-window §7: nothing
+ // native). Until the team window shows, the failure page says it; after that it is logged, and
+ // the team goes on.
+ process.on('uncaughtException', (error) => {
+ if (startWindow.revealed) console.error(error)
+ else void fail(error)
+ })
app.on('before-quit', (event) => {
if (copying !== undefined) {
// A copy is under way: it stops at a safe point, and the app goes on meanwhile.
diff --git a/app/src/start-window.mjs b/app/src/start-window.mjs
index 8cab7d66..5e8df4e2 100644
--- a/app/src/start-window.mjs
+++ b/app/src/start-window.mjs
@@ -343,6 +343,9 @@ export class StartWindow {
/** Settles once the team window has shown at a hand-off. */
get teamShown() { return this.#teamShown }
+ /** Whether the team window has shown at this start's hand-off. */
+ get revealed() { return this.#revealed }
+
/** Opens the window, unless one is open, with a fresh state for this kind of start. */
open(kind) {
if (this.#open()) return
diff --git a/app/test/main-uncaught.test.mjs b/app/test/main-uncaught.test.mjs
new file mode 100644
index 00000000..ffb3ca0e
--- /dev/null
+++ b/app/test/main-uncaught.test.mjs
@@ -0,0 +1,26 @@
+// An error that nothing in the main process caught: Electron would show its own message box.
+// Before the hand-off the start window's failure page says it instead, and no box opens. The
+// Electron parts and the Host are test doubles: no display, no DSH, no data of the user.
+import assert from 'node:assert/strict'
+import { test } from 'node:test'
+import { app, state } from './helpers/fake-electron.mjs'
+import { messageBoxes, startApp, startState, startWindows, waitFor } from './helpers/app-harness.mjs'
+import { installHooks } from './helpers/register.mjs'
+
+await installHooks()
+
+test('an error nothing caught shows the failure page, not a message box', async () => {
+ const before = new Set(process.listeners('uncaughtException'))
+ await startApp()
+ await waitFor(() => startWindows().length === 1, 'open the start window')
+ // The app's own listener (the test runner has one too, which must not see this error).
+ const listener = process.listeners('uncaughtException').find(entry => !before.has(entry))
+ assert.ok(listener, 'the app listens for uncaught errors')
+ listener(Object.assign(new Error('EACCES: permission denied, open \'state.json\''), { code: 'EACCES' }))
+ await waitFor(() => startState()?.view === 'failed', 'show the failure page')
+ assert.equal(startState().failure.reason, 'permission')
+ assert.deepEqual(messageBoxes(), [], 'no message box')
+ assert.equal(state.dialogs.length, 0, 'no dialog of any kind')
+ app.quit()
+ await waitFor(() => state.tray?.destroyed === true || startWindows().every(win => win.destroyed), 'end the app')
+})
diff --git a/docs/plans/2026-10-26-start-window.md b/docs/plans/2026-10-26-start-window.md
index b8460d3a..cecf60bf 100644
--- a/docs/plans/2026-10-26-start-window.md
+++ b/docs/plans/2026-10-26-start-window.md
@@ -232,6 +232,7 @@
- 提示行淡出。
- 纸面变成恢复卡:一句发生了什么(原因)、一句该怎么办(小字,按原因写:没有写入权限「换一个能写入的位置,或者给这个文件夹写入权限后重试。」,空间不够「清理出一些空间后重试,或者换个位置。」,程序文件不完整「重新安装 DeepSeek Bot 后再打开。」,找不到放数据的文件夹(移动硬盘没插上)「插上那块硬盘,或者把文件夹放回原处后重试。」,引擎停下和其他「先重试一次;还不行,就复制详细信息去反馈。」)、五个按钮、「详细信息」。卡片没有鲸鱼的第一行。数据文件夹建不出来、写不进去时红的是第一段,引擎起不来或者 Host 退出时红的是引擎那段。水塘缩小上移,圆环在卡片上面(第 2 节)。
- 焦点移到〔重试〕。窗口不隐藏。
+- 主进程里没人接住的错误也走这一页:交接以前和启动失败一样变成恢复卡,不弹 Electron 自己的错误框;交接以后只记进日志,团队照常用。启动窗口从头到尾没有系统的消息框和错误框。
- 〔复制详细信息〕点过后,按钮上的字变成「已复制」,1.6 秒后变回来。复制的是版本、平台、原因和最后 200 行日志。
- 〔保存日志…〕打开挂在启动窗口上的系统保存框(默认文件名 `DeepSeek-Bot-log.txt`),把同样的开头和最后 5000 行日志写进选的文件;取消就什么都不做。失败页、「团队界面没有加载出来」、180 秒的卡和复制失败的卡上都有这两个按钮,代替原来的〔打开日志文件夹〕。「详细信息」最多展开 168 px,日志在框里滚动。
- 有新版本时:
@@ -413,6 +414,7 @@
- 2026-11-01(待维护者确认):动画只有一个来源。启动窗口的卡片和团队窗口里代替系统对话框的卡片(`app/src/page-card.css`)用同一组颜色和弹簧,都由 `scripts/start-assets.mjs` 从插件的 `themes.js` 和 `motion.js` 生成:卡片出现走 `SPRING_SHAPE`,收起用启动窗口卡片的退场(下沉 6 px、缩到 .975、模糊 3px,.16 s),减少动态效果时只淡入 .12 s、淡出 .16 s(第 9 节)。导入的几张卡(第 6 节)由主进程的 `import-flow.mjs` 发快照,页面照旧只按快照画。
- 2026-11-01 交接的露面:在桌面应用里录了交接(真的 Electron 44、真的 `StartWindow`、替身团队页、ffmpeg 60 帧录屏),看到三个问题:长大用 `cubic-bezier(.2,.7,.2,1)`,前 40% 就走完了大半,窗口很早看着就长完了,鲸鱼落下后在一大块空的深色窗口里等 200 多毫秒;主窗口用 `show()` 露面时 Windows 自己的打开过渡压在启动窗口上,有一两帧整窗发灰、鲸鱼和头像错开成两个,然后深色一下跳成浅色;长大前 160 ms 的等待让鲸鱼停在跳的最高点。改成:主窗口在 `ready()` 时就以不透明度 0 显示在启动窗口下面(打开过渡看不见地走完,也不卡长大的第一步);长大 `handoffShow` + 40 ms 开始,260 ms,缓入缓出;鲸鱼长到位 60 ms 后落下,主进程等 `handoffDone` 才让主窗口变成不透明,再把启动窗口 180 ms 淡出,鲸鱼化进头像。减少动态效果和页面没发 `handoffShow` 时不长大,同样淡出。依据:录屏前后对比(首次启动就绪到主窗口露出 1.24 秒带一帧发灰,变成 1.09 秒开始淡、1.29 秒淡完;以后的启动 0.58 秒开始);启动窗口的单元测试(主窗口在 `ready()` 时透明地显示在下面、等落下或 300 ms、淡出后才给焦点、失败时收回)。Mica 窗口用 `setOpacity` 淡出在 Windows 11 上正常。
- 2026-11-02 复制没有停止按钮:圆环下那个停止复制的小按钮看着像留下的一个点。用户定的:「取消终止复制按钮」。第 6 节去掉按钮和「停止复制?」那张确认卡;要停就退出应用或关窗口,复制先停下、不留下半个团队再退出。
+- 2026-11-02 没人接住的错误:第 7 节,主进程里没人接住的错误交接前走恢复卡,交接后只记日志,不再弹 Electron 自己的错误框。
- 2026-11-02 找不到放数据的文件夹:恢复卡的原因多一种,数据所在的盘不在了(不是程序自己的文件不见了)不再写「出了点意外」,而是「找不到放数据的文件夹,可能是移动硬盘没插上。」,红的是第一段。
- 2026-11-02 复制失败的卡:第 6 节,加一句该怎么办。
- 2026-11-02 团队界面没加载出来的卡:第 7 节,加一句发生了什么、一句该怎么办和「详细信息」,和恢复卡一样。