Repository navigation
[PR] fix(preflight): structurally doomed futile rounds answer 413/non-retryable instead of a 502 spin (#4563) - #6617
Open
ranxianglei wants to merge 1 commit into
Conversation
…nistic (#4563) The tier-distillation-recovery-failed exhaustion site was the one site omitting the deterministic flag, so a futile round that walked the whole pool (no foldable target left, net ~0 saved) was answered 502/retryable and status-code-driven hosts spun on a payload that can never fit. Carry the recovery's own structural determination into the verdict: structural -> 413/non-retryable (server.ts maps exhausted+deterministic+!fitsWindow to 413), relay-dependent -> 502 (progress may continue on a smaller baseline). Also name WHY an unavailable stop happened (a projection that resolved to no target is not a summarizer outage).
Contributor
📦 Built Package ArtifactBranch: Latest build — install this exact versionnpm install -g billion-context@0.0.9668-pr.6617.18414f5This exact version is immutable and reproducible. The rolling Recent builds (commit → version)
Download artifact
tar xzf billion-context-pr6617.tgz
npm install -g packageInstall instructions are refreshed on each push. |
Owner
Author
This branch has not been deployed
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.
Closes #4563
Problem
A preflight round that walks the whole compression pool and still cannot fit the
payload — no foldable target left, net ~0 tokens saved — was answered 502 /
retryable. Status-code-driven hosts (opencode, OMP) read a 502 as transient and
spun the full retry budget (~10 × ~84s) on a payload that can never fit. A second
field report (bili 0.1.212, OMP host) confirms the same spin even when bili logs
retryable=false: the host keys on the 502 status code, not the flag. The logalso said "the distillation summary was unavailable" with 0 summary calls —
misleading, because no summary was even attempted (the fold projection resolved
the span to nothing; that is not a summarizer outage).
Root cause
preflightCompresshas fiveexhaustedverdict sites. Four of them set thedeterministicfield; the tier-distillation-recovery-failed site — the one afutile near-window round actually hits — omitted it.
deterministic=undefined(falsy) means the server never takes the 413 path, and
progressContinues(
exhausted && !deterministic && compressedRanges>0, server.ts:4682) fires on thefold count, not net shrink — so a net-0 round is advertised as "progress may
continue" and answered 502/retryable.
Fix (at the producer, not the server)
Track the structural termination cause inside
attemptTierRecoveryand carry itinto the verdict as the
deterministicflag:deterministic=true: nocandidate span survived the position/budget gates; the fold projection resolved
the span to no target; the projection refused the apply; or a distill netted
nothing with nothing saved before it.
deterministic=false: the summarycall threw; the summary was unusable; the fold targets changed while awaiting
the summary; or the bounded call-budget cap was hit.
server.tsalready mapsexhausted && deterministic && !payloadFitsWindow→413 (server.ts:4675) and derives
retryablefrom!deterministicviaprogressContinues(server.ts:4682/4690) — so no server change is needed.Structural futile rounds now answer 413 / non-retryable (a status hosts honor
as terminal); relay-dependent failures stay 502 / retryable (a recovered relay
can complete the distill, so retrying is legitimate).
Also disambiguate the "unavailable" why: each stop site now names the real cause
(a projection that resolved to no target is reported as such, not as a summarizer
outage).
Behavior change (disclosed)
net ~0 saved) → 502,
retryabletrue (viaprogressContinues) or false(via
compressedRanges==0) — both spin status-code-driven hosts.retryable=false. Hosts treat 413 asterminal and stop retrying.
unusable summary, racy target, budget cap) still → 502 / retryable — a
recovered relay can complete the distill.
Tests
Two regression tests in
tests/issue2952-preflight-tier-recovery.test.ts(reusing that file's harness), asserting both directions (gate-test discipline):
deterministic=true(→ 413);deterministic=false(→ 502).
npm run typecheckclean; targeted suites green (issue2952-preflight-tier-recovery6/6,
preflight-empty-summary9/9). Full-suite verdict is the remote CItestlanes on the pushed head.