Repository navigation
fix: persist derivedFromSessionId immediately at lineage establishment (#2986) - #2987
Merged
Merged
Conversation
Contributor
📦 Built Package ArtifactBranch: Option A — Install this exact build (recommended)npm install -g billion-context@0.0.3645-pr.2987.00436dbThis exact version is immutable and reproducible. The rolling Option B — Download artifact
tar xzf billion-context-pr2987.tgz
npm install -g packageInstall instructions are refreshed on each push. |
Owner
Author
[bot] 🏷 PR #2987 审查结论 —— 已对当前 master( 结构化八问
验证证据(均在真实树上执行,非纸面)
判定可合。 分支落后 master 217 commits 但文本零冲突(clean rebase 已实证)、GitHub 显示 mergeable=True。按 [PR] 处理纪律我未推送任何东西;若你希望合并前把分支刷新到当前 master,说一声我就推 rebase;否则直接合(GitHub 生成 merge commit,无冲突风险)亦可。 |
… establishment (#2986) The kind-child lineage link (metadata.derivedFromSessionId) was set in memory then persisted only on the debounced save cadence. A non-graceful exit inside that window dropped the link before it reached disk, permanently orphaning the child after restart (shared prefix re-sent whole, over-window requests 503). Add persistLineageLinkNow(): a fire-and-forget immediate writeNow fired right after markDirty at both establishment sites (resume-inheritance #1486 and the explicit derived link #1333). Shrinks the loss window from the debounce interval (default 500ms) to a sub-ms tick. Async on purpose: this runs on the model-request hot path, so it must not stall the response or freeze the loop (unlike flushSync Atomics.wait retry); a failed write logs and the debounced save retries. Behavior change: one extra immediate session-record write now fires once per child session at first lineage establishment (previously only the debounced cadence). Low frequency, non-blocking, negligible cost. Regression test pins it: with a 60s debounce, derivedFromSessionId must appear on disk within a 3s poll window (debounce-only leaves it absent). Verified to fail on the unfixed code.
ranxianglei
force-pushed
the
2026-10-13_lineage-persist-window
branch
from
October 14, 2026 13:12
adce1d1 to
1d73941
Compare
Contributor
📦 Merged Build PublishedThis merge to master was published as npm install -g billion-context@0.0.466-master.a2a3b0e # this exact build
npm install -g billion-context@master # always the newest merged build
|
This was referenced Oct 15, 2026
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.
Closes #2986
问题
kind 子会话的血缘链接
metadata.derivedFromSessionId只在内存里建立后走去震颟保存(markDirty→scheduleSave,默认 500ms)落盘。去震颟窗口内非优雅退出(SIGKILL/崩溃/OOM/断电)会让链接在写盘前丢失 —— 重启后盘上无父 ID,两个继承门都打不开、#2887 的 boot reconcile 也无从起作,子会话永久孤儿(共享前缀整段重发、超窗请求 503)。修复
新增
persistLineageLinkNow(session):在两个血缘建立点(resume-inheritance #1486 与显式 derived link #1333)紧跟markDirty之后触发一次 fire-and-forget 的立即writeNow。把丢失窗口从去震颟间隔(默认 500ms)压到 sub-ms tick。用异步而非
flushSync:该路径在模型请求热路径上,不能阻塞响应或冻结事件循环(flushSync靠Atomics.wait重试最多 ~3s);写失败会记 warn 日志,去震颟保存在下次变更时重试兜底。行为变更(披露)
guardedBuild),仅提前时机。残留(诚实说明)
staleDiskPayload守卫只比对stats.requests+state.nextBlockId,不含 lineage 字段。立即写盘让其他实例更早看到链接、收窄该窗口,但彻底消除多写者 lineage 仲裁是独立的高风险机制,不在本 PR 范围(如需可另立项)。测试
tests/issue1333-derived-inheritance.test.ts新增回归测试:debounceMs=60_000 下,derivedFromSessionId必须在 3s 轮询窗口内出现在盘上(仅去震颟会使其缺失)。已验证在未修复代码上失败(not ok)、修复后通过。typecheck 全绿;lineage 套件 9/9 通过。CI 跑全局回归。config surface
不涉及 —— 未新增/改名/改语义任何配置字段、env 或 CLI flag。