Repository navigation
[PR] fix: acp_status outputs context usage metrics (used/window/%/remaining), avoiding misreading cumulative original as curr | fix: acp_status 输出上下文占用锚点(已用/窗口/%/剩余),避免把累计 original 误读成当前占用 (#5021) - #5023
Augenblick0v0 wants to merge 9 commits into
Conversation
… lifetime "original" total as current context (ranxianglei#5021) acp_status gave an absolute `BILLED INPUT … tok` with no denominator, and the kernel's `COMPRESSED BLOCKS — N active (X summary, Y original)` header prints a LIFETIME reclaimed total one line above it. An agent that cannot see the route's window has no anchor, so both figures read as current occupancy. Measured incident: a session at 116,902 of a 1,000,000-token window (11.7%, peak 16.9%) reported "the context is exhausted" to its user and stopped mid-task, citing the 1,214.1K lifetime original and the 4.3K remaining foldable mass as its evidence. The report now always carries the missing denominator when a billed sample exists: CONTEXT: 116902 / 800000 tok used (14.6%) · 683098 tok remaining of the input budget Guarded: no billed anchor or a non-positive limit prints no line, and remaining clamps at 0 so an over-limit reading never shows a negative budget.
(ai: vllm-qwen/qwen3.8-27b) 查重:不重复。 按 issue 号、主题关键词与失败签名检索了 open+closed 的 issue/PR(近期 7 天为主):只找到 #5021(本 PR 的来源 issue)与本 PR 自身,无他人并行修同一问题。 标签: 以下为对 diff 与既有行为的独立复审结论(不是复述 issue 的分析): 八问
测试有效性:4 例走真实 handleAcpStatus 入口,断言有牙(精确匹配 used/limit/%/remaining 全串);gate 纪律双向齐全——正向(正常比例出行)+ 负向(无 usage 样本不出行;非正限额不出行且不漏 NaN)+ 超限收敛到 0。fixture 风格与 tests/acp-status.test.ts 既有惯例一致(inline session fixture 是全套件通行做法)。 diff 整洁度:2 文件 +117/-0,每行都服务于本 PR 目的,无跑题文件、无空白 churn;base 即当前 master(落后 0 commit),无 stale-base 风险。注释带事故溯源,符合本仓库 provenance-comment 惯例。 两个非阻塞观察(不要求返工):
判定:方向打到根因(补上缺失的分母,而不是在消费侧打补丁治误判);外部提交质量过 ⑤b 全项清单(命名达意、无死代码、无重复、错误处理完整、风格一致、测试同标准);测试有效性足。CI 在评审时点 21 项 check 全部 queued(刚起跑)——若 CI 绿即可合并,合并操作留给你。 |
|
(ai: vllm-qwen/qwen3.8-27b) Merge guard sync: origin/master merged into this PR branch with no conflicts and pushed to the fork head |
|
(ai: vllm-qwen/qwen3.8-27b) Merge guard re-check: no push needed — the branch was already synced past master tip |
|
(ai: vllm-qwen/qwen3.8-27b) Merge guard re-check (round 3): no push needed — branch is fully up-to-date with master tip |
|
(ai: vllm-qwen/qwen3.8-27b) Merge guard re-check (round 4): state unchanged — no push needed (branch |
…status-occupancy-anchor
(ai: vllm-qwen/qwen3.8-27b) CI 自动修复车道收工(head 1. 是什么问题:PR 三个 test 分片红。三轮日志逐一对账后确认全部是 master 继承的 test 矩阵失败,与本 PR 代码无关。 2. 什么原因导致的:① #5140 cold-tail 3. 影响范围与严重程度:仅 CI 矩阵;用户/运行时零影响。对本 PR:阻塞全绿判定,但本 PR 自身路径已全绿。 4. 怎么修复的:不改业务代码——merge ci-fixes@67f8e8940(#5140 pin)+ 最新 master 44067a5(含 #5188,同属 fork/snapshot-409 域),两次推送(c83ca2c80 → faac912)。效果:#5140 三片转绿、#3380 timing 未再复现、全部 ubuntu 分片 + static gates + contract lanes 全绿。剩余 ②③ 按 CI 协调政策收敛在 ci-fixes/master 侧,本分支不重复修。 5. 是否有回归问题:无。三轮重跑中所有非继承项均绿;merge 带入的 #5188 是已合入 master 的既有变更,未引入新行为面。 6. 是否破坏缓存:不涉及。 7. 是否改了设计方向:不涉及。 8. 是否引入了新的配置:不涉及( 关于「attempt 2/2 需开 decision request」:未开新 issue——两个剩余红都已在 #4599 哨兵清单里点名跟踪并请求 owner triage,按 owner policy 2026-10-24「禁止为 CI 问题开新 issue」,状态/结论一律评论到 #4599(已发三条:初始归因、重跑结果、终态)。收工判定:本 PR 自身全绿,可合入状态已达成(合并由人执行);整体变绿只待 ci-fixes/master 收敛 issue4739-EBUSY 与 #5103 两条已知继承项。 |
|
(ai: vllm-qwen/qwen3.8-27b) Merge guard sync (round 5): master had advanced 121 commits ( |
[ework] CI fix verified green ✓ |
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) Merge guard 第 7 轮:本轮触发属实,已完成同步。master 前进 121 commits( |
|
(ai: vllm-qwen/qwen3.8-27b) Merge guard sync (round 6): master advanced again ( |
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) 本轮(转发的是我自己上一轮的同步评论,非新请求;顺手做了核验+再同步):发现 master 在上次推送后又前进了 12 commits( |
|
(ai: vllm-qwen/qwen3.8-27b) Merge guard sync (round 7): master advanced +3 ( |
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) 本轮(转发的仍是我自己的上轮同步评论;核验时发现 master 又前进了):master +3 commits( |
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) 本轮转发的是我自己的上轮同步评论(非新请求)。核验结果:状态无变化——head |
(ai: vllm-qwen/qwen3.8-27b) 更正上一条基于旧 head 的 re-check:分支已前进到 CI 全绿,本 PR(diff 仅 |
关联 issue:#5021
改了什么
src/acp_status在拿到 billed input 后,固定多打印一行占用锚点(已用 / 窗口 / 百分比 / 剩余):billed > 0且config.modelContextLimit > 0时输出;没有 usage 样本、或限额非正数时不输出这一行(不臆造占用)。remaining在超限时收敛到 0,不会打印负数预算。tests/issue5021-context-occupancy-anchor.test.ts(4 例)覆盖:正常比例、无锚点不出行、超限收敛、非正限额不出行且不漏NaN。为什么
acp_status之前给的是裸的绝对值BILLED INPUT (upstream usage): N tok,而分母config.modelContextLimit在整份报告里从不出现;紧邻其上又是 kernel 的COMPRESSED BLOCKS — N active (X summary, Y original),其中Y original是生命周期累计被压缩掉的原文量(恰恰是压缩在生效的证据),却最容易被读成"当前上下文里有 Y"。真实事故(已在 issue 里给出完整数据):一个会话在 116,902 / 1,000,000 tok(11.7%,峰值 16.9%)时,向用户报告"上下文已经用尽"(引用
1214.1K original与4.3K max compressible作为依据)并停止执行任务。这两个数字都不是占用量。补上分母后,agent 不需要猜窗口大小就能回答"还剩多少",也不会再把累计量当占用。
验证
node --import tsx --test tests/issue5021-context-occupancy-anchor.test.tsnode --import tsx --test tests/acp-status.test.ts tests/issue2366-cjk-billed-status.test.ts→ 17/17 通过extra.push(billedLine)之后插入一个if块,不改任何既有行,不动 kernel。未包含(避免扩大 PR 面)
kernel 侧
kernel/src/report.ts的COMPRESSED BLOCKS — … original措辞(建议标注"已回收,不在当前请求内")本次不改——那是 kernel 改动,需要 bumpkernel/package.json版本并同步断言该字符串的测试。如需要我可以另开一个 PR 处理。