Repository navigation
fix: preflight relaxes the soft-protected recent zone under overflow (#330) - #337
Conversation
📦 Built Package ArtifactBranch: Option A — Install from npm PR tag (recommended)npm install -g billion-context@pr-337Each push to this PR publishes a new version under the Option B — Download artifact
tar xzf billion-context-pr337.tgz
npm install -g packageThis comment is automatically updated on each push. |
[bot] Reviewed Verified clean:
The tests actually catch the bug (not vacuous): I ran the PR's test file against master's
Design claims validated against acp-kernel 0.0.46 source:
Code quality (per AGENTS.md): no Two non-blocking notes:
The |
|
Re-reviewed on current master (2cbbeab, 252 commits ahead of the branch base) and pushed a verified merge head The merge applied cleanly, but the post-flight restructure regressed #496: deciding forward/fail on Verified on Ready to merge. PR#334 is the weaker alternative (forward-as-is) for the same livelock and is being closed as superseded — this PR implements the issue's preferred fix (relax soft protection, keep hard |
[bot] Independently verified the merge head f78a63d (checked out the branch, Pre-flight (my run):
The #496 fix is real and load-bearing. I confirmed it empirically: stripping just the
The rebuild path reuses the original On the count (my 1048/1049 vs your 1047/1049): the one failure in my run is Not re-run: the #334 supersession — agreed. Forward-as-is (let the upstream arbitrate) is strictly weaker than relaxing the soft zone and actually folding the content back under the window; the two are semantically exclusive, so keeping both alongside #337 would conflict. It's already closed (your floor 6) with the right rationale. Ready to merge on my end — per repo rules the merge itself stays yours. |
…regression in post-flight fit gates
f78a63d to
bfe9e4c
Compare
|
已修复 PR 显示的巨大 diff 问题。 为什么之前显示 251 commits / 143 files: 该分支此前用 merge 方式同步 master(head 修复方式: 从当前 master( 改动内容
Pre-flight
Closes #330 |
[bot] Verified the rebased head bfe9e4c. The display fix is correct and the change is green on the new base. Green light. Display fix confirmed: bfe9e4c is a single commit with a single parent = Content unchanged from what I validated last round: Re-validated on the newer base (
|
What
Fixes the #330 livelock: an over-window payload whose only foldable content sits inside the soft-protected recent zone (
preserveRecentMessages/preserveRecentTokens/ most-recent user message) used to 502 forever with no recovery path.Two things bricked it:
compressibleRanges(which exclude the soft zone) beforepreflightCompressever ran.Changes
src/preflight.tsprotectedToolsexclusion is computed independently and still applies. Only when truly nothing is foldable does it fail fast — now with an actionable error (raise the model context window / restart the session).result.payloadEstimate), notcurrentTokens— the latter is floored by a possibly-stalelastInputTokensfrom a prior model, which would fold protected content even when the real payload already fits. (This regression was caught by the existing bili 模式切换模型会报错上下文满 #247 model-switch test.)usage < truncate.threshold; compressible ranges derive from the protected zone, not usage). Without this, the node trims the very tool output overflowing the window, making the fit check undershoot and break before the soft zone is relaxed.src/server.tsresult.payloadEstimate— the relaxed-zoneprocessTurntrims that estimate more than the normal-config prepare does, which could turn a guaranteed-400 forward into a false "fits".Tests
#330: over-window payload whose only foldable content is in the protected recent zone → soft zone relaxed, folded, forwarded (200).protectedTools: ["bash"]): 502 + actionable remedy, no summarization call, no forward.npm run typecheckclean,npm run buildclean.Follow-up (not in this PR)
The issue also suggested the kernel's
truncateLargeToolOutputsas a second lever. It's stateless/non-persistent and only touches tool-results (the repro is a large user message), so it's largely redundant with the soft-zone relaxation here — left as a possible follow-up.