Repository navigation
fix(#1706): retire the BILI_STREAM_STALL_MS stall guard - #1715
Conversation
A stale BILI_STREAM_STALL_MS=400 export turned every thinking-phase silence into a false truncation (#1706). Local-model deployments legitimately go silent for minutes mid-stream, so no finite sub-budget is safe for everyone. Retire the guard entirely: upstream silence (prefill and mid-stream) is bounded solely by the always-on BILI_UPSTREAM_TIMEOUT_MS idle budget. Stale exports are ignored and named once at startup.
📦 Built Package ArtifactBranch: Option A — Install this exact build (recommended)npm install -g billion-context@0.0.1669-pr.1715.b8a61f3This exact version is immutable and reproducible. The rolling Option B — Download artifact
tar xzf billion-context-pr1715.tgz
npm install -g packageInstall instructions are refreshed on each push. |
[bot] 🏷 收到,正在按 PR Review 规范审查本 PR(方向 / 回归 / 代码 / 测试有效性 / diff 整洁度)。先核对分支与 master 的关系,再逐项过。稍后给出完整结论 + 中文摘要。 |
[bot] 🏷 Review complete — mergeable. Full walkthrough below. ① Direction (original issues). Verified against #1706's thread: incident root cause was the stale ② Regression audit — existing behaviors on touched paths, each checked:
③ Code. Clean removal at the decision point; the doc pin on ④ Test validity — real teeth, verified:
⑤ Diff & process. 5 files, every line on-purpose, no whitespace/lockfile churn, single linear commit on current master Gates (re-run locally on head One observation, not a blocker: the body says "References #1706 / #1714" rather than Per §7.4 this is human-merge territory (capability removal + fallback-semantics change) — ready when you are. Suggested order: merge #1715, then #1709 (independent), then confirm stability on your machine and close #1706. 中文摘要:审查了退役 |
Every behavior-class BILI_*/ACP_* env var (~70 names) is removed from bili's read surface and now lives only in config.json (canonical mapping + one-time boot warning in src/retired-env.ts). Transport/identity overrides, launcher IPC channels, secret material, and default-invariant test seams stay env-based by design. Also fixed on the way (disclosed per #1714 rule 4): - 24+ config.json fields were dead code in production (configure* setters never called): startServer + both live-reload paths now forward every knob from ProxyOptions, so file values actually take effect. - sessionsDir config field wired at startup + reloads (was env-only before). - -F flag: overrides.cliUpstreamProxy applied post-loadOptions instead of the retired BILI_UPSTREAM_PROXY env name (old path silently no-op'd). - attach evidence-grace / health-deadline and chain skew/recent-window knobs: env fallbacks replaced by programmatic opts/configure* setters (no new config fields — code knobs, not user surface). - BILI_STREAM_STALL_MS left out of RETIRED_ENV: master's #1715 dedicated boot warning already names it (avoid double warn).
Every behavior-class BILI_*/ACP_* env var (~70 names) is removed from bili's read surface and now lives only in config.json (canonical mapping + one-time boot warning in src/retired-env.ts). Transport/identity overrides, launcher IPC channels, secret material, and default-invariant test seams stay env-based by design. Also fixed on the way (disclosed per #1714 rule 4): - 24+ config.json fields were dead code in production (configure* setters never called): startServer + both live-reload paths now forward every knob from ProxyOptions, so file values actually take effect. - sessionsDir config field wired at startup + reloads (was env-only before). - -F flag: overrides.cliUpstreamProxy applied post-loadOptions instead of the retired BILI_UPSTREAM_PROXY env name (old path silently no-op'd). - attach evidence-grace / health-deadline and chain skew/recent-window knobs: env fallbacks replaced by programmatic opts/configure* setters (no new config fields — code knobs, not user surface). - BILI_STREAM_STALL_MS left out of RETIRED_ENV: master's #1715 dedicated boot warning already names it (avoid double warn).
Every behavior-class BILI_*/ACP_* env var (~70 names) is removed from bili's read surface and now lives only in config.json (canonical mapping + one-time boot warning in src/retired-env.ts). Transport/identity overrides, launcher IPC channels, secret material, and default-invariant test seams stay env-based by design. Also fixed on the way (disclosed per #1714 rule 4): - 24+ config.json fields were dead code in production (configure* setters never called): startServer + both live-reload paths now forward every knob from ProxyOptions, so file values actually take effect. - sessionsDir config field wired at startup + reloads (was env-only before). - -F flag: overrides.cliUpstreamProxy applied post-loadOptions instead of the retired BILI_UPSTREAM_PROXY env name (old path silently no-op'd). - attach evidence-grace / health-deadline and chain skew/recent-window knobs: env fallbacks replaced by programmatic opts/configure* setters (no new config fields — code knobs, not user surface). - BILI_STREAM_STALL_MS left out of RETIRED_ENV: master's #1715 dedicated boot warning already names it (avoid double warn).
What & why
#1706: a stale
export BILI_STREAM_STALL_MS=400on the reporter's machine turned every thinking-phase wire silence into a false truncation (upstream stream ended before a completion event). The #1452 opt-in stall guard measured silence after the first byte with any positive integer as a valid threshold — and local-model deployments legitimately go silent for minutes mid-stream (thinking phases, long prefills; the reporter's local model prefill runs ~500s). No finite sub-budget is safe for everyone, so per owner direction in #1706 the detector is retired entirely rather than relocated.First step of #1714 (env-var surface convergence).
Changes
src/fetch-util.ts: removedstreamStallMs()and its arm/re-arm/abort block fromfetchWithTimeout; body chunks now re-arm only the idle watchdog. Doc note pins the design decision: the idle budget is the SOLE silence bound, do not re-add a shorter timer.src/server.ts: at startup, ifBILI_STREAM_STALL_MSis set (any value) bili logs one warn naming it — stale shell exports announce themselves instead of silently dying ([config] BILI_STREAM_STALL_MS=400 is no longer read (#1714) …).tests/issue1452-socket-hardening.test.ts: parse test and per-byte re-arm test deleted (feature gone); the fire test becomes the retirement regression — stale400export + 3s idle budget: asserts the startup notice, that the cut happens at the idle budget (~3s, proving 400ms never fired), and the unchanged Plugin mode: upstream stream truncated before terminal event → client gets bare cut-off SSE (no completion/error event) #721 wire shape; the default-off test now sets the stale export and proves a 2s mid-stream silence survives it untouched.CONFIGURATION.md/CONFIGURATION.zh-CN.md: row converted to the strickenRemovedformat (precedent:BILI_HOST_USAGE_CREDIT).Behavior changes (old → new)
BILI_STREAM_STALL_MScould cut at ANY positive integer ms (e.g. stale 400 broke every thinking turn — #1706); default off → 12 minBILI_UPSTREAM_TIMEOUT_MSidle budget (default 720s, tunable up/down)No config-file field is added (nothing replaces the knob). No other behavior touched.
Gate
typecheck clean ·
npm test3279 pass / 0 fail / 17 skip · build OK (dist-import-annotations OK). Based on current master75c1e75c.Review note
Capability-surface removal → human-merge territory (§7.4). References #1706 (incident) and #1714 (convergence plan, step P1 pivoted from "migrate to file" to "retire").