Repository navigation
[PR] fix: identified sessions escape the preflight 413 dead-end (#4185) - #4188
Merged
Merged
Conversation
Contributor
📦 Built Package ArtifactBranch: Option A — Install this exact build (recommended)npm install -g [email protected]This exact version is immutable and reproducible. The rolling Option B — Download artifact
tar xzf billion-context-pr4188.tgz
npm install -g packageInstall instructions are refreshed on each push. |
ranxianglei
force-pushed
the
2026-10-22_clamp-forward-escape
branch
from
October 21, 2026 16:17
aabdff4 to
b17fb1b
Compare
…tting clamped payload escape the preflight 413 dead-end (#4185) The #3146 forward-once gate keyed on unknownBaseline, whose anonymous && excluded identified sessions (dsh/codex/claude-code all stamp a session id). A fresh identified session whose request exceeded the headroom-adjusted window with zero compressible ranges hit the final fail-fast: deterministic 413, #3846 pin, every client retry re-failing — the session was permanently unusable from message one (2026-10-21 raccoon incident: ~227K est vs the 192001 headroom target while payload + clamped output fit the 256000 native window). The gate now takes three arms with unchanged internals (doom bytes #2490, #3846 pin, forward once): unknownBaseline (original), noUpstreamEvidence (identified but no usage baseline and no stated wall), and nativeFitAfterClamp (the #453/#2096-clamped outbound body plus its declared output budget fits the NATIVE window — the headroom reservation is policy, not physics). Genuinely doomed bytes and payloads over the native window still fail fast 413; both directions pinned. Fixes #4185
ranxianglei
force-pushed
the
2026-10-22_clamp-forward-escape
branch
from
October 21, 2026 16:51
b17fb1b to
43598f9
Compare
added 2 commits
October 22, 2026 01:12
…e identified-fresh escape (#4185) The widened #3146 gate forwards zero-evidence identified sessions once for upstream arbitration when the exhaustion is DETERMINISTIC (nothing compressible left after maximum folding) — exactly the #4185 shape. Two preflight-fail-fast pins are that shape (#301 nothing-compressible 413, #737 headroom-shrunk nothing-compressible 413); they now seed a settled usage baseline so they keep pinning the evidence-driven verdict while tests/issue4185-identified-fresh-forward.test.ts owns the new contract. Relay-dependent failure pins (429'd / empty / truncated summaries, gateway 524) stay on the classic fail-fast path and need no seeding — verified per file. No source changes. Verified: full preflight family + issue2313/3846/3918 + context-overflow + anthropic-beta-window + issue4185 suites green except four pre-existing master failures tracked in #4194.
…he identified-fresh escape (#4185) The full-suite A/B on the merge ref found four more pins that assert the local fail-fast contract for zero-evidence identified sessions in exactly the shape the #4185 gate now escapes (deterministic exhaustion after maximum folding): #2391 eager/loaded overflow stop-before-forward, #1841 A futility skip, #3645 uncalibrated futility control, and #736 shrunken-window fail-fast (main + no-override control). Each seeds a settled usage baseline so it keeps testing the evidence-driven verdict; the new contract stays pinned by tests/issue4185-identified-fresh-forward.test.ts.
Contributor
📦 Merged Build PublishedThis merge to master was published as npm install -g [email protected] # this exact build
npm install -g billion-context@master # always the newest merged build
|
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.
(ai: zai/glm-5.3)
Fixes #4185. Branch:
2026-10-22_clamp-forward-escape(basefe5ba591).Root cause
The #3146 fresh-session escape hatch (
src/server.ts,if (unknownBaseline && !growthArmed)) keyed onunknownBaseline = anonymous && session.stats.lastInputTokens <= 0. Theanonymousconjunct is a #553 trigger-side concern; dsh/codex/claude-code lanes stamp their own session ids, so their FIRST over-headroom request skipped the gate, hit the final fail-fast (413), andnoteLocalRefusal(#3846) pinned every retry — the session was dead from message one (2026-10-21 raccoon incident: ~227K calibrated estimate vs the 192001 headroom target while payload + clamped output budget fit the 256000 native window).Fix — three-arm arbitrate gate
unknownBaseline— original [Bug] 新会话(无 usage 基线)preflight 把字符数当 token——折叠其实成功(2263796→1111212)却 fail-fast 502,上游实际只计费 540828 #3146 anonymous arm, byte-for-byte unchanged.noUpstreamEvidence— extends "zero evidence → arbitrate" to IDENTIFIED fresh sessions, gated to DETERMINISTIC exhaustion (zero compressible ranges after maximum folding, 413 Deadlock: When an authenticated session exceeds the reservation window with zero collapsibles, the #3146 forwarding | 413 死锁:带身份会话超预留窗口且零可折叠时,#3146 转发门因 anonymous 条件不触发,会话从首条消息起永久不可用 #4185's shape). Relay-dependent failures (transient summary 503/429/524, empty/truncated summaries) keep the classic 502 fail-fast — the walk may recover, and forwarding then would hammer the upstream (fix: honor anthropic-beta context-1m to size the context window #301/[Bug] Codex 额度中断后恢复长会话,preflight SSE 摘要为空并持续 502 #726).nativeFitAfterClamp— regardless of baseline: the outbound body is already plugin mode: no hard backstop when the agent ignores the compress nudge — context grows past the window and upstream 400s #453/clampOutgoingOutput sizes max_tokens against the raw native window while preflight enforces the reserve-adjusted one — up to 25% of slack the clamp never sees #2096-clamped in prepare, so when outbound view + declared output budget fit the NATIVE window, forwarding is not a guaranteed-400; the headroom reservation is policy, not physics. Closed whenstatedWall > 0(upstream already stated its wall) — no loop.All arms keep the #2490 doomed-bytes 413, the #3846 local-refusal pin, and the
growthArmedbreaker.Evidence
tests/issue4185-identified-fresh-forward.test.tsreproduces the incident 413 ("exceeds the model window … NOT forwarded") with the exact raccoon shape (identified session, giant protected tool result, fresh baseline); green with this patch (forwarded once, usage baseline settles).max_tokens === 4096(arm3), doomed-bytes still 413, genuinely-over-native still 413.preflight-empty-summary9/9,preflight-stream-summary-config6/6,wire-exit-gap-cells5/5,preflight-fork-estimate([Bug] 新会话(无 usage 基线)preflight 把字符数当 token——折叠其实成功(2263796→1111212)却 fail-fast 502,上游实际只计费 540828 #3146) 2/2, codex e2e green (ACP_TEST_E2E=1).deterministicExhaustiongate above.Non-goals
item.content[]带 reasoning 的退化轮永不重试(客户端拿到空轮) #2756/[Bug][DSH] 长会话切换自定义模型后输出预算恢复到 249 token,连续 thinking-only / max-tokens(#1840 零上限来源场景) #2904), cold-load re-fold cost (v0.1.198 升级后老会话丢失压缩状态:197 折叠过的会话以 117 万 token 原文重放,预压缩超过客户端耐心,老会话看起来「炸了」 #3573).