obs: per-request [acp-usage] on the plugin path + fold-materialization anchor ceiling - #696
Merged
Merged
Conversation
…n anchor ceiling (#695) - applyUsageSample (plugin path) now logs one line per upstream usage report, mirroring the wire path's [acp-usage]: input/cached/hit%/ctx, plus a fold=new marker on exactly the request whose prompt first materialized a fold — the one whose prefix-cache hit is expected to cliff. Previously the plugin path updated in-memory stats silently, so post-fold cache drops could not be attributed from logs. - applyRanges sets stats.pendingFoldUsage and extends [acp-compress-obs] with the surviving prefix anchor (active block summaries, sys excluded → lower bound), postCtx, and the next request's cache-hit ceiling. Real cached ≈ ceiling → fold physics; real ≪ ceiling → upstream eviction/contention. - Wire path's [acp-usage] gains the same fold=new marker for parity. Fixes #695
📦 Built Package ArtifactBranch: Option A — Install from npm PR tag (recommended)npm install -g billion-context@pr-696Each push to this PR publishes a new version under the Option B — Download artifact
tar xzf billion-context-pr696.tgz
npm install -g packageThis comment is automatically updated on each push. |
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.
Fixes #695
背景
用户报告 plugin 会话「压缩后缓存掉 0」。现场调查(见 issue)只能给出理论上限 ≈15–18%(系统提示+块摘要),无法区分折叠物理与上游逐出,因为 plugin 路径没有任何 per-request 日志(wire 路径有
[acp-usage],plugin 路径静默更新内存)。改动(纯观测,零行为变化)
[acp-usage](src/plugin.ts applyUsageSample,现导出供测试):[<sid>] [plugin] [acp-usage] input=50000 cached=8000 (cache hit 16%) ctx=51200 fold=newfold=new精确标出折叠落地的那一个请求(applyRanges 置位 → 首个 usage 报告消费)cached=n/a,不算命中率[acp-compress-obs]扩展锚点估计(src/stream.ts):... anchor≈1234 tok (3 active blocks, sys excluded) postCtx≈31000 → next-request cache ceiling ≥3%Session.stats.pendingFoldUsage?: boolean(src/session.ts),内存态,不落盘。验证