From 9c58af52600df2b47e5dd35a66d2e9685a4d2c04 Mon Sep 17 00:00:00 2001 From: awork Date: Fri, 16 Oct 2026 13:48:01 +0800 Subject: [PATCH 1/5] docs: correct warmMax default to 0 in CONFIGURATION env row (#3344) The env-variable description row still said 'default 8' while L173 and the env table already say 0 (the code default is 0 since #3050). One-line fix in en + zh. --- CONFIGURATION.md | 2 +- CONFIGURATION.zh-CN.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CONFIGURATION.md b/CONFIGURATION.md index f398f1d02f..d42089569e 100644 --- a/CONFIGURATION.md +++ b/CONFIGURATION.md @@ -1787,7 +1787,7 @@ File keys resolve only when the matching env var is unset. Defaults in parenthes | `BILI_PERSIST_EPERM_ALERT_REPEAT_MS` | Re-alert window for the persist EPERM alert, in ms. `0` (default) = alert once then stay silent; `>0` = re-alert at most every that many ms while the failures continue. | | `BILI_TUNNEL_ALLOWED_HOSTS` | `/bili/` tunnel admission for **remote clients** (#409): comma-separated `host` or `host:port` entries that unlock loopback/private destinations (e.g. a LAN relay or the machine's own sglang) for non-loopback clients. The proxy itself and link-local/metadata addresses are always denied; local (loopback) clients always pass. | | `BILI_MAX_SESSIONS` | Max sessions held in memory (default `256`; LRU eviction — disk is the source of truth). | -| `BILI_SESSION_WARM_MAX` | Bounded startup (#2803): max most-recently-saved sessions hydrated at boot before listening (default `8`, capped by `sessions.max`); older state reloads on demand. `0` warms none. File twin: `sessions.warmMax`. | +| `BILI_SESSION_WARM_MAX` | Bounded startup (#2803): max most-recently-saved sessions hydrated at boot before listening (default `0` = warm none, capped by `sessions.max`); older state reloads on demand. Set e.g. `8` to restore eager warming of the recent set. File twin: `sessions.warmMax`. | | `BILI_SESSION_WARM_MAX_BYTES` | Decoded-byte budget for the boot warm set (#2803; default `67108864` = 64 MiB). Counts DECODED size, not compressed on-disk bytes, so zstd archives cannot sneak past the RAM bound. A single file over the budget is never warmed. File twin: `sessions.warmMaxBytes`. | | `BILI_SESSION_RESIDENT_MAX_BYTES` | Soft target for estimated resident session bytes (#2803; default `536870912` = 512 MiB). Active/in-flight state stays pinned above it (the byte budget limits the idle cache, not active workload); when over target, idle state discharges back to disk as requests complete. File twin: `sessions.residentMaxBytes`. | | `BILI_PUBLIC_SNAPSHOT_CAP_BYTES` | Retention cap (bytes) for the raw wire-history snapshot kept per plugin session to serve the public fork API (#2017). A plugin session whose serialized snapshot exceeds the cap stops being forkable — `GET /__bili/plugin/snapshot` and `POST /__bili/plugin/fork` fail closed with `409` and the capped reason — instead of retaining an unbounded raw copy of the history forever. The cap is re-evaluated on every plugin model request: a session that shrinks back under the cap (after a fork trimmed it, or the host shrank the history) resumes being forkable. Default `104857600` (100 MiB); `0` disables retention entirely (no session is forkable; existing snapshots are dropped on the next request). File twin: `plugin.snapshotCapBytes`. | diff --git a/CONFIGURATION.zh-CN.md b/CONFIGURATION.zh-CN.md index 316a208b36..a75515c704 100644 --- a/CONFIGURATION.zh-CN.md +++ b/CONFIGURATION.zh-CN.md @@ -1783,7 +1783,7 @@ ACP 原生 agent(当前为 `pi` 扩展)会在每个进程内向代理上报 | `BILI_PERSIST_EPERM_ALERT_THRESHOLD` | 同一会话连续 N 次持久化写失败(`EPERM`/`EBUSY`/`EACCES`)后触发一次性「把该目录加入杀软排除项」告警的阈值(默认 `5`)。仅 Windows。见下文「Windows:把会话目录加入杀软排除项」章节。 | | `BILI_PERSIST_EPERM_ALERT_REPEAT_MS` | persist EPERM 告警的重复窗口(毫秒)。`0`(默认)= 只告警一次后静默;`>0` = 失败持续期间最多每这么久重复告警一次。 | | `BILI_MAX_SESSIONS` | 内存中最多保留的会话数(默认 `256`;LRU 淘汰 —— 磁盘是事实源)。 | -| `BILI_SESSION_WARM_MAX` | 有界启动(#2803):监听前启动时最多预加载的最近保存会话数(默认 `8`,受 `sessions.max` 封顶);更早的状态按需重载。`0` 表示不预热。文件侧对应:`sessions.warmMax`。 | +| `BILI_SESSION_WARM_MAX` | 有界启动(#2803):监听前启动时最多预加载的最近保存会话数(默认 `0` = 不预热,受 `sessions.max` 封顶);更早的状态按需重载。设为如 `8` 可恢复对最近集的热加载。文件侧对应:`sessions.warmMax`。 | | `BILI_SESSION_WARM_MAX_BYTES` | 启动预热集的解码字节预算(#2803;默认 `67108864` = 64 MiB)。计的是**解码后**尺寸而非磁盘压缩字节,zstd 归档无法绕过内存上限。单文件超预算则永不预热。文件侧对应:`sessions.warmMaxBytes`。 | | `BILI_SESSION_RESIDENT_MAX_BYTES` | 常驻会话估算字节的软目标(#2803;默认 `536870912` = 512 MiB)。活跃/in-flight 状态不受此限制(字节预算约束的是空闲缓存而非活跃负载);超出目标时空闲状态随请求完成回落磁盘。文件侧对应:`sessions.residentMaxBytes`。 | | `BILI_PUBLIC_SNAPSHOT_CAP_BYTES` | 为公开 fork API 按插件会话保留的原始 wire 历史快照的大小上限(字节,#2017)。序列化快照超限的插件会话不再可 fork —— `GET /__bili/plugin/snapshot` 与 `POST /__bili/plugin/fork` 以 `409` fail-closed 并注明原因 —— 而不是永久保留无上限的原始历史副本。上限在每次插件模型请求时重新评估:会话缩回上限内(fork 裁剪后或宿主缩短历史)即恢复可 fork。默认 `104857600`(100 MiB);`0` 完全停用留存(所有会话不可 fork,已有快照在下一次请求时丢弃)。文件孪生键:`plugin.snapshotCapBytes`。 | From b5b05758c297934efee02e54499a4761f03b4421 Mon Sep 17 00:00:00 2001 From: awork Date: Fri, 16 Oct 2026 13:48:01 +0800 Subject: [PATCH 2/5] docs: name daily-cloudcode-pa.googleapis.com as the antigravity default upstream (#3344/#3129) #3129 switched the no-CLOUD_CODE_URL default from cloudcode-pa to daily-cloudcode-pa (bare cloudcode-pa 400s on /v1internal:*), but the docs still named only the old production host. Updated README en/zh, CLIENTS en/zh (default-upstream sentence + MITM-fallback domain whitelist), cli help text, and web i18n notes. --- CLIENTS.md | 15 +++++++++------ CLIENTS.zh-CN.md | 14 ++++++++------ README.md | 4 ++-- README.zh-CN.md | 4 ++-- src/cli.ts | 2 +- src/web/i18n.ts | 4 ++-- 6 files changed, 24 insertions(+), 19 deletions(-) diff --git a/CLIENTS.md b/CLIENTS.md index dc99059109..a1478b2d20 100644 --- a/CLIENTS.md +++ b/CLIENTS.md @@ -536,9 +536,10 @@ the four have a base-URL env hook; one doesn't: override (verified in the v2.19.1 binary: *"Overriding CloudCodeServerURL via CLOUD_CODE_URL environment variable"*) — same shape as the gemini-cli base-URL hook. The launcher sets - `CLOUD_CODE_URL=/bili/` (default upstream - `https://cloudcode-pa.googleapis.com`; if you export your own - `CLOUD_CODE_URL`, that value is relayed through the proxy instead). No MITM, + `CLOUD_CODE_URL=/bili/` (default upstream + `https://daily-cloudcode-pa.googleapis.com` — Antigravity's real default; + the bare `cloudcode-pa` host 400s on `/v1internal:*`, #3129; if you export + your own `CLOUD_CODE_URL`, that value is relayed through the proxy instead). No MITM, no CA install. The proxy recognizes the wire **by path**: `:streamGenerateContent` / `:generateContent` / `:countTokens` requests are routed to the Google-native adapter and compressed like `bili gemini`. If @@ -546,9 +547,11 @@ the four have a base-URL env hook; one doesn't: (`/google.internal.cloud.code.v1internal.CloudCode/*`), those requests are not recognized and relay verbatim without compression — a graceful degrade, fixable with a per-lane `protocol` declaration (#1909) once confirmed. - Fallback if Google ever removes the env hook: cert-MITM — the - language_server honors `HTTPS_PROXY` and does not pin certificates, so add - `cloudcode-pa.googleapis.com` to `"mitm".domains` and trust bili's root CA. + Fallback if Google ever removes the env hook: cert-MITM — the + language_server honors `HTTPS_PROXY` and does not pin certificates, so add + `daily-cloudcode-pa.googleapis.com` (Antigravity's real default endpoint; + the bare `cloudcode-pa` name 400s on `/v1internal:*`, #3129) to + `"mitm".domains` and trust bili's root CA. The desktop app and the IDE extension share this same language_server channel; the launcher drives the CLI specifically — desktop users can export `CLOUD_CODE_URL` manually or use the MITM recipe. diff --git a/CLIENTS.zh-CN.md b/CLIENTS.zh-CN.md index 34d63eb8c9..97fce9d4e3 100644 --- a/CLIENTS.zh-CN.md +++ b/CLIENTS.zh-CN.md @@ -62,17 +62,19 @@ `CLOUD_CODE_URL` 环境变量覆盖(已在 v2.19.1 二进制中验证:*"Overriding CloudCodeServerURL via CLOUD_CODE_URL environment variable"*),形态与 gemini-cli 的 base-URL 钩子相同。启动器设置 - `CLOUD_CODE_URL=/bili/`(默认上游 - `https://cloudcode-pa.googleapis.com`;如果你自己导出了 `CLOUD_CODE_URL`, - 该值会被中继经过代理)。无 MITM、无需装 CA。代理**按 path 识别 wire**: + `CLOUD_CODE_URL=/bili/`(默认上游 + `https://daily-cloudcode-pa.googleapis.com` —— Antigravity 真实默认;裸 + `cloudcode-pa` 主机在 `/v1internal:*` 上 400,#3129;如果你自己导出了 + `CLOUD_CODE_URL`,该值会被中继经过代理)。无 MITM、无需装 CA。代理**按 path 识别 wire**: `:streamGenerateContent` / `:generateContent` / `:countTokens` 请求走 Google 原生适配器,与 `bili gemini` 一样被压缩。若服务端改用 gRPC 方法 path(`/google.internal.cloud.code.v1internal.CloudCode/*`),这些请求不被 识别、原样透传不压缩 —— 属优雅降级,确认后可用按 lane 的 `protocol` 声明(#1909)修复。若 Google 将来移除该环境钩子,退路是证书 MITM: - language_server 遵循 `HTTPS_PROXY` 且不锁定证书,把 - `cloudcode-pa.googleapis.com` 加进 `"mitm".domains` 并信任 bili 根 CA - 即可。桌面端与 IDE 扩展共用同一条 language_server 通道;启动器只驱动 + language_server 遵循 `HTTPS_PROXY` 且不锁定证书,把 + `daily-cloudcode-pa.googleapis.com`(Antigravity 真实默认端点;裸 + `cloudcode-pa` 名称在 `/v1internal:*` 上 400,#3129)加进 `"mitm".domains` + 并信任 bili 根 CA 即可。桌面端与 IDE 扩展共用同一条 language_server 通道;启动器只驱动 CLI —— 桌面用户可手动导出 `CLOUD_CODE_URL`,或直接用上面的 MITM 配方。 四者都没有 native 模式:均无环内工具注入接缝(gemini-cli 扩展只到自定义命令, diff --git a/README.md b/README.md index d0aef5889b..c664f8eac6 100644 --- a/README.md +++ b/README.md @@ -118,7 +118,7 @@ Pick by your client: | **gemini** (Gemini CLI) | `bili gemini` (launcher, `GOOGLE_GEMINI_BASE_URL` `/bili/` rewrite) or `/bili/` prefix — launcher-only (no in-loop tool seam, #1043) | | **iflow** (iFlow CLI) | `bili iflow` (launcher, `IFLOW_BASE_URL` `/bili/` rewrite) or `/bili/` prefix | | **qwen** (Qwen Code) | `bili qwen` (launcher, cert-MITM) or `/bili/` prefix | -| **antigravity** (Antigravity CLI / agy, Google) | `bili antigravity` (launcher, `CLOUD_CODE_URL` `/bili/` rewrite of cloudcode-pa.googleapis.com) or `/bili/` prefix — no plugin seam (closed Go language_server; its user-plugin surface is additive-only, #2115) — details: [CLIENTS.md](CLIENTS.md) | +| **antigravity** (Antigravity CLI / agy, Google) | `bili antigravity` (launcher, `CLOUD_CODE_URL` `/bili/` rewrite of daily-cloudcode-pa.googleapis.com — Antigravity's real default upstream, #3129) or `/bili/` prefix — no plugin seam (closed Go language_server; its user-plugin surface is additive-only, #2115) — details: [CLIENTS.md](CLIENTS.md) | | **mcode** (MiniMax Code) | [`billion-context`](https://github.com/ranxianglei/billion-context) via `bili mcode` (cert-MITM) or `/bili/` prefix — no native mode (event hooks only, no model-request seam, [#1050](https://github.com/ranxianglei/billion-context/issues/1050)) | | **aider** | [`billion-context`](https://github.com/ranxianglei/billion-context) via `bili aider` (cert-MITM) or `/bili/` prefix — no native mode (shell-command-only hooks, no tool-injection seam, [#1048](https://github.com/ranxianglei/billion-context/issues/1048)) | | **copilot** (GitHub Copilot CLI) | `bili copilot` (launcher, cert-MITM) — closed Go binary, no plugin seam (#1049) | @@ -267,7 +267,7 @@ bili kimi # Kimi Code CLI (Moonshot): standard proxy bili gemini # Gemini CLI (Google): GOOGLE_GEMINI_BASE_URL /bili/ rewrite to generativelanguage.googleapis.com (Google native wire), real ~/.gemini untouched bili iflow # iFlow CLI: IFLOW_BASE_URL /bili/ rewrite to apis.iflow.cn/v1 (OpenAI chat-completions wire), real ~/.iflow untouched bili qwen # Qwen Code (multi-protocol gemini-cli fork, no base-URL hook): cert-MITM via HTTPS_PROXY + NODE_EXTRA_CA_CERTS, default DashScope/Qwen model hosts whitelisted, custom relays via --mitm-domain -bili antigravity # Antigravity CLI (agy, Google): CLOUD_CODE_URL /bili/ rewrite of cloudcode-pa.googleapis.com (undocumented language-server env override, v2.19.1 binary-verified); wire recognized as Google native by path (#2115) +bili antigravity # Antigravity CLI (agy, Google): CLOUD_CODE_URL /bili/ rewrite of daily-cloudcode-pa.googleapis.com — the real default upstream (bare cloudcode-pa 400s on /v1internal:*, #3129); undocumented language-server env override, v2.19.1 binary-verified; wire recognized as Google native by path (#2115) bili mcode # MiniMax Code CLI: same shape as kimi (proxy envs, unconditional loopback bypass, cert-MITM/absolute-form); session bound via X-Mavis-Session-Id (#1050) bili aider # Aider (Python pair programmer): cert-MITM via HTTPS_PROXY + SSL_CERT_FILE/REQUESTS_CA_BUNDLE; endpoint from OPENAI_API_BASE / ANTHROPIC_BASE_URL / --openai-api-base / .aider.conf.yml (#1048) bili copilot # Copilot CLI (GitHub, closed Go binary) — cert-MITM via HTTPS_PROXY + SSL_CERT_FILE, api.githubcopilot.com + per-plan subdomains whitelisted (#1049) diff --git a/README.zh-CN.md b/README.zh-CN.md index 16f524a089..6ddba6a027 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -120,7 +120,7 @@ QQ群: | **gemini**(Gemini CLI) | `bili gemini`(启动器,`GOOGLE_GEMINI_BASE_URL` `/bili/` 改写)或 `/bili/` 前缀 —— 仅启动器(无环内工具注入接缝,#1043) | | **iflow**(iFlow CLI) | `bili iflow`(启动器,`IFLOW_BASE_URL` `/bili/` 改写)或 `/bili/` 前缀 | | **qwen**(Qwen Code) | `bili qwen`(启动器,cert-MITM)或 `/bili/` 前缀 | -| **antigravity**(Antigravity CLI / agy,Google) | `bili antigravity`(启动器,`CLOUD_CODE_URL` 对 `cloudcode-pa.googleapis.com` 的 `/bili/` 改写)或 `/bili/` 前缀 —— 无插件接缝(闭源 Go language_server;其用户插件面仅可追加、不能拦截模型流,[#2115](https://github.com/ranxianglei/billion-context/issues/2115))—— 细节见 [CLIENTS.zh-CN.md](CLIENTS.zh-CN.md) | +| **antigravity**(Antigravity CLI / agy,Google) | `bili antigravity`(启动器,`CLOUD_CODE_URL` 对 `daily-cloudcode-pa.googleapis.com` 的 `/bili/` 改写 —— Antigravity 真实默认上游,#3129)或 `/bili/` 前缀 —— 无插件接缝(闭源 Go language_server;其用户插件面仅可追加、不能拦截模型流,[#2115](https://github.com/ranxianglei/billion-context/issues/2115))—— 细节见 [CLIENTS.zh-CN.md](CLIENTS.zh-CN.md) | | **mcode**(MiniMax Code) | [`billion-context`](https://github.com/ranxianglei/billion-context),`bili mcode`(cert-MITM)或 `/bili/` 前缀 —— 无原生模式(纯声明式事件钩子,无模型请求接缝,[#1050](https://github.com/ranxianglei/billion-context/issues/1050)) | | **aider** | [`billion-context`](https://github.com/ranxianglei/billion-context),`bili aider`(cert-MITM)或 `/bili/` 前缀 —— 无原生模式(仅 shell 命令钩子,无工具注入接缝,[#1048](https://github.com/ranxianglei/billion-context/issues/1048)) | | **copilot**(GitHub Copilot CLI) | `bili copilot`(启动器,cert-MITM)—— 闭源 Go 二进制、无插件接缝(#1049) | @@ -213,7 +213,7 @@ bili kimi # Kimi Code CLI(Moonshot):除无条件回 bili gemini # Gemini CLI(Google):GOOGLE_GEMINI_BASE_URL /bili/ 改写到 generativelanguage.googleapis.com(Google 原生 wire),真实 ~/.gemini 零改动 bili iflow # iFlow CLI:IFLOW_BASE_URL /bili/ 改写到 apis.iflow.cn/v1(OpenAI chat-completions wire),真实 ~/.iflow 零改动 bili qwen # Qwen Code(多协议 gemini-cli fork,无 base-URL 钩子):HTTPS_PROXY + NODE_EXTRA_CA_CERTS 证书 MITM,默认 DashScope/Qwen 模型主机加白,自建中转用 --mitm-domain 追加 -bili antigravity # Google Antigravity CLI(agy,Gemini CLI 继任者):CLOUD_CODE_URL 对 cloudcode-pa.googleapis.com 的 /bili/ 改写,无需证书 MITM(#2115) +bili antigravity # Google Antigravity CLI(agy,Gemini CLI 继任者):CLOUD_CODE_URL 对 daily-cloudcode-pa.googleapis.com 的 /bili/ 改写 —— 真实默认上游(裸 cloudcode-pa 在 /v1internal:* 上 400,#3129),无需证书 MITM(#2115) bili mcode # MiniMax Code CLI:与 kimi 同构(代理环境变量、无条件回环绕过、证书 MITM/绝对形式);会话经 X-Mavis-Session-Id 绑定(#1050) bili aider # Aider(Python pair programmer):HTTPS_PROXY + SSL_CERT_FILE/REQUESTS_CA_BUNDLE 证书 MITM;端点取自 OPENAI_API_BASE / ANTHROPIC_BASE_URL / --openai-api-base / .aider.conf.yml(#1048) bili copilot # Copilot CLI(GitHub,闭源 Go 二进制)—— 证书 MITM(HTTPS_PROXY + SSL_CERT_FILE),api.githubcopilot.com + 各套餐子域加白(#1049) diff --git a/src/cli.ts b/src/cli.ts index 9b3ee461fe..88245b6d57 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -125,7 +125,7 @@ Launcher (bili pi / bili codex / bili claude / bili omp / bili opencode / bili h bili gemini # launch Gemini CLI through the proxy (GOOGLE_GEMINI_BASE_URL /bili/ rewrite; API-key & gateway auth) bili iflow # launch iFlow CLI through the proxy (IFLOW_BASE_URL /bili/ rewrite of apis.iflow.cn/v1) bili qwen # launch Qwen Code through the proxy (cert-MITM; DashScope/Qwen gateways whitelisted by default, custom relays via --mitm-domain) - bili antigravity # launch Antigravity CLI (agy) through the proxy (CLOUD_CODE_URL /bili/ rewrite of cloudcode-pa.googleapis.com) + bili antigravity # launch Antigravity CLI (agy) through the proxy (CLOUD_CODE_URL /bili/ rewrite of daily-cloudcode-pa.googleapis.com — real default upstream, #3129) bili mcode # launch MiniMax Code through the proxy (cert-MITM; provider hosts from ~/.minimax*/config.yaml or the official agent.minimax.* endpoints) bili aider # launch aider through the proxy (cert-MITM; endpoint from OPENAI_API_BASE/--openai-api-base/.aider.conf.yml or api.openai.com+api.anthropic.com by default) bili copilot # launch Copilot CLI through the proxy (cert-MITM; api.githubcopilot.com + plan subdomains whitelisted by default) diff --git a/src/web/i18n.ts b/src/web/i18n.ts index b49c5d8ee7..dee2ee9f16 100644 --- a/src/web/i18n.ts +++ b/src/web/i18n.ts @@ -438,7 +438,7 @@ export const MESSAGES: Record> = { "con.note_gemini": "Gemini CLI(Google):GOOGLE_GEMINI_BASE_URL /bili/ 改写到 generativelanguage.googleapis.com(Google 原生 wire);真实 ~/.gemini 零改动", "con.note_iflow": "iFlow CLI:IFLOW_BASE_URL /bili/ 改写到 apis.iflow.cn/v1(OpenAI chat-completions wire);真实 ~/.iflow 零改动", "con.note_qwen": "Qwen Code(多协议 gemini-cli fork,无 base-URL 钩子):HTTPS_PROXY + NODE_EXTRA_CA_CERTS 证书 MITM;DashScope/Qwen 默认模型主机加白,自建中转用 --mitm-domain 追加", - "con.note_antigravity": "Antigravity CLI(agy,Google,Gemini CLI 继任者):CLOUD_CODE_URL /bili/ 改写到 cloudcode-pa.googleapis.com(语言服务器内未公开的环境变量覆盖,v2.19.1 二进制验证;wire 按路径识别为 Google 原生)(#2115)", + "con.note_antigravity": "Antigravity CLI(agy,Google,Gemini CLI 继任者):CLOUD_CODE_URL /bili/ 改写到 daily-cloudcode-pa.googleapis.com —— 真实默认上游(裸 cloudcode-pa 在 /v1internal:* 上 400,#3129;语言服务器内未公开的环境变量覆盖,v2.19.1 二进制验证;wire 按路径识别为 Google 原生)(#2115)", "con.note_mcode": "MiniMax Code CLI:除无条件回环绕过外遵循标准代理环境变量——非回环 https 证书 MITM、http 绝对形式转发;主机取 ~/.minimax*/config.yaml;会话经 X-Mavis-Session-Id 头绑定(#1050)", "con.note_aider": "Aider(Python pair programmer):HTTPS_PROXY + SSL_CERT_FILE/REQUESTS_CA_BUNDLE 证书 MITM;端点取自继承 env、--openai-api-base 或 .aider.conf.yml;回环端点经 NO_PROXY 直连(#1048)", "con.note_copilot": "Copilot CLI(GitHub,闭源 Go 二进制)——证书 MITM,api.githubcopilot.com + 各套餐子域加白(#1049)", @@ -914,7 +914,7 @@ export const MESSAGES: Record> = { "con.note_gemini": "Gemini CLI (Google): GOOGLE_GEMINI_BASE_URL /bili/ rewritten to generativelanguage.googleapis.com (Google native wire); real ~/.gemini zero-touch", "con.note_iflow": "iFlow CLI: IFLOW_BASE_URL /bili/ rewritten to apis.iflow.cn/v1 (OpenAI chat-completions wire); real ~/.iflow zero-touch", "con.note_qwen": "Qwen Code (multi-protocol gemini-cli fork, no base-URL hook): certificate MITM via HTTPS_PROXY + NODE_EXTRA_CA_CERTS; DashScope/Qwen default model hosts whitelisted; self-hosted relays appended via --mitm-domain", - "con.note_antigravity": "Antigravity CLI (agy, Google, Gemini CLI successor): CLOUD_CODE_URL /bili/ rewritten to cloudcode-pa.googleapis.com (undocumented language-server env override, verified in the v2.19.1 binary; wire recognized as Google native by path) (#2115)", + "con.note_antigravity": "Antigravity CLI (agy, Google, Gemini CLI successor): CLOUD_CODE_URL /bili/ rewritten to daily-cloudcode-pa.googleapis.com — the real default upstream (bare cloudcode-pa 400s on /v1internal:*, #3129; undocumented language-server env override, verified in the v2.19.1 binary; wire recognized as Google native by path) (#2115)", "con.note_mcode": "MiniMax Code CLI: aside from the unconditional loopback bypass, standard proxy env — non-loopback https certificate MITM, http absolute-form forwarding; hosts from ~/.minimax*/config.yaml; sessions bound via X-Mavis-Session-Id header (#1050)", "con.note_aider": "Aider (Python pair programmer): certificate MITM via HTTPS_PROXY + SSL_CERT_FILE/REQUESTS_CA_BUNDLE; endpoint from inherited env, --openai-api-base or .aider.conf.yml; loopback endpoints direct via NO_PROXY (#1048)", "con.note_copilot": "Copilot CLI (GitHub, closed-source Go binary) — certificate MITM; api.githubcopilot.com plus tier subdomains whitelisted (#1049)", From e2a9d1ffcfbe754868f476cec8b8e0136856b677 Mon Sep 17 00:00:00 2001 From: awork Date: Fri, 16 Oct 2026 13:48:10 +0800 Subject: [PATCH 3/5] fix: warn INERT for removed compress.absorb / compress.imageCompression keys (#3344) compress.absorb (#3293) and compress.imageCompression (#3266) were removed, so users who had enabled them get their config silently ignored on upgrade. Added a one-time INERT warning (same pattern as the existing warnInertStripImages / warnInertResignPassthrough) that scans all three compress levels and names the exact offending paths. --- src/config.ts | 41 +++++++++++ tests/removed-compress-keys-inert.test.ts | 83 +++++++++++++++++++++++ 2 files changed, 124 insertions(+) create mode 100644 tests/removed-compress-keys-inert.test.ts diff --git a/src/config.ts b/src/config.ts index 4b3980e165..1e476e0c5e 100644 --- a/src/config.ts +++ b/src/config.ts @@ -1959,6 +1959,7 @@ export function loadConfigFile(): FileConfig { warnUnknownTopLevelKeys(obj); warnInertResignPassthrough(obj); warnInertStripImages(obj); + warnInertRemovedCompressKeys(obj); value = obj as FileConfig; } else { value = {}; @@ -2079,6 +2080,46 @@ function warnInertStripImages(obj: Record): void { } let seenInertStripImagesSignature = ""; +// #3344: two compress sub-blocks were REMOVED wholesale — `absorb` (#3293, the +// tool-result distillation feature) and `imageCompression` (#3266, image +// pre-compression + the image_full restore channel). Old configs that still set +// them get a one-time inert notice instead of a silent no-op: the parse +// whitelist (COMPRESS_SETTING_FIELDS) no longer carries the fields, so they are +// dropped at EVERY compress level they can appear (global / provider / model). +// Dedup by dead-key path signature (#1815 style): re-warn when the set changes. +const INERT_REMOVED_COMPRESS_KEYS = ["absorb", "imageCompression"] as const; +let seenInertRemovedCompressKeysSignature = ""; +function warnInertRemovedCompressKeys(obj: Record): void { + const hits: string[] = []; + const scanBlock = (block: unknown, pathPrefix: string): void => { + if (!block || typeof block !== "object" || Array.isArray(block)) return; + for (const key of INERT_REMOVED_COMPRESS_KEYS) { + if ((block as Record)[key] !== undefined) hits.push(`${pathPrefix}.${key}`); + } + }; + scanBlock(obj.compress, "compress"); + const providers = obj.providers; + if (providers && typeof providers === "object" && !Array.isArray(providers)) { + for (const [url, entry] of Object.entries(providers as Record)) { + if (!entry || typeof entry !== "object" || Array.isArray(entry)) continue; + const p = entry as Record; + scanBlock(p.compress, `providers["${url}"].compress`); + const models = p.models; + if (models && typeof models === "object" && !Array.isArray(models)) { + for (const [model, mEntry] of Object.entries(models as Record)) { + if (!mEntry || typeof mEntry !== "object" || Array.isArray(mEntry)) continue; + scanBlock((mEntry as Record).compress, `providers["${url}"].models["${model}"].compress`); + } + } + } + } + hits.sort(); + const sig = hits.join(","); + if (sig === "" || sig === seenInertRemovedCompressKeysSignature) return; + seenInertRemovedCompressKeysSignature = sig; + loggerLog("warn", `[acp-config] ${hits.join(", ")} is INERT — these compress sub-blocks were removed and no longer do anything at any level: compress.absorb (tool-result distillation feature, #3293) and compress.imageCompression (image pre-compression + image_full restore channel, #3266). Remove them from the config; oversized tool results are now handled by compress.ccr, and images pass through byte-identical.`); +} + function warnInertResignPassthrough(obj: Record): void { const inert: string[] = []; const consider = (map: unknown, providerBlockFor: (key: string) => ResignFileSettings | undefined): void => { diff --git a/tests/removed-compress-keys-inert.test.ts b/tests/removed-compress-keys-inert.test.ts new file mode 100644 index 0000000000..2f7bb521a9 --- /dev/null +++ b/tests/removed-compress-keys-inert.test.ts @@ -0,0 +1,83 @@ +import { test } from "node:test"; +import assert from "node:assert/strict"; +import fs from "node:fs"; +import os from "node:os"; +import path from "node:path"; +import { loadConfigFile, parseCompressSettings } from "../src/config.ts"; +import { setLogCapture } from "../src/logger.ts"; +import { rmrf } from "./tmp-rm.ts"; + +type Captured = { level: string; msg: string }; + +function captureLogs(): { captured: Captured[]; stop: () => void } { + const captured: Captured[] = []; + setLogCapture((level, msg) => captured.push({ level, msg })); + return { captured, stop: () => setLogCapture(null) }; +} + +function withConfigFile(body: string, fn: () => void): void { + const dir = fs.mkdtempSync(path.join(os.tmpdir(), "bili-removed-keys-")); + const file = path.join(dir, "billion-context.json"); + fs.writeFileSync(file, body); + const prev = process.env.BILI_CONFIG_FILE; + process.env.BILI_CONFIG_FILE = file; + try { + fn(); + } finally { + if (prev === undefined) delete process.env.BILI_CONFIG_FILE; + else process.env.BILI_CONFIG_FILE = prev; + rmrf(dir); + } +} + +// Warnings for the removed-key family only (other INERT emitters exist too). +const familyWarns = (captured: Captured[]) => + captured.filter((e) => e.level === "warn" && e.msg.includes("is INERT") && /absorb|imageCompression/.test(e.msg)); + +test("#3344: removed compress.absorb / compress.imageCompression warn INERT once (root level) and are ignored", () => { + const { captured, stop } = captureLogs(); + withConfigFile( + `{"compress":{"absorb":{"enabled":true,"minToolTokens":500},"imageCompression":{"enabled":true,"quality":60}}}`, + () => { + const cfg = loadConfigFile(); + // Both keys are gone from the typed surface — the parse whitelist + // (COMPRESS_SETTING_FIELDS) no longer carries them, so they drop. + const cs = parseCompressSettings(cfg.compress ?? {}); + assert.equal((cs as Record).absorb, undefined); + assert.equal((cs as Record).imageCompression, undefined); + const warns = familyWarns(captured); + assert.equal(warns.length, 1, `expected exactly one family INERT warning, got: ${warns.map((w) => w.msg).join(" | ")}`); + assert.match(warns[0]!.msg, /compress\.absorb/); + assert.match(warns[0]!.msg, /compress\.imageCompression/); + assert.match(warns[0]!.msg, /were removed/); + // Second load of the SAME content: deduped (one notice per process). + loadConfigFile(); + assert.equal(familyWarns(captured).length, 1); + }, + ); + stop(); +}); + +test("#3344: removed keys at provider and model levels are named by full path", () => { + const { captured, stop } = captureLogs(); + withConfigFile( + `{"providers":{"https://u.example":{"compress":{"absorb":{"enabled":true}},"models":{"gpt-x":{"compress":{"imageCompression":{"enabled":true}}}}}}}`, + () => { + loadConfigFile(); + const warns = familyWarns(captured); + assert.equal(warns.length, 1, `expected exactly one family INERT warning, got: ${warns.map((w) => w.msg).join(" | ")}`); + assert.match(warns[0]!.msg, /providers\["https:\/\/u\.example"\]\.compress\.absorb/); + assert.match(warns[0]!.msg, /providers\["https:\/\/u\.example"\]\.models\["gpt-x"\]\.compress\.imageCompression/); + }, + ); + stop(); +}); + +test("#3344: configs without the removed keys stay silent", () => { + const { captured, stop } = captureLogs(); + withConfigFile(`{"compress":{"ccr":{"enabled":true}}}`, () => { + loadConfigFile(); + assert.equal(familyWarns(captured).length, 0); + }); + stop(); +}); From c49948e78f18b7ab3e8922d5fa42992eea50558e Mon Sep 17 00:00:00 2001 From: awork Date: Fri, 16 Oct 2026 13:48:10 +0800 Subject: [PATCH 4/5] fix: escalate replacement teardown SIGTERM -> SIGKILL before manual-cleanup error (#3344) killAndVerify sent SIGTERM to a replacement process that survived, then only logged an error asking for manual cleanup. Added a SIGKILL round with its own verification window before falling back to the manual-cleanup error, so a stuck replacement is reaped automatically. Updated the #3044 regression test: a SIGTERM-ignoring stub is now reaped by the escalation instead of leaking. --- src/restart.ts | 27 ++++++++++++++++++++------- tests/auto-restart.test.ts | 17 +++++++++++------ 2 files changed, 31 insertions(+), 13 deletions(-) diff --git a/src/restart.ts b/src/restart.ts index 9e05d8318a..bfad040bcf 100644 --- a/src/restart.ts +++ b/src/restart.ts @@ -412,18 +412,31 @@ export async function performSelfRestart(deps: SelfRestartDeps): Promise { + const deadline = Date.now() + ms; + while (Date.now() < deadline) { + if (!isPidAlive(pid)) return true; + await sleep(POLL_MS); + } + return !isPidAlive(pid); +} + /** Terminate a failed replacement and verify it actually died (#3044): a * kill that silently no-ops leaves exactly the orphan processes that report - * describes — idle, holding a port nobody routes to, accumulating memory. */ + * describes — idle, holding a port nobody routes to, accumulating memory. + * #3344: escalate SIGTERM → SIGKILL before asking a human — a replacement + * stuck in a SIGTERM-resistant state (blocked syscall / TERM ignored) is + * still force-killable; manual cleanup stays only the last resort. */ async function killAndVerify(child: ChildProcess, pid: number | undefined, verifyMs: number, log: Logger): Promise { try { child.kill(); } catch { /* already gone */ } if (pid === undefined) return; - const deadline = Date.now() + verifyMs; - while (Date.now() < deadline) { - if (!isPidAlive(pid)) return; - await sleep(POLL_MS); - } - log("error", `[restart] replacement pid ${pid} is still alive after SIGTERM — manual cleanup required (kill ${pid}); until it dies it keeps leaking CPU/memory on a port nobody routes to (#3044)`); + if (await waitUntilGone(pid, verifyMs)) return; + // SIGTERM didn't take within the window — escalate before reporting. + try { process.kill(pid, "SIGKILL"); } catch { /* already gone */ } + if (await waitUntilGone(pid, verifyMs)) return; + log("error", `[restart] replacement pid ${pid} is still alive after SIGTERM+SIGKILL — manual cleanup required (kill -9 ${pid}); until it dies it keeps leaking CPU/memory on a port nobody routes to (#3044)`); } function resumeListening(server: http.Server, host: string, port: number, log: Logger): void { diff --git a/tests/auto-restart.test.ts b/tests/auto-restart.test.ts index bfb2c34ac7..d40fabf149 100644 --- a/tests/auto-restart.test.ts +++ b/tests/auto-restart.test.ts @@ -674,7 +674,7 @@ test("performSelfRestart: port taken over by another bili instance → parent ex } }); -test("performSelfRestart: a replacement that survives SIGTERM is escalated loudly (#3044)", { timeout: 30_000, skip: process.platform === "win32" ? "POSIX-only: Windows terminates on SIGTERM uncatchably, so a SIGTERM-surviving stub cannot be modeled (was a w24 CI red, #3182 family)" : false }, async () => { +test("performSelfRestart: a replacement that ignores SIGTERM is reaped by the SIGKILL escalation (#3044/#3344)", { timeout: 30_000, skip: process.platform === "win32" ? "POSIX-only: Windows terminates on SIGTERM uncatchably, so a SIGTERM-surviving stub cannot be modeled (was a w24 CI red, #3182 family)" : false }, async () => { // #3182: same stolen-port retry as above (stub exit 91 = infra TOCTOU). const stubborn = path.join(root, "stub-stubborn.mjs"); for (let attempt = 0; ; attempt++) { @@ -683,8 +683,9 @@ test("performSelfRestart: a replacement that survives SIGTERM is escalated loudl const record: SpawnRecord = {}; writeFileSync(stubborn, [ // No listener by design: the stub models a replacement that never - // reaches readiness. It only ignores SIGTERM to force the loud - // escalation path (#3044). + // reaches readiness. It ignores SIGTERM to force the escalation path; + // #3344 escalates to SIGKILL, which it cannot ignore — so the orphan + // is reaped instead of left for manual cleanup (#3044). "process.on('SIGTERM', () => {});", "setInterval(() => {}, 1000);", ].join("\n")); @@ -700,9 +701,13 @@ test("performSelfRestart: a replacement that survives SIGTERM is escalated loudl }); assert.equal(result.ok, false, JSON.stringify(result)); assert.equal(result.error, "replacement-not-ready"); - // An unverified kill was how the orphans of #3044 survived their - // parent's timeout — the loud escalation is the point of this test. - assert.match(entries.join("\n"), /still alive after SIGTERM — manual cleanup required \(kill \d+\)/s); + // #3344: the SIGTERM-ignoring replacement is reaped by the SIGKILL + // escalation — no orphan survives its parent's timeout, so no + // manual-cleanup error is logged. (Pre-#3344 this stub stayed alive + // and the assertion matched the loud manual-cleanup message.) + assert.ok(record.child?.pid, "stub pid for the liveness check"); + assert.equal(isPidAlive(record.child!.pid), false, "the SIGTERM-stubborn replacement was reaped by SIGKILL"); + assert.doesNotMatch(entries.join("\n"), /manual cleanup required/s); assert.equal(await waitForListening(server), true, "service resumes regardless"); break; } catch (e) { From d83b0b59cad0d8c1a86a83ff838c244f53b23ad2 Mon Sep 17 00:00:00 2001 From: awork Date: Fri, 16 Oct 2026 13:48:10 +0800 Subject: [PATCH 5/5] fix: stamp x-bili-applied-seq only on 2xx responses (#3344) The writeHead wrapper stamped the ack header on whatever status the pipeline wrote, including failures. A host trusting it unconditionally would skip its resend after a failed turn and lose the user's message. Now the header is set only for 2xx. In-repo clients already gate on 200, so this tightens the contract without changing live behavior. Added a failure-path regression test. --- src/incremental-lane.ts | 17 ++++++++++++----- tests/incremental-lane.test.ts | 17 +++++++++++++++-- 2 files changed, 27 insertions(+), 7 deletions(-) diff --git a/src/incremental-lane.ts b/src/incremental-lane.ts index 28e178e85a..8a38d3961c 100644 --- a/src/incremental-lane.ts +++ b/src/incremental-lane.ts @@ -434,14 +434,21 @@ export async function handleIncrementalTurn( socket: { localPort: (req.socket as { localPort?: number } | undefined)?.localPort, remoteAddress: "127.0.0.1", destroy: (): void => { synthetic.destroy?.(); } }, }); - // Ack header: inject ahead of whatever status the pipeline writes. + // Ack header: stamped ONLY on 2xx — a non-2xx response means the turn + // did not land, and a host trusting the ack unconditionally would skip + // its resend and lose the user's message (#3344). In-repo clients gate + // on 200 already, so this tightens the contract rather than changing + // any live behavior. const appliedSeq = applied.appliedSeq; const originalWriteHead = res.writeHead.bind(res) as (...args: never[]) => ReturnType; (res as { writeHead?: unknown }).writeHead = (...args: unknown[]) => { - try { - res.setHeader("x-bili-applied-seq", String(appliedSeq)); - } catch { - // header injection is best-effort; the seq is also in the log line + const status = typeof args[0] === "number" ? args[0] : 200; + if (status >= 200 && status < 300) { + try { + res.setHeader("x-bili-applied-seq", String(appliedSeq)); + } catch { + // header injection is best-effort; the seq is also in the log line + } } return (originalWriteHead as (...a: unknown[]) => ReturnType)(...args); }; diff --git a/tests/incremental-lane.test.ts b/tests/incremental-lane.test.ts index cede080d32..fac879d246 100644 --- a/tests/incremental-lane.test.ts +++ b/tests/incremental-lane.test.ts @@ -39,7 +39,7 @@ interface Harness { close: () => Promise; } -async function harness(storageMode: "full" | "legacy", opts: { upstreamDelayMs?: number } = {}): Promise { +async function harness(storageMode: "full" | "legacy", opts: { upstreamDelayMs?: number; upstreamStatus?: number } = {}): Promise { const dir = mkdtempSync(join(testRoot, "run-")); for (const key of ["XDG_STATE_HOME", "XDG_DATA_HOME", "XDG_CACHE_HOME", "XDG_CONFIG_HOME"]) process.env[key] = dir; process.env.BILI_STORAGE_UNIFIED = storageMode === "full" ? "full" : "legacy"; @@ -57,7 +57,7 @@ async function harness(storageMode: "full" | "legacy", opts: { upstreamDelayMs?: req.on("end", () => { forwarded.push(JSON.parse(Buffer.concat(chunks).toString("utf8")) as Record); const reply = (): void => { - res.writeHead(200, { "content-type": "application/json" }); + res.writeHead(opts.upstreamStatus ?? 200, { "content-type": "application/json" }); res.end(JSON.stringify({ id: "msg_test", role: "assistant", content: [{ type: "text", text: "answer" }], usage: { input_tokens: 10000, output_tokens: 10 } })); }; if (opts.upstreamDelayMs) setTimeout(reply, opts.upstreamDelayMs); @@ -134,6 +134,19 @@ test("incremental lane: seed → delta → upstream receives the assembled full } }); +test("incremental lane: a failed turn (non-2xx) carries NO x-bili-applied-seq (#3344)", async () => { + const h = await harness("full", { upstreamStatus: 500 }); + try { + const failed = await h.turn({ sinceSeq: 0, messages: [userTurn(1)] }); + assert.ok(failed.status >= 400, `expected a non-2xx failure from the failing upstream, got ${failed.status}`); + // The ack must not ride a failure: a host trusting it unconditionally + // would skip its resend and lose the user's message (#3344). + assert.equal(failed.headers.get("x-bili-applied-seq"), null); + } finally { + await h.close(); + } +}); + test("incremental lane: seq mismatch answers 409 with the server's seq; resync recovers", async () => { const h = await harness("full"); try {