Skip to content

fix(web): 桌面载体排空请求体并修复模型测试崩溃 + #19 macOS 验收 / harden desktop fetch carrier and record issue19 macOS acceptance - #34

Merged
Qiuner merged 4 commits into
Qiuner:masterfrom
ruijayfeng:fix/desktop-fetch-body-drain
Sep 23, 2026
Merged

Qiuner merged 4 commits into
Qiuner:masterfrom
ruijayfeng:fix/desktop-fetch-body-drain

Conversation

@ruijayfeng

Copy link
Copy Markdown
Contributor

背景

#19 macOS 侧真实模型验收(维护者 2026-09-17 指定:macOS 归 @ruijayfeng,Windows 归维护者)。验收在 M5 Pro / macOS 26.5.1 / arm64 / 上游 dsh-v0.1.6-alpha.10a15e36e7f82)/ DeepSeek 官方 deepseek-v4-flash 上完成,Key 由使用者在应用内输入,未进入仓库与评论。

验收中发现并修复的两个缺陷(叠加必崩)

在模型设置点「测试连接」100% 拖死官方 Host 并落入启动失败恢复页(3/3 复现,最小复现:fetch POST /api/qcode/model-test body '{}'):

  1. b132323 载体未排空请求体:desktopJson 提前返回或 finally destroy 留下未消费 body 时,取消帧与 Electron main 在途数据帧竞态,触发官方 desktop-host 传输 fatal。注册即 buffered,改为进校验前整读(Buffer 保持既有 handler 隐式 toString 语义)。
  2. 43daa32 模型测试读取未注入服务:桌面 inject 无 webServer,Cordis 上下文属性访问即抛(可选链救不了 getter),「测试连接」必抛 cannot get property "webServer" without inject;与 1 叠加表现为 Host 崩溃。桌面身份由 WeakSet 承担,loopback 检查仅 Web 分支执行。

回归测试各钉一条(bodyUsed 双路径 / 抛错 getter 模拟),qcode-web 67/67、typecheck 通过。

上游协议洞(未改上游,移交维护者)

apps/desktop-host/src/index.ts beginRequest 的 body cancel() 分支删除 requestBodies 却不登记 discardedRequestBodies:任何请求体取消后迟到的数据帧都会从"忽略"升级为 fatal,拖垮整个 Host。建议 cancel 分支同样登记 discarded,使迟到帧走既有忽略路径。本 PR 的修复消除了我方触发面,但任何第三方插件取消 body 仍会命中该洞。

#19 完成标准走查(macOS)

  • 项目选择与 Q 会话绑定:issue19-demo + 官方会话「Coder · issue19-demo」
  • 真实文件修改与回读:hello.txt(内容含任务时间戳),工具调用/文件链接/用量正常
  • 审批双路径:允许一次→落盘;拒绝→未写、模型承认拒绝为最终结果不绕过、会话继续
  • 通知:打开态内联;关闭态完成与「需要你确认」通知均带正确项目名送达、点击直达会话(系统通知权限 granted,横幅视觉未截图)
  • 重启恢复:项目自动绑定、历史完整、取消任务未重放
  • 失败/取消反馈:两类 502 结构化文案;tool call aborted + 「这一步还没完成」,无残留进程
  • 文档同步:official-desktop-plan.md [Validation]: 完成官方桌面自由创作与恢复闭环验收 #19 一节 + 总索引条目

未覆盖(如实):Windows 真实模型侧(维护者)、断网/连接恢复注入、macOS Intel、鼠标锁定纯人工走查、安装包签名公证。

恢复后的会话

Refs #19(不关闭:Windows 侧与上游协议洞待维护者)

… desktop carrier

官方桌面验收复现:模型设置「测试连接」POST '{}' 经共享 Fetch 通道必崩 Host
(Electron sent body data for inactive stream → 启动失败恢复页,3/3 复现)。
desktopJson 在提前返回或 finally destroy 时留下未消费 body,
取消帧与 Electron main 在途数据帧竞态触发官方 desktop-host 传输 fatal。
注册即 buffered,改为进校验前整读 body(Buffer 保持 handler 隐式 toString 语义)。
上游 cancel 分支不标 discarded 的协议洞在 Qiuner#19 记录,不代改上游。
回归测试钉死两条路径 bodyUsed 与不触发 cancel;67/67 通过。
… test

Cordis 上下文对未注入属性访问即抛,可选链救不了 getter:
桌面入口 inject 无 webServer,测试连接必抛
cannot get property webServer without inject,
fetch 层表现为 Failed to fetch;与载体未排空 body 叠加时拖死 Host。
桌面身份由 WeakSet 承担,loopback/origin 检查仅 Web 分支执行。
回归测试模拟抛错 getter 钉死桌面路径;11/11 通过。
@Qiuner
Qiuner marked this pull request as ready for review September 23, 2026 02:44

@Qiuner Qiuner left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

已复核 desktop transport 请求体排空、桌面模型测试注入边界和回归测试;CI 全绿,批准合并。

@Qiuner
Qiuner merged commit 18e012a into Qiuner:master Sep 23, 2026
3 checks passed
@ruijayfeng
ruijayfeng deleted the fix/desktop-fetch-body-drain branch September 23, 2026 07:28
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