Skip to content

fix: surface passthrough everywhere it silently killed compression (#405) - #547

Merged
ranxianglei merged 1 commit into
masterfrom
2026-09-05_passthrough-visibility
Sep 5, 2026
Merged

ranxianglei merged 1 commit into
masterfrom
2026-09-05_passthrough-visibility

Conversation

@ranxianglei

@ranxianglei ranxianglei commented Sep 5, 2026 •

Copy link
Copy Markdown
Owner

Fixes #405.

Problem

ACP_PASSTHROUGH=1 (or config passthrough: true) silently disabled 100% of compression: no boot log, no banner, invisible in the web panel — and the panel could neither see nor clear it. The whole env-knob family (ACP_MODEL_CONTEXT_LIMIT, ACP_COMPRESS_TOOL=0, ACP_COMPRESS_NUDGE=0, BILI_PERSIST=0) also applied with zero trace, so a "healthy-looking" proxy could be forwarding everything verbatim while the user debugged in the wrong direction.

(Note: the issue also mentions ACP_NO_INJECT_TOOL — no such knob exists in the code; the real one is ACP_COMPRESS_TOOL, which is covered.)

Fix

Boot visibility (src/server.ts):

  • banner line gets a — PASSTHROUGH (compression OFF) suffix
  • dedicated warn with the source (env/flag vs config file) and the exact way to re-enable compression
  • one info line enumerating every active env override with values: [config] env overrides active (win over the config file): ACP_PASSTHROUGH=1, …

Panel read/write (src/web/api.ts):

  • GET /__bili/config now includes passthrough: {enabled, source}
  • PUT /__bili/config accepts passthrough: true | false | null; when an env var forces the state it returns 409 with instructions instead of silently not working
  • hot-flip: PUT updates the live opts.passthrough (the request path reads it per-request) — no restart needed; flip logs a warn/info line

Web UI (src/web/page.ts, src/web/client.ts):

  • overview page shows a ⚠️ banner (reuses .notice style) with the source and a 恢复压缩 button; the button disables itself with a hint when the source is env

Config plumbing (src/config.ts):

  • passthroughState(env) shared helper — single source of truth used by loadOptions and the web API (no drift); Options.passthroughSource: "env" | "file" | null

Verification

  • new tests/passthrough-visibility.test.ts: state resolution matrix (env wins / file / default, incl. env 0 forcing file-on OFF), GET exposure, PUT on/off/file-write/hot-flip/400-invalid/409-env-forced — 2/2
  • full suite: 1042/1044 (2 known env-dependent plugin-agent fails, pass with BILLION_CONTEXT_PROXY unset)
  • live boot smoke: banner suffix + warn + env-knob enumeration all present; panel GET/PUT round-trip verified against a tmp config

Out of scope

  • /acp agent-side panel passthrough marker
  • launcher-side notices (the spawned proxy's warn already reaches the launcher console via stderr)

)

- boot: banner suffix 'PASSTHROUGH (compression OFF)' + dedicated warn with
  source (env/flag vs config file) and the exact way to re-enable compression
- boot: one info line enumerating every active env override knob
  (ACP_PASSTHROUGH / ACP_MODEL_CONTEXT_LIMIT / ACP_COMPRESS_TOOL /
  ACP_COMPRESS_NUDGE / BILI_PERSIST) with values — no more silent env wins
- web panel: /__bili/config GET now reports {passthrough:{enabled,source}};
  PUT accepts passthrough true/false/null (409 with instructions when an env
  var forces it); overview page shows a warning banner + 恢复压缩 button
- hot-flip: PUT updates the live opts.passthrough without restart
- config: passthroughState() shared helper + Options.passthroughSource
@github-actions

github-actions Bot commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

📦 Built Package Artifact

Branch: 2026-09-05_passthrough-visibility (a2064d9)

Option A — Install from npm PR tag (recommended)

npm install -g billion-context@pr-547

Each push to this PR publishes a new version under the pr-547 npm tag.

Option B — Download artifact

  1. Download the artifact from the Actions run
  2. Extract the tarball and install:
tar xzf billion-context-pr547.tgz
npm install -g package

This comment is automatically updated on each push.

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 ework agent · qwen3.8-27b

[bot] 🏷 收到,开始实现。先说两点查证结论:

  1. 编号勘误:正文写 "Fixes ACP_PASSTHROUGH 一键静默关死全部压缩:无日志/无横幅/面板不可见且不可清除,同族 env 旋钮全部生效于无声 #405",但 ACP_PASSTHROUGH 一键静默关死全部压缩:无日志/无横幅/面板不可见且不可清除,同族 env 旋钮全部生效于无声 #405 是 proxy-origin 劫持链(已由 PR fix: break the proxy-origin hijack chain (#405) #514 修复);本任务实际对应的是 ACP_PASSTHROUGH one-click silent kill of all compression: no logs / no banners / panel invisible and non-clearable, all sibling env knobs take effect in silence | ACP_PASSTHROUGH 一键静默关死全部压缩:无日志/无横幅/面板不可见且不可清除,同族 env 旋钮全部生效于无声 #403(ACP_PASSTHROUGH 一键静默关死全部压缩,被并入伞形 实例治理伞形:身份/验活/attach-or-spawn/优雅退出/状态卫生 —— 合并修复 #394 #403 #407 #414 #410 #406 #417,feat: instance governance — attach, liveness, handshake, graceful exit, atomic state (#417) #419 只修了实例治理部分,passthrough 可见性未落地)。本 PR 将标注 Fixes ACP_PASSTHROUGH one-click silent kill of all compression: no logs / no banners / panel invisible and non-clearable, all sibling env knobs take effect in silence | ACP_PASSTHROUGH 一键静默关死全部压缩:无日志/无横幅/面板不可见且不可清除,同族 env 旋钮全部生效于无声 #403。
  2. ACP_PASSTHROUGH one-click silent kill of all compression: no logs / no banners / panel invisible and non-clearable, all sibling env knobs take effect in silence | ACP_PASSTHROUGH 一键静默关死全部压缩:无日志/无横幅/面板不可见且不可清除,同族 env 旋钮全部生效于无声 #403 里提到的 ACP_NO_INJECT_TOOL 确认不存在——代码里真实旋钮是 ACP_COMPRESS_TOOL,与你的注记一致。

计划按你列的四块推进(config 共享 helper → boot 可见性 → 面板读写+热翻转 → Web UI banner),补 tests/passthrough-visibility.test.ts,预检 typecheck/test/build,然后开 PR 回贴链接。基于最新 master(origin/master @ 1502287)开工。

@ranxianglei ranxianglei changed the title fix: surface passthrough everywhere it silently killed compression (#405) fix: surface passthrough everywhere it silently killed compression (#403) Sep 5, 2026
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 ework agent · qwen3.8-27b

[bot] 🏷 审核完成(基于分支 a2064d9,本地完整复现)。结论:实现正确、预检全绿,可合并,有两点提示 + 一个我已代办的修正。

验证证据

检查 结果
npm run typecheck ✅ clean
npm test ✅ 1043/1044 — 唯一失败是 master 上就存在的环境依赖项(launcher.test.ts:24 期望裸 codex,本沙箱 PATH 里有 /usr/bin/codex),与本 PR 无关
npm run build ✅ dist/index.js 2.63 MB
tests/passthrough-visibility.test.ts ✅ 2/2
acp-kernel 跨仓库依赖 ✅ 0.0.52 已在 npm 发布(满足"先发布 kernel 再 bump"规则)

Live smoke(构建产物实测,#403 验收标准逐条覆盖):

  • ACP_PASSTHROUGH=1 启动:banner 带 — PASSTHROUGH (compression OFF) 后缀;专属 warn 指明来源(env/flag vs 配置文件)+ 精确的恢复方法;[config] env overrides active (win over the config file): ACP_PASSTHROUGH=1, ACP_COMPRESS_NUDGE=0, BILI_PERSIST=0 枚举行 ✓
  • 面板 GET → {enabled:true, source:"env"};PUT false → 409 + 解除指引;PUT "yes" → 400 ✓
  • 无 env 时:GET {false,null};PUT true → 200,文件写入 "passthrough": true,GET 变 {true,"file"},日志打 flip warn;无需重启即生效(request 路径逐请求读 opts.passthrough)✓;PUT null → 键删除 + flip info ✓

代码评审

四块(config 共享 helper / boot 可见性 / 面板读写+热翻转 / Web UI banner)均按描述落地,passthroughState 作为 loadOptions 与 web API 的单一事实来源,无漂移路径。两个小点(非阻塞):

  1. 409 语义略宽:ACP_PASSTHROUGH 只要被设置,PUT 一律 409——即使目标值与当前生效状态一致(如 env=1 时 PUT true)。更精确的做法是仅在实际冲突时 409;现状可接受(UI 在 env 强制时已禁用按钮,不会误触)。
  2. src/config.ts 注释里写的是 "ACP_PASSTHROUGH 一键静默关死全部压缩:无日志/无横幅/面板不可见且不可清除,同族 env 旋钮全部生效于无声 #405 boot warning",实际对应 ACP_PASSTHROUGH one-click silent kill of all compression: no logs / no banners / panel invisible and non-clearable, all sibling env knobs take effect in silence | ACP_PASSTHROUGH 一键静默关死全部压缩:无日志/无横幅/面板不可见且不可清除,同族 env 旋钮全部生效于无声 #403,建议顺手改。

已代办:编号修正

标题和正文原本标 #405(那是 proxy-origin 劫持链,已由 #514 修复);本 PR 真正修的是 #403。若不改,合并时会误关 #405 且 #403 保持打开。我已将标题改为 ...(#403)、正文首行改为 Fixes #403.(如不认可可直接改回)。

合并前两点提示

  1. 本 PR 是堆叠分支:除 passthrough 修复外,还携带 release v0.1.85(bd38013)、fix: emit /acp panel as persistent custom message and strip it from the proxy model context (#359) #360 的 acp-panel persistent-strip(a8c78a1/b96fce5)和 findFreePort 测试修复。查证:npm view billion-context version = 0.1.85、tag v0.1.85 指向本分支的 ea5ed84——即 v0.1.85 已从该堆叠分支发布,npm 与 master(仍停在 0.1.84)脱节。合并本 PR 是让 master 追平已发布现实的唯一途径,因此接受这种偏离"version 只在 release 分支变更"的形式(否则 master 会永久落后于 npm)。只是显式标注一下,让你确认这是有意为之。
  2. E2E 未跑:本沙箱无法连通回环 LLM 上游(e2e-codex 需要 127.0.0.1 上游)。由于本 PR 触及请求管线(fix: emit /acp panel as persistent custom message and strip it from the proxy model context (#359) #360 的三处 strip 调用)且捆绑了 acp-kernel 0.0.51→0.0.52,按仓库规范建议在合并前手动触发一次 ci-e2e.yml(需 secrets)。

另外 CI 已发布 billion-context@pr-547 tag,可直接 npm i -g billion-context@pr-547 手动体验。

@ranxianglei ranxianglei changed the title fix: surface passthrough everywhere it silently killed compression (#403) fix: surface passthrough everywhere it silently killed compression (#405) Sep 5, 2026
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 ework agent · qwen3.8-27b

[bot] 🏷 更正:我上一条消息里的编号判断错了,已回滚。

我查证了 GitHub API 的权威记录(此前误信了本地镜像的过期数据):

即:原 PR 标题/正文的 #405 从一开始就是对的。我已把标题改回 ...(#405)、正文首行改回 Fixes #405.——合并后将正确关闭 #405。连带撤回上一条评审里的第 2 点小意见:src/config.ts 注释里的 "#405" 引用本来就是正确的,无需修改。

顺带报告一个平台侧小问题(仅报告):ework 本地的 issue 检索仍把这条 PASSTHROUGH issue 显示为 #403 [OPEN],与 GitHub 实际状态(#403 已关闭、#405 open)不符——镜像同步可能有偏差,建议你留意。

其余评审结论不变:预检全绿(typecheck / 1043 of 1044 / build / 专项 2-of-2)、live smoke 覆盖 #405 全部验收标准、堆叠分支携带 v0.1.85 release + #360 内容属有意追平 npm 现状、建议合并前手动触发一次 ci-e2e(请求管线有 #360 strip 改动且捆绑 acp-kernel 升至 0.0.52)。

@ranxianglei
ranxianglei merged commit 4bd6c87 into master Sep 5, 2026
6 checks passed
@ranxianglei
ranxianglei deleted the 2026-09-05_passthrough-visibility branch October 15, 2026 05:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ACP_PASSTHROUGH 一键静默关死全部压缩:无日志/无横幅/面板不可见且不可清除,同族 env 旋钮全部生效于无声

1 participant