Repository navigation
fix: acp_status derives ranges/nudge from live state, not the prepare-time snapshot (#389) - #397
Conversation
📦 Built Package ArtifactBranch: Option A — Install from npm PR tag (recommended)npm install -g billion-context@pr-397Each push to this PR publishes a new version under the Option B — Download artifact
tar xzf billion-context-pr397.tgz
npm install -g packageThis comment is automatically updated on each push. |
[bot] 🏷 Reviewed PR #397 against master — single commit Root cause & fix — verified correct. Key claims I independently verified:
Tests — the 3 new cases in Minor (non-blocking):
Follow-up (correctly scoped out): Verdict: Correct, minimal, well-tested, and addresses the root cause rather than the symptom. Ready to merge. I can't merge PRs (human-only) — please merge when happy: #397 |
d498f89 to
48f503b
Compare
…-time snapshot (#389) # Conflicts: # src/compress-loop-responses.ts # src/loop/core.ts # src/stream.ts
48f503b to
31d24e0
Compare
|
已 rebase 到当前 master(v0.1.87 冲突消解说明base
Pre-flight
显示恢复真实规模:7 files, +204/-48(此前 GitHub 锚在老 base 上显示为 dirty)。 Closes #387 |
[bot] 🏷 已对 rebase 后的分支重新审核( 冲突消解核验(逐行对照 master 原版
|
handlePluginStatus fed buildStatusPanel the prepare-time snapshot (mem.nudge) remembered at the last model request. A compress executed through the plugin tool API mutates session.state without re-running prepare, so between compress and the next request the panel mixed live blocks with stale, already-consumed ranges (#387). Recompute the nudge on every panel request via processTurn over the remembered pre-fold view against the CURRENT session.state; on failure omit the nudge/ranges sections instead of falling back to the stale snapshot. server.ts passes { core, config, log } to handlePluginStatus; callers in tests updated for the new deps argument. New e2e in plugin-protocol.test.ts fails pre-fix (panel kept recommending the just-compressed m00001..m00002 range).
Problem (#389)
acp_statusstitched two freshness levels into one report: the base report read livectx.session.state, while the appended "Compressible ranges" + "Nudge:" lines readctx.nudge— a snapshot frozen at request-prepare time and never re-assigned inside the loop. After a successfulcompress, the same-turnacp_statusstill listed the just-compressed range as compressible with the stale nudge value, inviting duplicate/mis-targeted compress calls.Fix (issue option 1)
src/acp-status.ts— sharedhandleAcpStatus(args, ctx). After the base report (and the existingscope=short-circuit, which already carried no stale data), it re-runs the kernel's pureprocessTurnoverctx.session.state + ctx.messages(verified: every pipeline node returns new objects;syncBlocksdeep-copies state) withtokenCount = session.stats.lastInputTokens— the same estimate the next prepare uses — and derivescompressibleRanges(through the same one-shotviableRangesfilter the prepare path applies) +protectedRanges+ the Nudge line from the fresh decision.turn.stateis intentionally NOT adopted, so nudge cadence bookkeeping is untouched; a recompute failure degrades to the base-only report rather than serving stale data.src/stream.ts(executeAnthropicProxyTool) andsrc/compress-loop-responses.ts(executeProxyTool) previously called barebuildStatusReportand ignored every option — they now delegate to the shared handler, so all protocols emit the same output shape and honorscope/view/tool/sort/limit.LoopCtx.nudgeand its setters (src/server.ts,src/plugin.ts) — the frozen snapshot can no longer leak into the report, and the plugin tool path gets the live behavior for free.Tests (
tests/acp-status.test.ts, 3 new)applyRangescompress) → immediatehandleAcpStatuswith NO new prepare → compressed refs absent from "Compressible ranges", b1 active, Nudge line state-derived.scope=short-circuit: base-only, no ranges/Nudge section.runCompressLoop+ responses adapter:compress+acp_statusin the same round — the acp_status marker no longer lists the just-compressed range.Pre-flight
npm run typecheck— cleannpm test— 871/871 pass (868 existing + 3 new)npm run build— successtests/e2e/e2e-codex.test.ts) could NOT run in this environment (nocodexbinary / no local upstream); CI manual-dispatch e2e is available. The loop-level same-turn test above covers the changed pipeline path.Also fixed (commit 1a1178d): the plugin /acp panel path
handlePluginStatus(src/plugin.ts) built the panel from the nudge remembered at the last model request (prepare-time snapshot). A compress executed through the plugin tool API mutates session.state without re-running prepare, so the panel mixed live blocks with stale, already-consumed ranges. The panel now recomputes the nudge on every status request (processTurnover the remembered pre-fold view against the CURRENT session.state; on failure the nudge/ranges sections are omitted instead of falling back to the stale snapshot).server.tspasses{ core, config, log }as deps. New e2e intests/plugin-protocol.test.ts("plugin status panel recomputes the nudge after a mid-turn compress") fails pre-fix.Pre-flight after the panel fix: typecheck clean · 1069 tests, 1067 pass (2 known env fails in plugin-agent.test.ts, unrelated) · build success.