Repository navigation
fix(kernel): chat 传输层 node:http 回退——jitless 板(无 WebAssembly→fetch 全灭)任务全挂根修 - #38
Merged
Merged
Conversation
…任务全挂根修(设备实测取证 2026-10-29) 深开鸿板必 jitless(禁 RWX),node v24.19.0 musl --jitless 下 typeof WebAssembly === 'undefined',undici fetch 依赖 wasm → 一切 fetch 调用 80ms 内抛 "fetch failed WebAssembly is not defined" (本地无 TLS 同样死)。kernel provider.chat/chatVision/mcp/types.models 探测原只走 fetch → 板上任务全部挂死(runner 0% CPU 挂在重试)。 - 新增 http-transport.ts:模块级 memo 探测 (fetch 为函数且 WebAssembly 存在 → 原生 fetch 路径,零行为变化; 否则 node:http/https 回退),首次回退 console.warn 一行取证日志 - 回退实现:keep-alive Agent 模块级单例;AbortSignal → req.destroy + res.destroy(错误经 reader 适配器 surface,语义同 fetch AbortError,signal 覆盖整个 body 消费阶段);错误归一成 'fetch failed ...' 形状,premature close 归一 'terminated', TRANSIENT_RE 重试语义两路一致 - getReader(res) 统一入口:fetch 路径 res.body.getReader() 原样, node 路径给 node-stream → WHATWG reader 适配器,SSE 泵无感切换 - provider.ts chat/chatVision、mcp.ts notify/request/firstSseMessage、 types.ts detectLocalProviders 的 fetch 全部改走 httpFetch (packages/web 的 server/tunnel/MCP 不在本任务范围) - 新增 provider-transport.test.ts 10 测:探测三态注入、回退路径 真发 mock SSE server 流式 chat 与 fetch 路径逐字段一致(同一解析器)、 非流式/chatVision JSON、外部 abort 穿透 SSE hang 不重试、 mid-stream 切断 surface 为 transient 不静默半截答案、 ECONNREFUSED 归一 'fetch failed'、warn 恰好一次 验证:typecheck 绿;kernel 全套 139/139 绿(既有测试零变化); 全套 npm test 1050/1052(唯一 fail 为 agent 包 git checkpoint Windows tar 盘符预存问题,HEAD 干净状态复跑同样失败,与本改动无关); 本机模拟 jitless(WebAssembly=undefined 后 import kernel)chat() 流式 text/tool_calls/usage 解析全部正确。 Co-Authored-By: Claude Code <noreply@anthropic.com>
…步未处理拒绝殃及同进程后续套件(CI Linux 实证);驱动脚本+纯探针单测留主进程
…链上实例化,先导入(wasm 完好)再毒化+重置探测 memo,22/24 双版本安全
…ici 惰性 wasm 解析都可能落入毒化窗,22 实证);探测逻辑由纯单测覆盖,真板部署为端到端终裁
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
事故链(2026-10-29 深开鸿板实测取证)
板禁 RWX → node 必须
--jitless→ 该 node 构建(v24.19.0 musl)jitless 下typeof WebAssembly === "undefined"→ undici fetch 依赖 wasm → 一切 fetch 调用 80ms 内抛 "fetch failed WebAssembly is not defined"(本地无 TLS 同样死)→ kernel chat 只走 fetch → 板上任务全部挂死(runner 0% CPU 挂在重试)。node:http 的 http.request 实测正常。修复
packages/kernel/src/http-transport.ts:模块级 memo 探测(fetch 为函数且 WebAssembly 存在 → 原生 fetch,零行为变化;否则 node:http/https 回退,keep-alive Agent 单例,AbortSignal 贯穿 body 消费,错误归一保持 TRANSIENT_RE 语义;首次回退一条取证 warn)指挥者独立验收
落地路径
合并后发 v0.23.47 → 深开鸿板部署 → 端到端任务实测收官(板上验收为终裁)。