Repository navigation
fix: retry transient empty summaries in preflight before failing the turn (#1767) - #1769
Merged
Merged
Conversation
Closed
Contributor
📦 Built Package ArtifactBranch: Option A — Install this exact build (recommended)npm install -g billion-context@0.0.1716-pr.1769.f86b0edThis exact version is immutable and reproducible. The rolling Option B — Download artifact
tar xzf billion-context-pr1769.tgz
npm install -g packageInstall instructions are refreshed on each push. |
Owner
Author
Owner
Author
[bot] 🏷 Review 完成 — 可以合并(附一个与本 PR 无关的既有 flaky 测试发现,已单独立项 #1770)。 ① 原 issue 方向核对(#1767)
② 回归审查(既有行为清点,逐项结论)
③ 代码审查
④ 测试有效性
⑤ diff 整洁度:3 文件( 验证证据
中文一句话总结:审了 PR #1769(preflight 对瞬时空摘要做 bounded 同 span 重试)——根因成立(content_filter 200 空响应 + 单消息 span 不可 halve = 一次 draw 定生死),方案打的是机制而非症状,回归清点全部保持或有意披露,测试有牙、diff 干净、CI 全绿,可以合并。 |
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.
What changed
src/preflight.ts: preflight now classifies each empty/too-short summary diagnosis as size-driven or transient, and retries transient ones on the same span a bounded number of times before falling through to the existing #726 halving cascade.emptySummaryIsSizeDriven(diagnosis)— a single regex over the test-pinned diagnosis strings. Only explicit SIZE signals (context_length_exceeded,too long,finish_reason=length,stop_reason=max_tokens) count as size-driven; everything else (content_filter, empty body, truncated stream, in-stream error) is a summarizer/gateway blip.SummaryOutcome.unusablegainstransient?: boolean, set from that classifier inrequestSummary.summarizeRangedraw in a retry loop: up toTRANSIENT_EMPTY_SUMMARY_RETRIES(2) extra same-span draws withreplayBackoffMsbackoff, capped by a per-protection-regimeTRANSIENT_EMPTY_RETRY_BUDGET(4, reset alongsidesummaryCallswhen soft protection relaxes) and the existingMAX_SUMMARY_CALLS_PER_PREFLIGHT(16) ceiling. Aborts honordeps.signal.Why (root cause)
#1767: a flash summarizer behind a gateway answered the preflight summary call with HTTP 200 plain JSON whose content was EMPTY (
finish_reason=content_filter). Preflight treated every empty answer as size-driven (halving cascade), but a single-message span cannot be halved — so the only range that could fit the payload got exactly one doomed draw, the turn fail-fasted 502 in-band, and the user had to send 继续 to re-trigger preflight ~90s later when the filter cleared. Re-drawing the same span a bounded number of times recovers the blip; the size-driven paths are untouched.Behavior change (old → new)
content_filter/empty-body/truncated-stream empties are gateway blips, not span-size problems; halving a single-message span is impossible, so without re-drawing the flaky summarizer the turn dies.Config surface
None. No config field, env var, or CLI flag added/renamed/re-semantics'd. (Reuses existing
BILI_REPLAY_RETRY_*backoff seams.)Tests
tests/preflight-transient-empty-retry.test.ts:content_filterdraws then success → turn recovers 200 with no client retry, exactly 2 failed draws, dead-end marker NOT left behind;content_filter→ 502preflight_compress_failed, diagnosis surfaced, summary calls bounded (≤32), dead-end arms, cooldown spends ZERO calls, nothing forwarded;tests/preflight-empty-summary.test.ts: zero-backoff env for speed;#780truncation bound raised 9→32 (truncation is now transient-classified, so each span gets up to two extra draws).Pre-flight
npm run typecheck✅npm test✅ 3235 pass / 0 fail / 12 skipped (gated e2e)npm run build✅Closes #1767