Replies: 4 comments
|
Confirmed — the root cause is exactly where you pointed, and this is a reader/writer asymmetry, not file corruption. The throw lives in const complete = scanner.checkpoint()
if (complete.committedBytes !== complete.inputBytes) {
throw new Error('corrupt Zstandard session log: complete frame contains a torn JSONL record')
}
The evidence that this is a false positive rather than a real risk:
The fix is to make |
|
Shipped (finding 1 — the false-positive torn-record throw).
Finding 2 (the persistent seq regression at turn boundaries) is the same writer-side seq-minting bug as #2068 — I shipped the loader-side duplicate-seq tolerance there, but the root-cause fix (single atomic seq owner across the turn teardown + inbox-splice writers) still needs your captured writer interleaving or a repro to pin it. If you can share the session dir from that corrupted case, I can prepare the root-cause patch. |
|
活跃会话写入期间读日志误报 zstd 损坏(文件实际无损)——读写竞争导致的误报,和第 8 章会话管理(#1473/#1497 损坏会话家族)相关但更温和(等写入平息即恢复)。 临时:等会话写入平息再恢复。会话坑位第 8 章有整理:https://github.com/Electricitysheep/dsh-handbook/blob/main/docs/08-tools-context.md |
|
直接修改会话的seg也可以修复这个问题
…------------------ 原始邮件 ------------------
发件人: "Zhou ***@***.***>;
发送时间: 2026年8月16日(星期天) 中午11:38
收件人: ***@***.***>;
抄送: ***@***.***>; ***@***.***>;
主题: Re: [deepseek-ai/deepseek-harness] 活跃会话读取历史/恢复时偶发误报「corrupt Zstandard session log」 (Discussion #2202)
活跃会话写入期间读日志误报 zstd 损坏(文件实际无损)——读写竞争导致的误报,和第 8 章会话管理(#1473/#1497 损坏会话家族)相关但更温和(等写入平息即恢复)。
临时:等会话写入平息再恢复。会话坑位第 8 章有整理:https://github.com/Electricitysheep/dsh-handbook/blob/main/docs/08-tools-context.md
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
正文
活跃会话写入期间读取其日志偶发报 zstd 损坏,文件实际无损,写入平息后同一文件即通过校验。
复现、预期与验收
dsh web(@deepseek-ai/dsh 0.1.0-rc.6)运行一个持续产生事件的活跃会话(agent 执行工具、消息流密集)corrupt Zstandard session log: complete frame contains a torn JSONL record(历史视图显示history unavailable for session ...,resume 显示resume failed for session ...)技术分析与证据
根因定位
校验点:
dsh-session-persistence-jsonl的readZstdPrefix:writer 行为:追加写入使用
INCOMPLETE_FRAME_OPTIONS = { finishFlush: ZSTD_e_flush }按批 flush 帧。帧边界可能恰好落在一条 JSONL 记录中间(记录后半段随下一批写入下一帧)。reader 不对称:对「最后一帧字节不完整」(torn frame)有完整恢复路径(
tornStart→tornMarker截断+恢复),但对「最后一个完整帧以半条记录结尾」直接 throw。该状态是瞬时的:writer 下一批把记录剩余部分追加后,同一文件立即通过校验。活跃会话期间这个窗口随每次跨帧记录周期性出现。
实测证据
scanZstdFrames同款逻辑逐帧解码):26661 个完整帧、32689 条 JSONL 记录、0 字节残缺修复建议
追加发现 2(更严重,建议并入同一 issue):turn 边界 seq 回退导致持久损坏
现象、证据与修复记录
现象
同一会话日志中,
turn/end之后新一轮的事件 seq 回退复用了上一轮末尾的序号:后果
corrupt Zstandard session log,历史永远加载失败,会话无法 resume实测修复(供参考)
对回退点起的所有记录的
seq/seq0统一 +2 重编号后,全文件通过解码器校验(111665 个事件,零内容丢失)。说明数据本身没丢,纯粹是 writer 的 seq 编号错误。建议
All reactions