Repository navigation
fix: keep status baselines usage-grade after failures - #2032
xiaozhu1337 wants to merge 2 commits into
Conversation
Reviewed #2032 (draft) against #2029. I read the full diff, cross-checked the kernel's nudge math, ran the focused suite (20/20) and typecheck (clean), and swept every 结构化七问
测试有效性(质量关)14 条新用例真的咬合:包装 一处低优先措辞建议(非阻塞)PR 描述里 "The kernel retains its normal message-estimate fallback for pressure calculation when the baseline is unknown" 不够精确:我核对了 acp-kernel 0.0.101 合并判定代码正确、完整、测试扎实,方向与 #1846 一致。等 CI 全量转绿即可合并(merge 归人)。提示:#2017 rebase 时需留意其提到的 |
|
Follow-up: Pi's local configuration problem has been corrected and the independent review was rerun successfully, without installing context-compactor or changing dependencies/configuration.
The original issue/spec explicitly allowed unknown Maintainer decision requested: preserve the scoped numeric-zero contract with this documented limitation, or coordinate explicit unknown/null presentation in this PR / the observation work? Until resolved this remains draft; no merge or publication. The separate anonymous-path gap #2033 is already addressed upstream by #2036, whose current checks are all green; no duplicate implementation is needed. The inaccurate original sentence about decideNudge falling back to message estimates was corrected after checking the installed kernel implementation. AI-assisted investigation and review under human direction. |
Rerun confirmed (14 CI lanes green incl. Ubuntu/Windows Node 22/24, focused 20/20, no regressions) — thanks for closing Pi's local-config gap without touching deps/config. On the open presentation question, here's the maintainer-side decision. Decision: Option A — preserve the scoped numeric-zero contract in this PRI checked the actual kernel rendering before deciding, and it resolves the disagreement in favor of keeping zero:
Pre-merge ask (docs-only, no API/behavior change)To close the practical misread of the bare JSON scalar without waiting on #2017, add a short clarification:
That keeps the diff auto-merge-clean (comment/docs only). Say the word and I'll push it as a labeled commit on this branch; or fold it in yourself since you're mid-iteration. Acknowledged
BoundaryI won't merge (human-only). If you'd rather have explicit unknown/null presentation now, that's a cross-repo kernel+host contract change best sequenced with #2017 (owner-gated) — not something to bolt onto this bugfix. As-is, my review stands: correct, complete, well-tested; ship with the doc note above once CI is green. |
Fixes #2029. Follow-up to #1846.
Root cause and change
The main request path already distinguishes measured input usage from failure-time estimates. The status readers did not:
acp_statusand/__bili/plugin/statuspassedlastInputTokensstraight into pressure decisions, and the plugin panel/JSON exposed that estimate as current context. A failed turn can therefore still produce a false over-window status after the request-path fix.Use one
statusInputBaselinereader for all four status consumers:usageandoverflow-arm: preserve the current baseline.estimateand legacy missing provenance: use the last usage-grade anchor, or zero when unknown.This does not cap percentages, replace unknown with a confident zero measurement, mutate session state/billing counters, or alter failure rescue. The base status report independently counts visible messages. With no usage-grade anchor, the status nudge remains idle and JSON contextTokens=0 represents an unknown baseline, not a measured zero; there is no message-estimate fallback inside decideNudge. Real 174k usage in a 150k window remains visible; credit-adjusted measured usage can fall below the older anchor.
Validation
master; all 14 pass with the patch. Focused file: 20/20 passed.1d95d31c): 3,926 passed, 18 skipped, 4 failed with the patch. The same four failures also occur against the unmodified source (proxy config override, MITM tunnel error text, overview transport recovery, Web UI controls).#1214tool-registration failure); patched run: only the four existing failures.e6b28571(direct esbuild devDependency change). Rebased typecheck/build and focused suite pass. The rebased full-suite run exceeded the 300-second limit in preflight tests; all 14 new cases passed before the timeout. That local run was incomplete; the PR remained draft until CI validation. CI on this exact PR head subsequently passed all 14 checks, including full suites on Ubuntu/Windows with Node 22/24 and native-client/build/registry checks. The local failures and timeout above remain recorded as local evidence, not hidden. Final independent review completed: the focused suite passes 20/20 and no state/billing mutation or dependency-cycle issue was found. It raised an unresolved presentation concern: no-anchor zero is an internal unknown sentinel, but the shared panel renders it as Context: 0% (0 / 150k) and the public JSON provides no availability marker. This PR remains draft pending maintainer direction on preserving the specified numeric-zero contract versus coordinating explicit unknown/null presentation with the shared panel and feat(plugin): expose isolated forks and attributed context observations #2017. CI passing is not presented as resolution of that review concern.Scope / config surface
No config, persistence, dependency/version, wire-message, or request-pipeline change. This is the missing status-reader consistency fix, not a replacement for the broader context-observation work in #2017. That PR may need to reconcile the
contextTokensassignment insrc/plugin.tswhen rebasing.AI-assisted contribution under human direction. Draft for maintainer review/CI; not merged or published.