⚡ fix(sidecar): agent-runtime IO 批次——终态回写 O(N²) 消除/总线读增量化/后台恢复死路 (#411) - #457
Merged
Conversation
hasEvents 读全量只为看首行:改为定位读头部 64KB,头部无完整非空行时 回退全量判定,F4 分叉语义不变。GET_EVENTS 每次 afterSeq 增量轮询仍整文件 读+parse:ThreadState 记录字节水位(readOffset/maxSeqSeen),afterSeq 不早于 水位时只读新字节段;早于水位或 releaseThread 后回退全量,任意 afterSeq 语义保持。毒行截断与残尾处理与 readFile 严格一致。
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.
三项修复(#411)
① settleToolCall 每 tool_result 全量重写 → append-only 侧车行
run-state-store.ts:settleToolCall不再整文件 JSON.parse+重写(长 run 下 O(N²) IO),改为追加一行tool_settled侧车记录(O(1))projectSettledItems物化终态回 tool_call 行;无侧车行时零分配快路compactModelStreamItems(finalize)一次重写完成 model_stream 裁剪 + 侧车物化,文件回归纯净形态countItems排除侧车行;孤儿侧车行(目标 tool_call 不存在)投影时静默丢弃,与原语义一致② 事件总线读路径全量扫描 → 头部判定 + 字节水位增量读
hasEvents:定位读头部 64KB 判首条非空行;头部无定论回退全量,F4 分叉截断语义严格一致read(afterSeq):ThreadState 记录readOffset/maxSeqSeen字节水位,afterSeq 不早于水位时只读新字节段(openSync/readSync 定位读);早于水位或 releaseThread 后回退全量——任意 afterSeq 语义不变③ waiting_background checkpoint 崩溃恢复死路
waiting_background;恢复横幅出现但 RESUME_RUN 命中 no-op 分支,文案声称"已重新附着"实际无任何动作LumeResumeService注入可选resolveBackgroundNotification(rpc 组装点从 transcript 取 background-process-recovery 落盘的终态通知):有通知则与 live handleAsyncEvent 同形转换(ready_to_resume + syntheticToolResult)真正续跑;无通知则任务可能仍活着(durable 跨重启),如实返回等待态验证
bun run typecheck6 包全绿Closes #411