You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
L741-742 assertZstdHeaderFrame:if (plaintext.length === 0 || plaintext.indexOf(10) !== plaintext.length - 1) throw new Error("corrupt Zstandard session log: first frame is not exactly one header line");
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
摘要
一个会话日志物理格式损坏就会让
session.list整体返回 500,Web 侧边栏所有会话消失(数据未丢,workspace.list 正常,错误仅存在于浏览器 console)。根因是列表聚合的单会话异常未隔离:listArtifacts遍历会话时调用readFirstZstdLine(内部assertZstdHeaderFrame对损坏头帧抛错),调用点没有 try/catch——而同一函数里"无法解析 → 跳过该会话"的容错设计(L1080-1082)存在,唯独抛错路径漏了隔离,一个坏文件把整个列表拖垮。复现步骤
~/.dsh/sessions/<project>/<session>/session.jsonl.zstd(多帧容器:首帧仅一行 header)。zstd.compress(whole_plaintext))。POST /api/session.list返回500: handler failure: Error: corrupt Zstandard session log: first frame is not exactly one header line;侧边栏全部会话消失(workspace.list 正常);界面无任何提示(仅浏览器 console 有 500)。根因(源码定位,rc.6)
@deepseek-ai/dsh-session-persistence-jsonl/lib/index.js:assertZstdHeaderFrame:if (plaintext.length === 0 || plaintext.indexOf(10) !== plaintext.length - 1) throw new Error("corrupt Zstandard session log: first frame is not exactly one header line");readZstdPrefix内):assertZstdHeaderFrame(headerFrame.value)—— 单帧重写文件在此抛错。listArtifacts(L1060-1084):const first = this.compression === "zstd" ? await this.readFirstZstdLine(path, signal) : ...—— 调用点无 try/catch,抛错直接上抛 →session.list整体失败;if (first === void 0) continue;、if (meta === void 0) continue;(无法解析的条目被跳过),说明设计本意是"坏条目隔离",但抛错路径(assertZstdHeaderFrame/其他校验)没有被纳入跳过逻辑。listArtifacts抛错 →session.listRPC 500 → 前端会话列表整体清空;前端无 500 错误呈现(仅 console),用户看到的是"所有会话消失"。建议修复
方案 A(推荐)· 列表聚合隔离单会话异常:在
listArtifacts的会话循环内对readFirstZstdLine/parseHeaderMeta/assertStoredIdentity包 try/catch——corrupt 类错误记 warn 后continue(与既有 L1080-1082 的跳过意图一致)。坏会话被隔离,其余会话正常列出;需要时可在返回元数据中标记该会话不可读。方案 B · 前端呈现列表错误:
session.list失败时在 GUI 显示可见错误(banner/toast + 重试),而不是静默清空侧边栏——发帖人预期 2;与 A 互补(A 防根因,B 兜底呈现)。方案 C · 读取器宽容单帧布局:对"可完整解码的单帧日志"兼容(发帖人预期 3)。该文件内容可解码,只是容器布局不同;但放宽格式契约有向后兼容风险(旧版本/工具链写入的合法多帧格式是约定),作为长期演进可考虑,短期 A 更稳妥。
影响
环境
验证材料
dsh-session-persistence-jsonl/lib/index.jsL741-742/L969/L1060-1084;assertZstdHeaderFrame抛错无捕获 →listArtifacts整体失败 →session.list500。First analysis of discussion #1043. Happy to open a PR with fix option A.
All reactions