Repository navigation
fix: preflight logs every silent skip reason and reports real causes (#1372) - #1374
Conversation
📦 Built Package ArtifactBranch: Option A — Install from npm PR tag (recommended)npm install -g billion-context@pr-1374Each push to this PR publishes a new version under the Option B — Download artifact
tar xzf billion-context-pr1374.tgz
npm install -g packageInstall instructions are refreshed on each push. |
[bot] 🏷 Picked up this [PR] mirror. This is completed work (PR for #1372), so I'm not redoing it — verifying now: pulling branch |
[bot] 🏷 Verification complete — PR verified clean, ready to merge. This is completed work, so I did not redo it: pulled the branch, cross-checked the code against live master, re-ran the full pre-flight locally, and audited CI. Branch / base. Single linear commit Code review (main gate).
Tests (quality gate). The new file is a real regression pair, both would fail on master: (a) unreachable upstream + Pre-flight (re-run by me on the rebased head). CI. All 10 check runs on Behavior changes (disclosed, intentional). (1) The 502 preflight-exhaustion detail now reports the ACTUAL per-range skip causes (top 3, joined) instead of the static Auto-merge gate (§7.4). Passes all eight conditions: single-module fix, reproducing regression tests, green on the rebased head, no config/persistence/wire/cross-repo impact, pure 中文摘要:核验了 preflight 静默跳过诊断修复(#1372)——七个跳过点全部补上日志、502 详情改为报告真实原因(旧文案仅作零证据兜底),diff 范围干净、本地 typecheck/测试(2637 过 0 败)/构建全绿、CI 十项全过、与唯一同文件在途 PR(#1360)无冲突,符合 auto-merge 标准,可以合并。 |
|
深审通过(独立验证,零改动): 设计核验:#1372 的两个病灶都堵上了——
实测:新 issue1372 测试 10/10(含端口 9 反证——若 preflight 真发了摘要调用会以 一处行为翻转核实: 合并无阻塞。 |
[bot] 🏷 收到——你的独立深审与我的核验结论完全一致(6 类跳过点全覆盖、真实前三条原因替换猜测句、 我这边额外留档的两个数据点供合并参考:CI 十项 check runs 全绿(test 矩阵 ubuntu/windows × node 22/24 + version-guard + build-artifact + hermetic registry e2e + codex/pi 双 lane);本地全量测试 2637 pass / 0 fail(2648 total),与 PR 声明的 pre-flight 数字逐字一致。 按规矩合并只能由你操作:#1374 —— 合并后 CI 会自动发布。 中文摘要:独立复核与我的验证结论一致,PR 已确认零改动可合,等待人工合并。 |
What & why
#1372: when the preflight fallback cannot compress, it fails with
no range could be compressed across N viable range(s)while zero logs explain where each range died — and the hardcoded cause list in the message misrepresents the actual failure stage. In #1365 this left a stuck session completely undiagnosable (the check was millisecond-scale with zero upstream calls, i.e. every range died at preview/apply before any summarization), and the plugin compress path succeeded on the exact same ranges.Triage verified two distinct defects with one root cause — silent skip points in
src/preflight.ts:!planned— the kernel'sresult.errors/warningsverdict was read and then discarded), per-item render drops, empty content after render, plus the already-logged summary-unusable/apply-failed paths never contributed to the final message.(each was below minCompressRange, had an unusable summary, or failed to apply)regardless of what actually happened — including saying "across 0 viable ranges" when every range died at ref-resolution.On the alignment question (issue item 2): both paths call the same kernel
applyCompressionwith symmetric validation, so identical inputs yield identical verdicts. The inputs legitimately differ by pipeline position (preflight = current-request messages + live config, pre-forward; plugin = remembered snapshot + stamped effectiveConfig, post-response). Full unification is neither possible nor appropriate — the fix makes both sides' verdicts diffable: the plugin path already surfaces kernel errors (applyRanges, src/stream.ts); now the preflight path does too.Changes (src/preflight.ts only + tests)
warnlog with the concrete reason (the preview-rejection case includes the kernel's ownerrors/warningstext, e.g.Summary too long (L chars, max M)or the minCompressRange gate message).no viable range could be compressed).no foldable compressible ranges remain: all N viable range(s) are below minCompressRange (M chars).Behavior change disclosure (output format)
no range could be compressed across N viable range(s) (each was below minCompressRange, had an unusable summary, or failed to apply). New:no range could be compressed across N viable range(s): <actual per-range reasons>; new variantno viable range could be compressed: <reasons>when zero ranges reached the walk. Budget-exhausted / relaxed / rounds-exhausted details may gain a trailingSkipped: …. Why: the old text asserted a fixed cause set that frequently did not match reality (the bug: dsh-native — attach 目标瞬时不可达 → 回退 spawn 第二实例:routed baseURL 下工具/模型通道必然脑裂(工具 404 → preflight 502 → 会话不可自愈) #1365 dead-end).Tests
tests/issue1372-preflight-skip-diagnostics.test.ts: (a) forces every range to die at the preview stage (dummy summary violates the kernel length gate) against an unreachable port — asserts zero upstream calls, warn log carries the kernel'sSummary too longverdict, and the 502 detail names the real cause instead of the boilerplate; (b) injects nudge ranges citing refs from another session generation (the bug: dsh-native — attach 目标瞬时不可达 → 回退 spawn 第二实例:routed baseURL 下工具/模型通道必然脑裂(工具 404 → preflight 502 → 会话不可自愈) #1365 brain-split shape) — asserts the unresolvable-refs warn and truthful detail.tests/preflight-covered-ranges.test.ts: replaced one assertion that pinned the OLD silent behavior (logs.every(!includes("already covered"))) with one pinning the new diagnostic (preview rejected … already covered). The behavioral guarantee itself (covered raw is never re-summarized) remains pinned by the existing HIDDEN_RAW assertion.Pre-flight (rebased onto current master d3c8af8)
npm run typecheck— cleannpm test— 2637 pass / 0 fail (2648 total)npm run build— successe2e-codex): NOT run locally — sandbox has no reachable Responses upstream (127.0.0.1:8199 refused), andsrc/preflight.tsis not in.github/workflows/ci-e2e.ymlauto-trigger paths, so this PR does not trigger the e2e job automatically. The change is strictly additive diagnostics (log lines + failure-detail text); no wire-path or decision-logic change. Recommend a manual dispatch of the e2e workflow if desired.Fixes #1372