Skip to content

[PR] feat: opt-in transparent WebSocket passthrough (#1467) - #1472

Closed
ranxianglei wants to merge 4 commits into
masterfrom
2026-09-27_ws-passthrough
Closed

ranxianglei wants to merge 4 commits into
masterfrom
2026-09-27_ws-passthrough

Conversation

@ranxianglei

@ranxianglei ranxianglei commented Sep 27, 2026 •

Copy link
Copy Markdown
Owner

What

Phase 1 of #1467: an opt-in transparent WebSocket relay. When enabled, a WS upgrade addressed to the proxy is replayed at the real upstream and, on 101, both sides are piped as opaque byte streams — frames are never parsed, so these sessions get NO compression (loud boot warning). This unblocks WS-only upstreams (e.g. OpenAI Realtime API) that cannot use the HTTP/SSE compression pipeline.

Behavior change (flagged per deliverables): old = unconditional 426 Upgrade Required for every upgrade; new = still 426 by default, 101 only when explicitly opted in. The default path is byte-for-byte unchanged — the Codex fast-fallback contract (#2) is pinned by the untouched tests/ws-upgrade.test.ts (both plain and MITM-decrypted TLS), which passes as-is.

Design

  • Config: top-level "ws": { "passthrough": true } beside mitm; env BILI_WS_PASSTHROUGH=1/0 wins over the file; default OFF (same resolution pattern as other server flags).
  • New module src/ws-passthrough.ts holds all new logic (resolveWsDestination, buildUpgradeHead, handleWsUpgrade) so it is unit-testable without network; src/server.ts only routes the existing upgrade listener to it when opted in.
  • Destination forms: /bili/wss(s)://… embedded, absolute-form ws(s)://…, and MITM-terminated connections (the post-TLS handshake is forwarded instead of hitting the plain-HTTP handler — one listener covers both because doMitm feeds decrypted sockets back into the same server). Unroutable upgrades (plain origin-form) still get 426.
  • Admission: direct destinations pass the same [SECURITY] /bili/<绝对URL> 零配置隧道无目标准入:可回环访问自家管理面、触达 link-local 元数据;0.0.0.0 部署下 LAN 可经 PUT 劫持全部流量凭据(架空自述的 loopback-only 防线) #409 checks as the /bili/ tunnel (self/link-local/private-from-remote denied with 403); MITM-terminated connections skip re-admission (already gated at CONNECT time).
  • Egress reuses resolveProxy + connectThroughProxy (model-path semantics); wss wraps the connected socket in TLS.
  • Replay fidelity: request rebuilt from inbound headers verbatim except hop-by-hop/forwarding headers; Host rewritten to the destination authority. Bytes pipelined behind the handshake request (Node's upgrade third argument head) are forwarded to the upstream right after the rebuilt head — nothing silently dropped.
  • Honest propagation: non-101 upstream answers (e.g. 401) are forwarded verbatim; connect/handshake failures answer 502. No masking.
  • Web UI: the original four small web edits (overview banner + i18n keys, written against the pre-rewrite UI) were dropped at rebase because master's web UI was rewritten meanwhile (feat(web): full UI rewrite — read-only overview / sessions / config / connect (#1420) #1426). The boot-time warn + startup banner line + CONFIGURATION.md disclosure remain. Re-adding the banner on the new UI is a cosmetic follow-up (owner-deferred).
  • Docs: CONFIGURATION.md (### ws + env-var table row), README zh/en in sync.

Tests (all ports via listen(0))

New tests/ws-passthrough.test.ts (10 tests): 101 + bidirectional frame round-trip with header-fidelity assertions (Host rewrite, custom-header pass-through); absolute-form relay; non-101 (401) verbatim propagation; self-target 403; link-local 403; unroutable origin-form still 426 when enabled; blind-tunnel WS survival (no opt-in needed — opaque CONNECT pipe); pipelined-bytes survival (single write of handshake + early frame, asserts the echo round-trips); unit matrix for resolveWsDestination (incl. MITM marker socket) and buildUpgradeHead.

Phase 2

Protocol-aware WS compression is deliberately NOT implemented (design-first follow-up per the issue).

Pre-flight (on this head 1cabbaf4)

  • npm run typecheck — clean
  • npm test — 3011 pass / 0 fail / 12 skipped (pre-existing gates)
  • npm run build — success, dist import annotations OK
  • Cross-mode reasoning (§6): this change is transport-level, before the request pipeline; neither compression mode is affected (WS sessions never enter a session).

Closes #1467

Config Surface (required per AGENTS.md §Configuration Surface Discipline)

What is added:

  • Config file field: top-level ws.passthrough (boolean, default false) — new optional FileConfig.ws section beside mitm.
  • Env var: BILI_WS_PASSTHROUGH (1/0); wins over the file; resolution follows the repo-wide (env ?? fileDerived) !== "0" convention shared by BILI_LOG_MASK_HOSTS, BILI_SUBAGENT_SPLIT, BILI_FORK_ADOPTION.

Why the existing surface cannot express it: no existing key controls WebSocket upgrade handling — before this change every upgrade unconditionally answered 426 (#2 Codex fast-fallback contract). The existing passthrough / ACP_PASSTHROUGH flag bypasses the compression pipeline for HTTP sessions; it says nothing about transport mode, and enabling it does not make WS upgrades routable. The providers table routes which upstream serves an HTTP model path — WS destinations are not necessarily LLM providers with model paths, and the relay is verbatim (no provider semantics apply). A dedicated boolean is the minimal expression.

Mechanisms considered:

  1. Reuse/extend passthrough — rejected: different mechanism (compression bypass vs transport relay); conflating them would open WS egress for users who only wanted compression off, silently changing the security surface of an existing flag.
  2. Per-provider entry in the providers table — rejected: WS destinations are not necessarily providers; admission ([SECURITY] /bili/<绝对URL> 零配置隧道无目标准入:可回环访问自家管理面、触达 link-local 元数据;0.0.0.0 部署下 LAN 可经 PUT 劫持全部流量凭据(架空自述的 loopback-only 防线) #409) is a global concern independent of routing.
  3. Flat top-level boolean (like maskHosts/subagentSplit) vs nested ws section — nested chosen because the issue author proposed exactly this shape in feat: support wss:// (WebSocket) traffic — opt-in transparent passthrough now, protocol-aware compression later #1467 and it leaves room for future WS-specific keys (Phase 2) without another top-level addition.
  4. Launcher/extension channels — N/A: server-side transport behavior, not client-specific.

Compat/migration: purely additive, default OFF. Existing configs parse identically (new fields optional). Every upgrade request under default settings behaves byte-for-byte as before (pinned by the untouched tests/ws-upgrade.test.ts, plain + MITM-decrypted TLS). Nothing to migrate.

Sign-off provenance: shape proposed by the owner in #1467 (issue opened by @ranxianglei specifying the exact form and the BILI_MITM env pattern), satisfying rule 3 (explicit owner sign-off before implementation). This section was added during review because §Configuration Surface Discipline landed on master via #1471 while this PR was in flight.

Review addendum (agent self-review, 2026-09-27)

  • New labeled commit fix(tunnel): admit portless wss destinations on scheme-default 443: checkTunnelDestination (src/tunnel-guard.ts) computed the default port as https ? 443 : 80, so a portless wss://host destination — newly routable by this PR — was admitted as port 80 while handleWsUpgrade connects on 443. Consequences fixed: BILI_TUNNEL_ALLOWED_HOSTS entries of host:443 never matched WS destinations, and the self-targeting layer mis-evaluated when bili itself listens on 443. Pinned in tests/tunnel-guard.test.ts (scheme-default test now covers wss self-layer + allowlist match).
  • Two follow-up commits pushed on top (head 92746f4e) verified: (a) fix(ws) pipelined-bytes forwarding — correct fix at source (Node hands post-handshake bytes to the upgrade listener as head; they were discarded before relay), pinned by a new test; (b) rebase onto v0.1.163 dropping the old-UI web edits — accepted (owner-scoped deferral; see Web UI bullet above).
  • Rebased onto CURRENT master (86e0b684, which includes feat: inherit refs/blocks/lineage across resume forks (#1486) #1519 / Claude 上 resume 导致消息错乱 #1486 resume-ref-inheritance — master advanced past this PR's base while it was in flight, and feat: inherit refs/blocks/lineage across resume forks (#1486) #1519 rewrote regions of src/server.ts). Single textual conflict (adjacent env-table rows in CONFIGURATION.md) resolved by union. Final diff vs master is exactly the 9 intended files; src/server.ts diff contains zero deletions of master code. Full gates re-run green on the new head (typecheck clean; 3011 pass / 0 fail / 12 skipped; build OK incl. dist import annotations).

@github-actions

github-actions Bot commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

📦 Built Package Artifact

Branch: 2026-09-27_ws-passthrough (4d7986f)

Option A — Install this exact build (recommended)

npm install -g billion-context@0.0.1725-pr.1472.cf8beca

This exact version is immutable and reproducible. The rolling pr tag tracks the newest test build across all PRs.

Option B — Download artifact

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

Install instructions are refreshed on each push.

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 Reviewing now — interim status:

Full conclusion shortly.

ranxianglei pushed a commit that referenced this pull request Sep 27, 2026
…1472 review)

checkTunnelDestination computed the default port as https?443:80, so a portless wss:// destination (newly routable via the ws passthrough of #1467) was admitted as port 80 while handleWsUpgrade connects on 443: BILI_TUNNEL_ALLOWED_HOSTS host:443 entries never matched WS destinations and the self layer mis-evaluated when the proxy listens on 443. Treat wss like https for the default port; pin both consequences in the scheme-default test.
@ranxianglei
ranxianglei force-pushed the 2026-09-27_ws-passthrough branch from a89724c to c29ae05 Compare September 27, 2026 04:55
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 Review complete — mergeable. PR #1472 (head now c29ae051, rebased onto master cae30bb3 + one labeled fix commit from this review).

① Original issue direction (#1467): sound. Root cause correctly identified (unconditional 426 at src/server.ts blocks WS-only upstreams like OpenAI Realtime); Phase 1 scoped as opt-in transparent relay with NO compression is the right minimal step; Phase 2 (protocol-aware compression) deliberately deferred pending design sign-off, per the issue. The owner-proposed config shape was followed exactly.

② Regression inventory (touched paths → verdict):

  • Upgrade listener / Codex fast-fallback contract (fix: address all code review findings (condense, routing, session-id, dead code) #2): rejectUpgrade426 extracted verbatim — log line, status, JSON body byte-identical; taken whenever the flag is OFF or the upgrade is unroutable. Untouched tests/ws-upgrade.test.ts (plain + MITM-decrypted TLS) passes. Preserved.
  • Boot log/banner: suffix appended only when ON. Default output byte-identical. Preserved.
  • Config loading: purely additive optional fields (FileConfig.ws, ProxyOptions.wsPassthrough*); existing configs parse identically; env-wins resolution matches the repo convention. Preserved.
  • GET /__bili/config: additive wsPassthrough key. Preserved (additive).
  • Web overview: new banner div, hidden by default. Preserved.
  • tunnel-guard admission: ONE deliberate semantic change — see behavior-change flags below.
  • Egress (resolveProxy/connectThroughProxy), session pipeline: untouched; WS sessions never enter a session object, so neither compression mode is affected (§6 cross-mode reasoning holds — transport-level, pre-pipeline).

③ Code review (main gate): src/ws-passthrough.ts is clean. All failure paths total (no throw-escape out of the async handler); hop-by-hop/forwarding headers stripped and Host rewritten while RFC 6455 handshake headers pass through; non-101 answers forwarded verbatim, connect/handshake failures answer 502 — no masking anywhere; MITM-marker relay hardcodes wss:// which is correct because doMitm always stamps https://<host> after terminating TLS (src/mitm.ts:261). Admission reuse of #409 checks is appropriate (MITM-terminated connections skip re-admission, gated at CONNECT time).

④ Test validity: the 9 new tests have teeth — replayed-head assertions on the fake-upstream side (path, Host rewrite, no proxy-host leak, custom-header verbatim), bidirectional byte proof via echo (S-PUSH/C-PING), 401 verbatim propagation, self/link-local 403s, 426-preserved-when-enabled, blind-tunnel survival without opt-in, plus unit matrices for both pure functions. All ports via listen(0). Residual gaps (report-only, not blockers): the wrapTls wss-egress path has no test (needs a cert rig), and the MITM-marker flow is covered at unit level only, not end-to-end through a real server.

⑤ Diff cleanliness: every line serves the PR purpose; no unrelated churn, no whitespace noise. Rebased onto current master (only overlap was disjoint hunks in CONFIGURATION.md).

Behavior-change flags (old → new, why):

  1. (in PR body) Upgrades: unconditional 426 → still 426 by default, 101 only with explicit opt-in. Default byte-for-byte unchanged.
  2. (my review fix, commit c29ae051) Portless wss://host destination in checkTunnelDestination: admitted as port 80 → now 443. Why: the relay connects on 443, so before the fix BILI_TUNNEL_ALLOWED_HOSTS entries of host:443 never matched WS destinations and the self-targeting layer mis-evaluated when bili listens on 443. No observable effect outside the new feature — the /bili/ HTTP tunnel can't reach wss:// at all (undici fetch rejects non-http(s) schemes). Pinned in tests/tunnel-guard.test.ts.
  3. Spec compliance: amended the PR description with the "Config Surface" section required by the discipline that landed on master via docs(agents): config-surface discipline — owner-gated, explicit reporting, no self-initiated shapes #1471 while this PR was in flight (field/env/state surface, why existing mechanisms can't express it, alternatives considered, compat story, sign-off provenance from your feat: support wss:// (WebSocket) traffic — opt-in transparent passthrough now, protocol-aware compression later #1467 shape proposal).

Verification: original head a89724cc — all 13 CI jobs green. New head c29ae051 — local typecheck clean, full suite 2892 pass / 0 fail / 12 skipped (pre-existing gates), build OK incl. dist import annotations; CI re-run on the new head: 9/13 already green (e2e, registry, build-artifact, version-guard, all real-client lanes), the 4 unit-test jobs were still running at posting time.

One-line summary: 修复了 WS 透传准入中 portless wss:// 目标按 80 端口评估的缺陷(与 relay 实际连接的 443 不一致,导致 allowlist host:443 失配),已 rebase 到当前 master、补上 config-surface 说明并全量验证通过,可以合并。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 Final status: CI fully green (13/13) on head c29ae051 — the 4 unit-test jobs that were still running at my last reply all passed. Nothing outstanding on this PR; it's ready for a human merge.

中文摘要:WS 透传 PR 已 rebase 到最新 master、修复了 wss 默认端口准入缺陷并补齐 config-surface 说明,本地与 CI 全量验证通过(13/13 绿),可以合并。

ranxianglei added a commit that referenced this pull request Sep 27, 2026
…upstream (#1472)

Node's upgrade event hands over any bytes the client pipelined after its
handshake request as the third argument; the listener discarded them, so a
pipelining client's early frames were silently dropped. Accept the buffer,
write it to the upstream right after the rebuilt handshake head (compliant
clients send none, so the default path is unchanged).
ranxianglei pushed a commit that referenced this pull request Sep 27, 2026
…1472 review)

checkTunnelDestination computed the default port as https?443:80, so a portless wss:// destination (newly routable via the ws passthrough of #1467) was admitted as port 80 while handleWsUpgrade connects on 443: BILI_TUNNEL_ALLOWED_HOSTS host:443 entries never matched WS destinations and the self layer mis-evaluated when the proxy listens on 443. Treat wss like https for the default port; pin both consequences in the scheme-default test.
ranxianglei added a commit that referenced this pull request Sep 27, 2026
…upstream (#1472)

Node's upgrade event hands over any bytes the client pipelined after its
handshake request as the third argument; the listener discarded them, so a
pipelining client's early frames were silently dropped. Accept the buffer,
write it to the upstream right after the rebuilt handshake head (compliant
clients send none, so the default path is unchanged).
@ranxianglei
ranxianglei force-pushed the 2026-09-27_ws-passthrough branch from 4328f95 to 92746f4 Compare September 27, 2026 15:18
@ranxianglei

Copy link
Copy Markdown
Owner Author

Two changes pushed on top (head 92746f4, CI 13/13 green, now mergeable clean after rebase onto v0.1.163):

  1. fix(ws): forward bytes pipelined behind the handshake request — the upgrade listener discarded Node's third head argument, so a pipelining client's early frames (bytes sent immediately after its handshake request, before any 101) were silently dropped. handleWsUpgrade now accepts the buffer and writes it to the upstream right after the rebuilt handshake head; compliant clients send none, so the default path is unchanged. Pinned by a new test (single-write handshake + "C-EARLY", asserts the echo round-trips).

  2. Rebased onto v0.1.163 master (the feat(web): full UI rewrite — read-only overview / sessions / config / connect (#1420) #1426 web rewrite landed in between). Resolution: kept the full server-side feature; the PR's four small old-UI web edits (banner + i18n keys written against the pre-rewrite UI) were dropped in favor of master's rewritten UI — re-adding the ws banner on the new UI is a cosmetic follow-up. The boot-time warn + startup banner line + CONFIGURATION.md disclosure are unchanged.

Local gates: tsc -p tsconfig.build.json 0 errors; ws-passthrough 10/10 (incl. the new pipelined-bytes test), ws-upgrade + tunnel-guard + web 13/13.

ework-agent and others added 3 commits September 28, 2026 00:11
When ws.passthrough is enabled (config "ws": {"passthrough": true} or
BILI_WS_PASSTHROUGH=1, env wins), WS upgrades addressed to the proxy are
replayed at the real upstream and piped as opaque byte streams on 101.
Frames are never parsed, so these sessions get NO compression (loud boot
warning + web-UI banner). Supported forms: /bili/wss(s):// embedded,
absolute-form ws(s)://, and MITM-terminated connections (post-TLS
handshake forwarded). Direct destinations pass the #409 admission checks;
blind tunnels already carry WS bytes opaquely (pinned by test). Non-101
upstream answers are forwarded verbatim; connect/handshake failures answer
502.

Behavior change: default config is unchanged — every upgrade still answers
the byte-exact 426 fast-fallback Codex relies on (#2), pinned by the
untouched tests/ws-upgrade.test.ts. The new 101 path only exists when
explicitly opted in.

Phase 2 (protocol-aware WS compression) is deliberately not implemented.

Preflight: typecheck clean, full suite 2880 pass / 0 fail, build OK.
…1472 review)

checkTunnelDestination computed the default port as https?443:80, so a portless wss:// destination (newly routable via the ws passthrough of #1467) was admitted as port 80 while handleWsUpgrade connects on 443: BILI_TUNNEL_ALLOWED_HOSTS host:443 entries never matched WS destinations and the self layer mis-evaluated when the proxy listens on 443. Treat wss like https for the default port; pin both consequences in the scheme-default test.
…upstream (#1472)

Node's upgrade event hands over any bytes the client pipelined after its
handshake request as the third argument; the listener discarded them, so a
pipelining client's early frames were silently dropped. Accept the buffer,
write it to the upstream right after the rebuilt handshake head (compliant
clients send none, so the default path is unchanged).
@ranxianglei
ranxianglei force-pushed the 2026-09-27_ws-passthrough branch from 92746f4 to 1cabbaf Compare September 27, 2026 16:16
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 收到,已逐条核验你推的两个 commit,并做了一轮收尾 rebase。结论:两个 commit 都没问题;分支已 rebase 到当前 master 并全绿,CI 跑绿后即可合并。

① fix(ws) pipelined-bytes(head 92746f4e)— 正确,修在源头。 Node 的 upgrade 事件把客户端在握手请求之后、收到任何响应之前发出的字节作为第三个参数 head 交给监听器;原实现丢弃了它,这些字节永远不会进入 relay pipe。现在 handleWsUpgrade(req, client, deps, head = Buffer.alloc(0)) 在重建的握手头写入后立即转发(顺序正确、仅成功 relay 路径生效,403/502/unroutable 路径不涉及)。新测试有牙:单次写 handshake + "C-EARLY",断言 echo 往返——修复前 C-EARLY 到不了 fake upstream,断言必挂。默认路径不受影响(合规客户端不发 early bytes)。

② rebase + 丢弃旧 UI web edits — 接受你的取舍。 #1426 重写后那四个旧 UI 编辑(banner/i18n key)确实没有落点,boot warn + 启动 banner 行 + CONFIGURATION.md 披露保留是合理的最小面。注意:PR body 里 "Web UI" 一条和 Config Surface 里的 GET /__bili/config 描述已经与新 diff 不符——我已 PATCH 修正(body 现在如实写:web 编辑随 #1426 丢弃,banner 重加是 cosmetic follow-up,owner-deferred)。

③ 本轮我做的收尾:rebase 到当前 master(86e0b684,含 #1519/#1486 resume-ref-inheritance)。 原因:master 在你 push 之后又前进了(#1519 重写了 src/server.ts 的区域),而分支 base 停在 v0.1.163。按 AGENTS.md §7.2「rebase to CURRENT master before claiming mergeable」我重新 rebase:唯一文本冲突是 CONFIGURATION.md env 表相邻两行(#1519 的 BILI_RESUME_INHERITANCE vs 本 PR 的 BILI_WS_PASSTHROUGH),按并集解法两行都保留。最终 diff vs master = 恰好 9 个预期文件,src/server.ts 的 diff 对 master 代码零删除,#1519 的 chain-tracking/resume-inheritance 全部在场。说明一句过程:中途我曾把旧 head 与 master 的 server.ts 差异判读为「rebase 丢掉了 #1486 代码」,精确诊断后确认实为分支落后于 master 的正常现象(并非真丢失),rebase 后该风险归零——如实记录,避免误导。

本地 gates(新 head 1cabbaf4): typecheck clean(acp-kernel 0.0.97);npm test 3011 pass / 0 fail / 12 skipped(既有 gate);build OK + dist import annotations OK。另:我之前本地跑出的 2 个 ccr-plugin 失败是我自己 node_modules 里 acp-kernel 停在 0.0.95 的陈旧产物(rebase 跨依赖 bump 后没重跑 npm ci),不是本 PR 或 master 的问题——已在干净依赖下复验为 0 fail。

CI 正在新 head 上跑,跑绿我会回帖确认。合并操作留给你(规则禁止 agent merge):#1472

中文摘要:核验了你推的两个 commit(pipelined-bytes 修复正确、web edit 取舍合理),发现 master 已被 #1519 推进后把分支 rebase 到当前 master(唯一冲突按并集解决),全量测试 3011 过 0 挂,PR 描述已同步修正,可以合并。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 CI 已在新 head 1cabbaf4 上全绿:13/13 success(unit tests ubuntu-22/24 + windows-22/24、e2e real codex、hermetic registry e2e、build-artifact、version-guard、real-client lanes opencode/codex/pi/dsh)。

本 PR 至此就绪,无阻塞项。合并留给你:https://github.com/ranchxianglei/billion-context/pull/1472 (更正链接:#1472)

中文摘要:新 head 上 CI 13/13 全绿,PR 全部审查项闭环(两个 follow-up commit 核验通过、rebase 到当前 master、描述已修正),可以合并。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 更正上一条里的笔误(多了一个拼错的链接):PR 链接以这个为准 — https://github.com/ranchxianglei/billion-context/pull/1472 …抱歉,正确地址是 #1472

ranxianglei added a commit that referenced this pull request Oct 3, 2026
…ses becomes the first codec

- src/ws-bridge.ts: protocol-independent shell (admission, upgrade, labeled
  logging, exactly-once shutdown teardown) driven by a codec table
- src/responses-ws.ts: Responses-specific handling becomes responsesCodec
  (WsBridgeCodec/WsBridgeSession contract)
- src/server.ts: single wiring site installWebSocketBridge(server, dispatch,
  log, [responsesCodec]); unclaimed upgrades keep the existing 426
- tests/ws-bridge.test.ts: drives the shell with a synthetic second codec to
  pin the codec-table abstraction
- docs: architecture section covering the shell/codec split; new protocols
  are a codec file plus one table entry; unknown protocols stay on #1472
ranxianglei added a commit that referenced this pull request Oct 3, 2026
…ses becomes the first codec

- src/ws-bridge.ts: protocol-independent shell (admission, upgrade, labeled
  logging, exactly-once shutdown teardown) driven by a codec table
- src/responses-ws.ts: Responses-specific handling becomes responsesCodec
  (WsBridgeCodec/WsBridgeSession contract)
- src/server.ts: single wiring site installWebSocketBridge(server, dispatch,
  log, [responsesCodec]); unclaimed upgrades keep the existing 426
- tests/ws-bridge.test.ts: drives the shell with a synthetic second codec to
  pin the codec-table abstraction
- docs: architecture section covering the shell/codec split; new protocols
  are a codec file plus one table entry; unknown protocols stay on #1472
ranxianglei added a commit that referenced this pull request Oct 3, 2026
…ses becomes the first codec

- src/ws-bridge.ts: protocol-independent shell (admission, upgrade, labeled
  logging, exactly-once shutdown teardown) driven by a codec table
- src/responses-ws.ts: Responses-specific handling becomes responsesCodec
  (WsBridgeCodec/WsBridgeSession contract)
- src/server.ts: single wiring site installWebSocketBridge(server, dispatch,
  log, [responsesCodec]); unclaimed upgrades keep the existing 426
- tests/ws-bridge.test.ts: drives the shell with a synthetic second codec to
  pin the codec-table abstraction
- docs: architecture section covering the shell/codec split; new protocols
  are a codec file plus one table entry; unknown protocols stay on #1472
ranxianglei added a commit that referenced this pull request Oct 3, 2026
…ses becomes the first codec

- src/ws-bridge.ts: protocol-independent shell (admission, upgrade, labeled
  logging, exactly-once shutdown teardown) driven by a codec table
- src/responses-ws.ts: Responses-specific handling becomes responsesCodec
  (WsBridgeCodec/WsBridgeSession contract)
- src/server.ts: single wiring site installWebSocketBridge(server, dispatch,
  log, [responsesCodec]); unclaimed upgrades keep the existing 426
- tests/ws-bridge.test.ts: drives the shell with a synthetic second codec to
  pin the codec-table abstraction
- docs: architecture section covering the shell/codec split; new protocols
  are a codec file plus one table entry; unknown protocols stay on #1472
@ranxianglei

Copy link
Copy Markdown
Owner Author

(ai: zhipuai-lb/glm-5.3)

陈旧票清理(第三批动作①):目标 issue #1467 已关。为避免重复劳动关闭本 PR;如判断有误请直接 reopen 并留言。

@ranxianglei ranxianglei changed the title feat: opt-in transparent WebSocket passthrough (#1467) [PR] feat: opt-in transparent WebSocket passthrough (#1467) Oct 24, 2026
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.

feat: support wss:// (WebSocket) traffic — opt-in transparent passthrough now, protocol-aware compression later

1 participant