Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/configuration.ja.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@
| `network` | object | {} (all defaults) | — | 上流呼び出しのタイムアウト、ウォッチドッグ、リプレイポリシー。 |
| `network.upstreamTimeoutMs` | number | 720000 | BILI_UPSTREAM_TIMEOUT_MS | 単一の上流呼び出しに対する絶対上限(12分は、遅い深層思考モデルをカバーする)。 |
| `network.upstreamFirstByteMs` | number | = upstreamTimeoutMs (resolved; 720000 when unset) | BILI_UPSTREAM_FIRST_BYTE_MS | フェーズ1の予算:リクエスト送信 → 最初のレスポンスバイト(undiciは最初のボディデータ付近でfetchを解決する)。未設定の場合、解決済みの上流タイムアウト(upstreamTimeoutMs)に従う — BILI_UPSTREAM_TIMEOUT_MS を12分以上に引き上げるデプロイメントを含む(#5917 レビュー:定数 720000 のフォールバックはそれらを静かに再制限してしまう)— したがって動作は変更されない;より厳格なデプロイメントはオプトインする(#5904:リクエストを受け入れるが以前は応答しなかったスタックした上流は、クライアントが中断するまで静かにハングしていた)。最初のバイト後、チャンク間の沈黙は引き続き完全な upstreamTimeoutMs によって管理される(#1706/#1714 の保証)。この値が upstreamTimeoutMs 未満に設定されると、最初のバイトのタイムアウトは独自の失敗クラス upstream-headers-timeout となる — レスポンスバイトがゼロであるため、bili はリクエスト全体を一度で失敗させるのではなく、既存のリトライ予算(BILI_REPLAY_RETRY_MAX、デフォルト 3)の下でプロキシ内でリプレイする;ストリーム中(ボディ)のアイドルタイムアウトは upstream-timeout のままであり、リトライされない。未設定の場合、動作は以前とバイト単位で同一である(#5807/#5831)。リリースゲートは 120000 を設定する。 |
| `network.wsIdleTimeoutMs` | number | 600000 | BILI_WS_IDLE_TIMEOUT_MS | Responses WebSocket レグのイベント間アイドル予算(#6171):上流フレームのたびに再アームされるため、安定したストリーミングでは決してトリガーされず、完全なスタック時のみ発火する。ハンドシェイクも対象(アップグレードがスタックしても永遠に待たず即失敗する)。発火時、その交換は単一の終端状態を取得し、同一 conn/session スタンプの下で相関可能な `upstream failed … event=timeout reason=idle-timeout` ログ行を出力し、接続を切断して次のターンで新たに再接続する。以前は完全にスタックした WS 交換はクライアントが諦めるまでハングしていた — HTTP レグの対応物は BILI_UPSTREAM_TIMEOUT_MS。 |
| `network.requestWatchdogMs` | number | 2× upstreamTimeoutMs | BILI_REQUEST_WATCHDOG_MS | 呼び出しごとのタイマーが設定されていなくても、スタックした上流ソケットを強制中断する絶対的なウォッチドッグ。 |
| `network.keepAliveTimeoutMs` | number | 5000 | BILI_KEEP_ALIVE_TIMEOUT_MS | プールされた上流ソケットのアイドルキープアライブタイムアウト。 |
| `network.clientErrorBackstopMs` | number | 30000 | BILI_CLIENT_ERROR_BACKSTOP_MS | コミットされたレスポンスの読み取りを停止したクライアント接続を中断するバックストップ。 |
Expand Down Expand Up @@ -2057,6 +2058,7 @@ ACP ネイティブエージェント(現在は `pi` 拡張機能)は、プ
| `BILI_UPSTREAM_PROXY` | `proxy` | unset (direct) |
| `BILI_UPSTREAM_PROXY_MODE` | `upstreamProxyMode` | auto (unset behaves as direct) |
| `BILI_UPSTREAM_TIMEOUT_MS` | `network.upstreamTimeoutMs` | 720000 |
| `BILI_WS_IDLE_TIMEOUT_MS` | `network.wsIdleTimeoutMs` | 600000 |
| `BILI_WS_OUTBOUND_BYTES` | `network.wsOutboundBytes` | 10485760 |
| `PI_ACP_DELEGATE_ASYNC_TIMEOUT_MINUTES` | `pi.subagents` | {} (acp_delegate enabled with package defaults) |
| `PI_ACP_DELEGATE_FORCE_ENABLE` | `pi.subagents` | {} (acp_delegate enabled with package defaults) |
Expand Down
3 changes: 3 additions & 0 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ This index is generated from `website/config-reference/*.yaml` — edit the seed
| `network` | object | {} (all defaults) | — | Transport timeouts, watchdogs and replay policy for upstream calls. |
| `network.upstreamTimeoutMs` | number | 720000 | BILI_UPSTREAM_TIMEOUT_MS | Hard ceiling on a single upstream call (12 min covers slow deep-thinking models). |
| `network.upstreamFirstByteMs` | number | = upstreamTimeoutMs (resolved; 720000 when unset) | BILI_UPSTREAM_FIRST_BYTE_MS | Phase-1 budget: request sent → first response byte (undici resolves the fetch around the first body data). Unset follows the RESOLVED upstreamTimeoutMs — including deployments that raise BILI_UPSTREAM_TIMEOUT_MS above 12 min (#5917 review: a constant 720000 fallback would silently re-cap them) — so behavior is unchanged; tighter deployments opt in (#5904: a wedged upstream that accepts requests but never answered previously hung silently until the client aborted). After the first byte, chunk-gap silence stays governed by the full upstreamTimeoutMs (#1706/#1714 guarantee). When this value is set BELOW upstreamTimeoutMs, a first-byte timeout becomes its own failure class `upstream-headers-timeout` — zero response bytes were received, so bili replays it in-proxy under the existing retry budget (BILI_REPLAY_RETRY_MAX, default 3) instead of failing the whole request once; the mid-stream (body) idle timeout stays `upstream-timeout` and non-retried. Unset, behavior is byte-identical to before (#5807/#5831). The release gate sets 120000. |
| `network.wsIdleTimeoutMs` | number | 600000 | BILI_WS_IDLE_TIMEOUT_MS | Inter-event idle budget for the Responses WebSocket leg (#6171): any upstream frame re-arms it, so steady streaming never trips it — only a full stall does. The handshake is covered too (a wedged upgrade fails fast instead of waiting forever). On fire the exchange gets its single terminal state, a correlatable `upstream failed … event=timeout reason=idle-timeout` log line under the same conn/session stamp, and the connection drops so the next turn reconnects fresh. Previously a fully stalled WS exchange hung until the client gave up — the HTTP lane's equivalent is BILI_UPSTREAM_TIMEOUT_MS. |
| `network.requestWatchdogMs` | number | 2× upstreamTimeoutMs | BILI_REQUEST_WATCHDOG_MS | Absolute watchdog that force-aborts a stuck upstream socket even when the per-call timer was never armed. |
| `network.keepAliveTimeoutMs` | number | 5000 | BILI_KEEP_ALIVE_TIMEOUT_MS | Idle keep-alive timeout for pooled upstream sockets. |
| `network.clientErrorBackstopMs` | number | 30000 | BILI_CLIENT_ERROR_BACKSTOP_MS | Backstop that aborts a client connection that stops reading a committed response. |
Expand Down Expand Up @@ -2070,6 +2071,7 @@ File keys resolve only when the matching env var is unset. Defaults in parenthes
| `BILI_UPSTREAM_PROXY` | `proxy` | unset (direct) |
| `BILI_UPSTREAM_PROXY_MODE` | `upstreamProxyMode` | auto (unset behaves as direct) |
| `BILI_UPSTREAM_TIMEOUT_MS` | `network.upstreamTimeoutMs` | 720000 |
| `BILI_WS_IDLE_TIMEOUT_MS` | `network.wsIdleTimeoutMs` | 600000 |
| `BILI_WS_OUTBOUND_BYTES` | `network.wsOutboundBytes` | 10485760 |
| `PI_ACP_DELEGATE_ASYNC_TIMEOUT_MINUTES` | `pi.subagents` | {} (acp_delegate enabled with package defaults) |
| `PI_ACP_DELEGATE_FORCE_ENABLE` | `pi.subagents` | {} (acp_delegate enabled with package defaults) |
Expand Down Expand Up @@ -2128,6 +2130,7 @@ File keys resolve only when the matching env var is unset. Defaults in parenthes
| `BILI_REPLAY_RETRY_MAX` | Total attempts for replay retries (default `3`; set `1` to disable retries entirely — legacy single-attempt behavior). See #189. On the acp-loop/preflight/compress loops it applies to both transient HTTP failures and #1263 fail-fast network failures (pre-response reset/refused — proxy-recycle class), never to timeout/abort kinds. On the main model-request path (#1688) only fail-fast pre-response network failures are replayed; HTTP verdicts (4xx/5xx) always pass through verbatim, untried again. |
| `BILI_PROXY_KEEPALIVE_MAX_MS` | Keep-alive reuse ceiling (ms) for connections through an upstream proxy (default `55000`). Common proxies recycle idle tunnels on a ~60s cadade; capping our reuse window below that trades a few reconnects for the classic "first request after idle dies with ECONNRESET" failure (#1263). `0` = uncapped (undici defaults). Direct (non-proxied) connections are unaffected. |
| `BILI_UPSTREAM_TIMEOUT_MS` | Idle budget (ms) for upstream requests: time-to-first-byte and time between body chunks (default `720000` = 12 min). A healthy stream that keeps producing chunks is never cut mid-flight; a silent one is. The same value drives the underlying HTTP client's transport timeouts, so this single knob bounds long local-model prefills end-to-end (#551). |
| `BILI_WS_IDLE_TIMEOUT_MS` | Inter-event idle budget (ms) for the Responses WebSocket leg (#6171): any upstream frame re-arms it, so steady streaming never trips it — only a full stall does. It covers the handshake too (a wedged upgrade fails fast instead of waiting forever). On fire the exchange gets its single terminal state — one synthesized client error frame plus the connection drop, so the next turn reconnects fresh — and a correlatable `upstream failed … event=timeout reason=idle-timeout` log line under the same conn/session stamp. Previously a fully stalled WS exchange hung until the client gave up; this is the WS leg's equivalent of `BILI_UPSTREAM_TIMEOUT_MS`. Default `600000` = 10 min (owner-set on #6171); non-integer or non-positive values fall back to the default. File-config key: `network.wsIdleTimeoutMs`. |
| `BILI_CA_FILE` | Path to a PEM file with extra root CAs for bili's own upstream TLS trust (#3776). Security software doing HTTPS/encrypted-connection scanning (Kaspersky, enterprise DLP) or a corporate MITM proxy re-signs the upstream with its own CA: browsers trust it via the OS certificate store, but Node's fetch reads only its built-in roots plus `NODE_EXTRA_CA_CERTS` — so bili fails with `SELF_SIGNED_CERT_IN_CHAIN` while the rest of the machine connects fine. Export the scanner/vendor root to PEM and set this (or `NODE_EXTRA_CA_CERTS`); alternatively exclude node.exe from the software's HTTPS inspection. The file is MERGED with Node's built-in roots and any `NODE_EXTRA_CA_CERTS` entries — never replaces them. Unset = today's default trust, byte-for-byte. File-config key: `network.caFile`. |
| ~~`BILI_STREAM_STALL_MS`~~ | **Removed in #1714** (the #1452 opt-in streaming-phase stall guard is retired). In #1706 a stale `400` export turned every thinking-phase silence into a false truncation; local-model deployments legitimately go silent for minutes mid-stream (thinking phases, long prefills), so no finite sub-budget was safe for everyone. Upstream silence — prefill and mid-stream alike — is now bounded solely by the always-on `BILI_UPSTREAM_TIMEOUT_MS` idle budget (default 12 min, tunable). Old values are ignored; bili names a stale export once at startup (`no longer read`) — remove it from your shell profile. |
| `BILI_KEEP_ALIVE_TIMEOUT_MS` | Keep-alive timeout (ms) for client-facing sockets (default `5000`, matching Node's implicit default; #1452). Idle client connections are reaped with a clean FIN by Node's built-in reaper; this makes the previously implicit value explicit and configurable, and the reap is classified as `reason=idle-timeout` in the connection lifecycle ledger (debug log). Non-numeric or non-positive values fall back to `5000`. |
Expand Down
3 changes: 3 additions & 0 deletions docs/configuration.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@
| `network` | object | {} (all defaults) | — | 上游调用的传输超时、看门狗与重放策略。 |
| `network.upstreamTimeoutMs` | number | 720000 | BILI_UPSTREAM_TIMEOUT_MS | 单次上游调用的硬上限(12 分钟覆盖慢速深度思考模型)。 |
| `network.upstreamFirstByteMs` | number | = upstreamTimeoutMs (resolved; 720000 when unset) | BILI_UPSTREAM_FIRST_BYTE_MS | 阶段一预算:请求发出 → 首个响应字节(undici 在首个 body 数据到达时才 resolve fetch)。未设时跟随解析后的 upstreamTimeoutMs——包括把 BILI_UPSTREAM_TIMEOUT_MS 提到 12 分钟以上的部署(#5917 评审:常量 720000 回落会悄悄把它们压回 12 分钟)——行为不变;需要更快约束首字节时延的部署可显式收紧(#5904:上游接收请求后永不应答的卡死,之前会静默拖到客户端中止)。首字节到达后,chunk 间隙静默仍由完整 upstreamTimeoutMs 管辖(#1706/#1714 保证)。当该值被收紧到低于 upstreamTimeoutMs 时,首字节超时成为独立失败类 `upstream-headers-timeout`——因为一个响应字节都未收到,bili 会在代理内按既有重试预算(BILI_REPLAY_RETRY_MAX,默认 3 次)重放,而不是让整步只失败一次;流中途(body)空闲超时仍是 `upstream-timeout` 且不重试。未设时行为与之前逐字节一致(#5807/#5831)。发布 gate 设 120000。 |
| `network.wsIdleTimeoutMs` | number | 600000 | BILI_WS_IDLE_TIMEOUT_MS | Responses WebSocket 车道的逐事件空闲预算(#6171):任何上游帧都会重新上弦,所以稳定流式永不触发——只有完全卡死才会。握手阶段同样受管(升级卡死会快速失败而不是永远等待)。触发时该交换获得唯一终态、同一 conn/session 标识下可关联的 `upstream failed … event=timeout reason=idle-timeout` 日志行,并断开连接让下一轮重新连接。此前完全卡死的 WS 交换会一直挂到客户端放弃——HTTP 车道的对应物是 BILI_UPSTREAM_TIMEOUT_MS。 |
| `network.requestWatchdogMs` | number | 2× upstreamTimeoutMs | BILI_REQUEST_WATCHDOG_MS | 绝对看门狗:即使按调用计时器从未挂上,也强制中止卡死的上游套接字。 |
| `network.keepAliveTimeoutMs` | number | 5000 | BILI_KEEP_ALIVE_TIMEOUT_MS | 连接池内上游套接字的空闲保活超时。 |
| `network.clientErrorBackstopMs` | number | 30000 | BILI_CLIENT_ERROR_BACKSTOP_MS | 中止停止读取已提交响应的客户端连接的兜底超时。 |
Expand Down Expand Up @@ -2047,6 +2048,7 @@ ACP 原生 agent(当前为 `pi` 扩展)会在每个进程内向代理上报
| `BILI_UPSTREAM_PROXY` | `proxy` | unset (direct) |
| `BILI_UPSTREAM_PROXY_MODE` | `upstreamProxyMode` | auto (unset behaves as direct) |
| `BILI_UPSTREAM_TIMEOUT_MS` | `network.upstreamTimeoutMs` | 720000 |
| `BILI_WS_IDLE_TIMEOUT_MS` | `network.wsIdleTimeoutMs` | 600000 |
| `BILI_WS_OUTBOUND_BYTES` | `network.wsOutboundBytes` | 10485760 |
| `PI_ACP_DELEGATE_ASYNC_TIMEOUT_MINUTES` | `pi.subagents` | {} (acp_delegate enabled with package defaults) |
| `PI_ACP_DELEGATE_FORCE_ENABLE` | `pi.subagents` | {} (acp_delegate enabled with package defaults) |
Expand Down Expand Up @@ -2138,6 +2140,7 @@ ACP 原生 agent(当前为 `pi` 扩展)会在每个进程内向代理上报
| `BILI_UPSTREAM_PROXY` | 代理自身出站连接的上游代理 —— 在*全局*来源中优先级最高(高于 Web UI 手动代理与配置文件 `proxy`)。per-URL 的 `providers.<url>.proxy` 对其匹配的 provider URL 仍然优先。完整解析顺序、防环规则与示例见 [服务端设置 → `proxy`](#服务端设置)。 |
| `BILI_INHERITED_HTTP_PROXY` / `BILI_INHERITED_HTTPS_PROXY` / `BILI_INHERITED_ALL_PROXY` / `BILI_INHERITED_NO_PROXY` | 非用户直接使用 —— launcher 起代理子进程时自动设置(#1012)。launcher 会从客户端和代理子进程两侧剥掉 shell 的代理变量(客户端必须把流量发给 bili;代理的模型出网也不能被 shell 代理劫持),但会把用户剥离前的代理转发到这些变量里,让代理的**辅助出网**(MITM 盲隧道 —— 客户端侧的 MCP/web 流量)仍能走用户的 VPN。它们只作用于盲隧道的 fallback 层:显式路由 / 全局 `proxy` / `BILI_UPSTREAM_PROXY` / 显式 `"upstreamProxyMode": "direct"` 仍然优先,指向 bili 自身端口的值会被丢弃。模型出网不受影响(未显式配置则保持直连)。 |
| `BILI_UPSTREAM_TIMEOUT_MS` | 上游请求的空闲预算(毫秒):首字节时间(TTFB)与响应体块之间的间隔(默认 `720000` = 12 分钟)。持续产出数据块的健康流永远不会被中途切断;静默的流才会。同一个值同时驱动底层 HTTP 客户端的传输层超时,因此这一个旋钮即可端到端约束本地大模型的超长 prefill(#551)。 |
| `BILI_WS_IDLE_TIMEOUT_MS` | Responses WebSocket 车道的逐事件空闲预算(毫秒)(#6171):任何上游帧都会重新上弦,所以稳定流式永不触发——只有完全卡死才会。握手阶段同样受管(升级卡死会快速失败而不是永远等待)。触发时该交换获得唯一终态——一帧合成的客户端错误加断开连接(下一轮重新连接)——并在同一 conn/session 标识下记一条可关联的 `upstream failed … event=timeout reason=idle-timeout` 日志行。此前完全卡死的 WS 交换会一直挂到客户端放弃;本旋钮是 WS 车道上 `BILI_UPSTREAM_TIMEOUT_MS` 的对应物。默认 `600000` = 10 分钟(owner 在 #6171 拍板);非整数或非正值回落到默认值。文件配置键:`network.wsIdleTimeoutMs`。 |
| `BILI_CA_FILE` | 指向一个 PEM 文件的路径,包含要额外信任的根 CA(#3776),仅作用于 bili 自己的上游 TLS。做 HTTPS/加密连接扫描的安全软件(卡巴斯基、企业 DLP)或企业 MITM 代理会用自家 CA 重签上游:浏览器通过系统证书库信任它,但 Node 的 fetch 只读内置根证书加 `NODE_EXTRA_CA_CERTS`——于是 bili 报 `SELF_SIGNED_CERT_IN_CHAIN`,而机器上其他一切连接正常。把扫描软件/厂商根证书导出为 PEM 后设置此项(或 `NODE_EXTRA_CA_CERTS`);或在安全软件的 HTTPS 检查中排除 node.exe。该文件与 Node 内置根证书及 `NODE_EXTRA_CA_CERTS` 条目合并——从不替换。未设置 = 当前默认信任,逐字节不变。配置键:`network.caFile`。 |
| `BILI_ATTACH_HEALTH_DEADLINE_MS` | dsh/opencode attach 校验中,attach 目标已挂但本进程模型通道**钉死**在其上(观察到指向它的 `/bili/…` 路由流量)时的健康等待上限(毫秒):bili 等待目标恢复而不是 spawn 第二实例——spawn 会把会话劈成两半(模型流量保持钉死,bili 工具在另一实例上 404)。超时后大声报错,并在每次模型请求时持续重查直到目标恢复(默认 `15000`)。见 #1365。 |
| `BILI_ATTACH_EVIDENCE_GRACE_MS` | dsh/opencode attach 校验探测到目标已挂时,等待路由通道证据出现的宽限窗口(毫秒),超时才回退到旧的 spawn 路径(覆盖「判定早于首个请求」的竞态:t≈0 时探测失败、t≈1s 时首个模型请求才落地)(默认 `5000`)。见 #1365。 |
Expand Down
Loading
Loading