Skip to content

[PR] fix(pi): inline mode now intercepts codex Responses WebSocket traffic (#4526) - #4559

Open
ranxianglei wants to merge 15 commits into
masterfrom
wt-4526-ework-daemon
Open

ranxianglei wants to merge 15 commits into
masterfrom
wt-4526-ework-daemon

Conversation

@ranxianglei

Copy link
Copy Markdown
Owner

Closes #4526

What & why

With BILI_PI_INLINE on, pi's HTTP model traffic correctly ran through the in-process engine — but the Codex Responses WebSocket lane was left unpatched on the false premise that "the pi lane does not use codex WS". It does: pi rides the codex provider over exactly that lane (#2073/#2111). So codex WS dialed the model directly — uncompressed, with no ACP session record. The old comment claiming otherwise is removed.

Changes

  1. Loopback WS bridge in the inline engine (src/inline-engine.ts). The engine binds one real listener: a loopback-only HTTP server on an ephemeral 127.0.0.1 port that serves WebSocket upgrades only, reusing installWebSocketBridge verbatim from the spawn-mode path (loopback-source admission, tunnel-destination SSRF guard, session lifecycle) with the codex codec and the same per-request pipeline (pipelineFor, shared with the HTTP dispatcher). Unclaimed upgrades keep the 426 contract so Codex's fast-fallback can switch to HTTP POST (which still compresses in-process). Plain HTTP on that port gets a 404. The listener is unref()'d — it never holds the host process open.
  2. Graceful degradation. If the bind fails (or engine bootstrap rejects), ONLY the WS channel degrades direct with a one-shot warn; the engine and HTTP compression stay healthy. No undialable pseudo-origin URL is ever handed to a real dialer.
  3. Client-side routing (src/agent/native-ws-intercept.ts, src/agent/pi-native.ts). Inline mode now installs the WebSocket wrapper too. In inline mode the wrapper resolves its target through state.resolveInlineWs/state.wsOrigin (the bridge origin, decided when the engine settles) instead of state.origin — which is frozen to the pseudo-origin that never listens and would short-circuit readyOrigin to an undialable URL. Connections made before the decision settle are held in the existing deferred shell. Spawn/attach lanes are byte-identical: the new branch keys on the inline-only resolver being present.
  4. Switch value table + observability (planNativePi). See Behavior changes below; arm-time info log makes the switch visible in the host log.

Behavior changes (old → new)

# Old New Why
1 BILI_PI_INLINE enabled inline only for 1/true (case-insensitive); on/yes/ON/… silently fell through to spawn mode (the reported "inline doesn't work, still starts a server" confusion) Any non-empty value other than 0/false/no/off enables inline The issue's second complaint: unrecognized values must not silently pick a different mode
2 Off values were only 0/false; no/off were unrecognized, so the config-file pi.inline: true still WON over them Off tokens expanded to 0/false/no/off; they now disable over the file value Explicit-off must mean off
3 Inline mode bound no listener at all One unref'd loopback-only upgrade listener on an ephemeral port (bind failure degrades only the WS channel direct, warned) A WebSocket needs a real dialable endpoint; loopback-only keeps the attack surface at zero
4 Inline mode skipped installNativeWebSocketIntercept entirely Installed in every non-off mode; inline routes via the bridge The actual bug fix
5 No log line saying inline took effect Arm-time info: [bili-native(pi)] inline mode active — compression runs in-process, no proxy spawned; engine log gains the bridge address Observability requested in the issue

Blank/whitespace values keep today's semantics (neutral — the config file decides). Spawn/attach lanes: no change.

Config surface

No new field/env/flag. BILI_PI_INLINE (existing, documented in CONFIGURATION.md en+zh) gets a relaxed value table — rows updated in this PR.

Tests

  • tests/pi-native.test.ts: planNativePi truth table (on/yes/ON/" True " → inline; no/off/OFF/false → spawn; no/off beat fileInline=true; blank neutral).
  • tests/native-ws-intercept.test.ts: inline seams — settled fast-path rewrite to the bridge origin (and routedOrigin deliberately NOT recorded, avoiding a The same sessionId is served by two bili processes simultaneously: interleaved logs from global + pi-native dual instanc | 同一 sessionId 被两个 bili 进程同时服务:全局 + pi-native 双实例日志交织、重复 cold-load(split-brain) #3923 split-brain false alarm against the pseudo-origin), deferred hold while booting, degrade-direct on unavailable bridge, bootstrap rejection degrades without unhandled rejection.
  • NEW tests/issue4526-pi-inline-ws.test.ts (hermetic XDG, mock codex WS upstream): real engine boot exposes a dialable wsOrigin; real ws client round trip through the bridge — probe forwarded verbatim, turn compressed (ACP tools injected), ACP session recorded (the issue's missing-record symptom); plain HTTP on the bridge port → 404; wrong-shape upgrades → 426; end-to-end client wiring with BILI_PI_INLINE=on through the patched global WebSocket (deferred shell → attach → exchange).
  • Targeted suites green locally (pi-native, native-ws-intercept, pi-inline: 48 pass; issue4526 suite: 3 pass); typecheck clean. Full suite = CI.

No kernel/, no version bump, no lockfile churn.

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b)

查重:不重复——但这是同一 issue 的第二次 PR。 前一次尝试是 PR #4527(branch 2026-10-24_pi-inline-ws-bridge),已于今日 14:10Z 被关单,关单理由即「同 issue 存在更新的 PR #4559」。#4527 当时的审核结论:代码质量达可合标准、方向正确、回归干净;挡合入的是 master 自身存量红 + 一笔与在途 #4534 撞车的 docs-sync seed 提交。本 PR 应为吸收这些反馈后的重做(单 commit 9b99c17,+602−27,10 files)。

标签:bug, pi, codex, scope/wiring, p2(pi inline 车道 codex WS 绕过压缩;inline+codex 用户丢压缩但有绕行,非数据丢失/缓存泄露类,维持 #4527 审定的 p2)

开始按 PR 规范独立审核(不复读 #4527 的结论):①原 issue 方向 → ②回归审查 → ③代码 → ④测试有效性 → ⑤diff 整洁度。另注意到 GitHub 实时状态 mergeable=false/dirty(head 落后 master 4 个提交),会先验证是真冲突还是陈旧状态,需要的话 rebase 到最新 master 再交 CI。结论稍后以结构化八问回复。

@github-actions

github-actions Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

📦 Built Package Artifact

Branch: wt-4526-ework-daemon (44219ec)

Latest build — install this exact version

npm install -g billion-context@0.0.5639-pr.4559.02db234

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

Recent builds (commit → version)

commit version build
44219ec billion-context@0.0.5639-pr.4559.02db234 build
8042523 billion-context@0.0.5563-pr.4559.5252517 build
e82ccd7 billion-context@0.0.5559-pr.4559.1790cd4 build
6056114 billion-context@0.0.5547-pr.4559.1dcce08 build
2b8c4e9 billion-context@0.0.5544-pr.4559.eb45599 build
af6786f billion-context@0.0.5536-pr.4559.b365935 build
f90e209 billion-context@0.0.5525-pr.4559.ec43943 build
b9e666a billion-context@0.0.5520-pr.4559.50d84dc build
e44c054 billion-context@0.0.5514-pr.4559.cbdc317 build

Download artifact

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

Install instructions are refreshed on each push.

ranxianglei pushed a commit that referenced this pull request Oct 24, 2026
 small fix)

#4526 widened the explicit-off tokens from {0,false} to
{0,false,no/off}; the pi.inline doc comment in FileConfig still listed
only 0/false. Comment-only, matches planNativePi (src/agent/pi-native.ts).
ranxianglei pushed a commit that referenced this pull request Oct 24, 2026
…4559 small fix)

Check-run id list left behind while debugging the CI failures; not part
of the change.
ranxianglei pushed a commit that referenced this pull request Oct 24, 2026
 small fix)

#4526 widened the explicit-off tokens from {0,false} to
{0,false,no/off}; the pi.inline doc comment in FileConfig still listed
only 0/false. Comment-only, matches planNativePi (src/agent/pi-native.ts).
ranxianglei pushed a commit that referenced this pull request Oct 24, 2026
…4559 small fix)

Check-run id list left behind while debugging the CI failures; not part
of the change.
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

(ai: vllm-qwen/qwen3.8-27b)

Review 完成,结论:方向正确、代码质量达标,可合(CI 绿后由人合并)。 我独立审了全部 diff(未照抄 issue 结论),ci-worker 修的两个门禁红已逐项验证,另发现并直接修掉一个错误路径缺陷,已 rebase 到最新 master 并推送——新 head af6786f(4 commits:主修复 + 两个小修 + 我的 parity 小修)。

结构化八问:

  1. 是什么问题:pi inline 模式(BILI_PI_INLINE)下,codex 的 Responses WebSocket 车道绕过压缩直连上游(HTTP 车道正常),不压上下文也不留 ACP 会话记录;且 BILI_PI_INLINE=on/yes 等取值被静默降级成 spawn 模式。
  2. 什么原因导致的:三层——① inline 分支把 state.origin 冻死成永不监听的伪源站 http://billion-context.inline;② installNativeWebSocketIntercept 在 inline 模式被跳过(旧注释错误声称 "pi lane does not use codex WS");③ planNativePi 只认字面量 1/true,其余非空值无日志回落 spawn。
  3. 影响范围与严重程度:仅影响显式开启 inline 且客户端走 codex Responses WS 车道的用户面;后果是 WS 流量不压缩(上下文增长/成本)+ 无会话记录,HTTP 不受影响。p2:能用且有绕行(spawn 模式或写 1/true)。
  4. 怎么修复的:机制层面三件事——引擎自己绑一个回环-only 的临时端口 WS upgrade 监听,逐字复用 spawn 模式的 installWebSocketBridge(loopback 源准入、隧道目标 SSRF 守卫、会话生命周期),同一 pipelineFor 供 HTTP 与 WS;客户端拦截器按连接解析目标:settled 直接改写 URL 到桥,booting 用既有 DeferredWebSocket 挂起等待,bootstrap 失败只降级 WS 单通道直连(warn 一次);值表放宽为「任何非空非 off 值启用」。
  5. 是否有回归问题:逐项核过——spawn/attach 车道字节级不变(新分支以 inline 专属字段 resolveInlineWs 存在性为键,该字段只在 armNativePi(inline) 设置);426 契约保持(未认领 upgrade 仍 426,Codex fast-fallback 的 HTTP POST 照样压缩);桥端口上的普通 HTTP 返回 404;监听器 unref() 不拖住宿主进程;桥刻意不记 noteRoutedOrigin(避免对伪源站误触 The same sessionId is served by two bili processes simultaneously: interleaved logs from global + pi-native dual instanc | 同一 sessionId 被两个 bili 进程同时服务:全局 + pi-native 双实例日志交织、重复 cold-load(split-brain) #3923 split-brain 告警,注释已写明理由)。行为变更均为有意且已在 PR 正文披露:on/yes/ON/… 从静默 spawn 变为启用 inline;off 集扩为 0/false/no/off 且优先于文件配置;arm 时新增一行 info 日志。审核中发现的真缺陷(已修):WS 桥此前把裸 handle() 交给会话,若 handle() reject(仅限 last-resort 内部错误),会话 catch 吞掉后 codex 看到的是截断流而非结构化错误帧——spawn 模式同场景经 dispatch catch 渲染 503+Retry-After(Circuit-open 502 keeps an opaque error string, and connect-refused alerts never reach the host GUI | [Bug][dsh] 熔断/连接失败时客户端只见常量 "acp-proxy failure":detail/upstreamFailure/alerts 全都没到用户眼前 #4254 形状)。两车道错误形状不一致正是本仓库纪律要防的类。已补 commit af6786fba:给桥的 dispatch 包上与 server.ts dispatch catch 相同的 egress(分类日志 + buildProxyFailureResponse 渲染),不改主修复语义。
  6. 是否破坏缓存:不涉及——未触碰缓存/账本/去重键;WS 与 HTTP 共用同一压缩决策路径。
  7. 是否改了设计方向:不涉及——这是补齐 移植 billion-context-pi 版本的非 server 模式 #3278 inline 车道缺失的 WS 通道,机制整体复用既有桥,无新架构。
  8. 是否引入新配置:不涉及——无新 env/config/flag;BILI_PI_INLINE 取值语义放宽属行为变更,第 5 问已披露旧值→新值。

验证状态:docs-sync 门禁本地实测通过(tools/gen-config-docs.mjs generate 零漂移,种子 yaml 已同步);unused-exports 修法核实安全(两个符号无任何模块外引用,测试只用 _closeInlineWsBridgeForTest 缝)。定向测试套件因本环境无 node_modules 未能本地跑,全量判定以远程 CI 为准——af6786fba 上正在跑(此前仅 docs-sync/unused-exports 两个门禁红,test 车道是被它们 need 掉取消的,现在会正常执行)。

收工判定:代码与行为审查通过,无拦下项;待 af6786f 的 CI 全绿即可合并(合并本人来)。标签: bug / pi / codex / scope/wiring / p2(首条回复已打,一句话理由:pi inline 车道 WS 流量漏压缩,功能性缺陷有绕行)。

ranxianglei pushed a commit that referenced this pull request Oct 24, 2026
…est (born-red positional drift) (#4559 small fix)
ranxianglei pushed a commit that referenced this pull request Oct 24, 2026
…small fix)

DecompositionSource (fold-decomposition-lookup.ts) and WatcherTickDecision
(server.ts) are referenced only inside their own files - zero external
usages across src/tests/kernel/pi-subagents. The unused-exports gate flags
both INTERNAL_ONLY once the #4572 train landed on master. Dropping the
export modifier is behavior-neutral (typecheck clean); StoredRow stays
exported (has an external consumer).
ranxianglei pushed a commit that referenced this pull request Oct 24, 2026
…from #4572 train (#4559 small fix)

The train added the external-summary config surface but the committed
generated docs predate it, so docs-sync regenerated one new table row
(compress.externalSummary) in each of the four derived files. Mechanical
regeneration via tools/gen-config-docs.mjs - no hand edits.
ci-check added 5 commits October 25, 2026 01:14
…#4526)

BILI_PI_INLINE left the Codex Responses WebSocket lane unpatched on the
false premise that "the pi lane does not use codex WS" (pi rides the
codex provider over that exact lane, #2073/#2111), so codex WS dialed the
model directly — uncompressed, no ACP session record.

- inline engine binds a loopback-only WS-upgrade listener (ephemeral
  127.0.0.1 port, unref'd) serving the same per-request pipeline through
  installWebSocketBridge verbatim (loopback-source admission, tunnel
  destination SSRF guard, 426 fallthrough parity with server.ts); a bind
  failure degrades ONLY the WS channel direct (warned) — HTTP compression
  and the engine stay healthy
- native-ws-intercept gains the inline lane: rewrites through
  state.resolveInlineWs/wsOrigin instead of the undialable pseudo-origin;
  defers connections until the engine decision settles; bootstrap failure
  degrades direct. Spawn/attach lanes byte-identical (branch keyed on the
  inline-only resolver being present)
- BILI_PI_INLINE value table: any non-empty value other than
  0/false/no/off now enables (on/yes/etc. used to fall through to spawn
  silently, reading as "inline does nothing"); off tokens expanded from
  0/false to 0/false/no/off — they now disable over the config-file
  pi.inline value too; arm-time info log makes the switch observable
- docs: CONFIGURATION.md/.zh-CN.md, LIFECYCLE.md
- tests: planNativePi truth table, WS-intercept inline seams
  (fast-path rewrite / deferred hold / degrade-direct / bootstrap
  rejection), new issue4526-pi-inline-ws integration suite (real engine
  boot + real ws client round trip through the bridge: probe + turn,
  ACP tools injected, session recorded; 404 plain HTTP; 426 wrong-shape
  upgrades)
 small fix)

#4526 widened the explicit-off tokens from {0,false} to
{0,false,no/off}; the pi.inline doc comment in FileConfig still listed
only 0/false. Comment-only, matches planNativePi (src/agent/pi-native.ts).
…4559 small fix)

Check-run id list left behind while debugging the CI failures; not part
of the change.
Review finding on the new inline WS bridge: it passed the bare pipeline to
installWebSocketBridge, so if handle() rejected (last-resort internal error),
the session's own catch swallowed it (warn + bare end) and Codex saw a
truncated stream instead of an error frame. Spawn mode renders the failure
into the same envelope via its dispatch catch (informative error, 503+Retry-After
on a circuit-open fail-fast, #4254) before resolving. Wrap the bridge's
dispatch with the identical egress so both lanes report the same failure shape.
…est (born-red positional drift) (#4559 small fix)
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

(ai: vllm-qwen/qwen3.8-27b)

状态更新(接上条八问结论):af6786fba 上又红了两个门禁(config-surface-guard、lock-sync)。查了日志与 master 历史,根因都不是本 PR 的代码问题——是我 rebase 之后 #4572 train 才落上 master(kernel 0.0.162→0.0.163 的 lockfile 同步、config-surface-guard 脚本自身的定位 bug、以及三个 internal-only export 的去导出),master 侧已在 4d34abfaf 一次修齐(其提交信息自认 "master-red too")。ci-worker 随后推的 3 笔小修里,2 笔(de-export、docs 再生成)与 master 那笔完全重复,另 1 笔(generation-boundary 测试位置漂移)是必要的——那是 master 自身 born-red 的测试:injectSystem 新增参数后测试调用没跟上,「active」用例把 true 传给了 mcpDialectNote 而不是 generationBoundaryActive,断言必挂。

当前处置:整支 rebase 到最新 master 146b34f27(git 自动丢弃 2 笔已上游化的重复提交,保留必要的测试修复),本地跑门禁验证后推送,CI 结果出来再报。

…orts (#4559 small fix)

The #4545 train added this type used only inside client-build-note.ts;
master's 4d34abf de-export sweep missed it, so every PR rebased onto
the tip inherits the red. Behavior-neutral (type only, zero external
usages).
ranxianglei pushed a commit to z0d0dOr/billion-context that referenced this pull request Oct 24, 2026
…ndary flag reaches injectSystem

Born-red inherited from base cd92b0b (ranxianglei#4305 landed after ranxianglei#4344 added the 8th
param but its test only passed 8 positional args, so the 'on' case's trailing
true bound to mcpDialectNote and generationBoundaryActive stayed false).
Byte-identical to ranxianglei#4606 commit 389b815 / ranxianglei#4559 e82ccd7; drop on the
post-ranxianglei#4606 rebase.
Zhishulo and others added 4 commits October 25, 2026 09:35
…est (master born-red, #4599 sentinel)

The tier-5 train added generationBoundaryActive as injectSystem's 9th parameter
and updated every caller except this test's 'active' case: its trailing true
landed in mcpDialectNote, so the note never appeared and the assertion must fail.
Identical one-line fix already committed on PR #4559's branch (e82ccd7); drop
that commit when rebasing whichever way merges first.
…s site (#4598, #4599 sentinel)

pages.yml has failed 75/75 runs since landing: actions/configure-pages@v5 gets
'Get Pages site failed ... Not Found' because GitHub Pages was never enabled on
this repo (the earlier enablement:true attempt was reverted without a recorded
reason — not re-applied here). Stop-the-bleed per #4598 option 1: drop the push
trigger, keep manual workflow_dispatch so the deploy path stays intact and no
website push red-lines master again. Final direction (re-enable Pages vs retire
the workflow vs in-install serving) awaits owner decision.
ci-check added 5 commits October 25, 2026 09:58
…ne-rewrite (#4599 sentinel)

The #3719 Updates tab stayed routed (PAGES/route/loadUpdates in client.ts)
but its topbar anchor was dropped when #3536 rewrote the whole topbar line,
making nav.updates a dead catalog key (web-i18n born-red on every PR head).
Restored at the original position (after logs); identical to the sibling fix
on the panel-blog branch (900c09c), adapted to master (no blog anchor yet).
…4427 Windows red, #4599 sentinel)

maskPathsForPublish keyed off os.homedir() alone. On Windows that reads
%USERPROFILE% while git-bash-style tool output carries $HOME paths, so the
publish-boundary identity leak masked one spelling and leaked the other
(#4427 suite red on windows shards only). Now masks the deduped set of
os.homedir() + $HOME + %USERPROFILE%; POSIX behavior unchanged (values
dedupe to one root), anchored-flank semantics preserved.
… restamp flag (#4599 sentinel)

Deliberate persisted-state change: 380ef4d (#4316 layer 3 PR3/3) added the
one-time refLedgerAligned boolean to session state. All four wire digests are
UNCHANGED; only the metadata section digest moved (+refLedgerAligned state
key). Regen per the suite's own protocol (justification recorded here and in
the ci-fixes PR body).
…wed-load interface (#4599 sentinel)

#D5-5 changed buildView to call store.unifiedMessageIdRows() +
store.unifiedUncoveredRows(id, intervals) first; the pre-existing fake stores
(only unifiedTailSeqs/unifiedTailViewRows) threw TypeError, caught by the
by-design degrade net as transcript-error, turning every render-expecting
assertion red (chain 6/6, verif replay). Extended both real-JS fakes and the
symbolic harness portImpls (__method_unifiedMessageIdRows /
__method_unifiedUncoveredRows) to mirror SessionStore semantics.
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

(ai: vllm-qwen/qwen3.8-27b)

duplicate of #4669 —— 同一症状 + 同一机制:inline 模式下 codex Responses WS 流量绕过压缩,解法都是回环 WS 桥拦截。#4669(10-25)是 #4526/#4527/#4571 悬空工作的全套 rebase 重提,其第 1 个提交完整包含本 PR 的 WS 桥工作(另加断流根因修复、TUI 日志、bili pi-inline 命令、默认翻转、面板/Web 徽章)。

说明:严格按先来后到本 PR(10-24)更早,但 #4669 是其超集且被明确定位为合并载体,故在此打 duplicate 标签指向它。关不关、要不要把本 PR 独有的 BILI_PI_INLINE 取值表/可观测性细节先并过去再关,由你定。

@ranxianglei ranxianglei added the duplicate This issue or pull request already exists label Oct 25, 2026
@github-actions github-actions Bot mentioned this pull request Oct 27, 2026
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

(ai: vllm-qwen/qwen3.8-27b)
🔶 需要决策

The conflict is not mechanical — it is a design decision. Both this PR and master independently implemented the same inline-WS-bridge feature (route codex Responses WS through a loopback bridge in pi inline mode) with different designs. The PR's work is now largely redundant with master.

Timeline (all 2026-10-25):

  • 177bbce322 09:58 — merge-base; the PR branched off here.
  • 44219eca6f 10:08 — PR head (this PR's implementation).
  • 7371b1ee97 18:02 — master commit "fix(agent): route the codex Responses WS lane through a loopback bridge in pi inline mode (移植 billion-context-pi 版本的非 server 模式 #3278 follow-up)" — master's independent implementation, merged 8 h after the PR branched.

Design divergence (both solve the same problem):

Aspect PR #4559 master (7371b1ee97)
Bridge location startInlineWsBridge inline in src/inline-engine.ts NEW src/inline-ws.ts (separate file)
Codecs [codexResponsesCodec] (1) [responsesCodec, codexResponsesCodec] (2)
InlineEngine.wsOrigin string (settled) Promise<string | undefined> (booting)
Client routing state.resolveInlineWs (fn) + state.wsOrigin (string) state.wsOrigin (Promise) via raceWsOriginBound
makeDispatcher refactored → makeDispatcher(pipeline, log) + pipelineFor(ctx) unchanged (makeDispatcher(ctx))
Tests tests/issue4526-pi-inline-ws.test.ts tests/pi-inline-ws.test.ts

Redundancy check — the PR's other contributions are also in master:

Conflict surface (10 files from git merge origin/master): CONFIGURATION.md, CONFIGURATION.zh-CN.md, LIFECYCLE.md, src/agent/native-ws-intercept.ts, src/agent/pi-native.ts, src/config.ts, src/inline-engine.ts, tests/native-ws-intercept.test.ts, website/config-reference/env-only.yaml, website/config-reference/server.yaml. Plus 3 auto-merged PR files that reference the PR's mechanism (src/agent/native-intercept.ts, tests/issue4526-pi-inline-ws.test.ts, tests/pi-native.test.ts) — taking master's version for the 10 conflicts alone would leave these inconsistent and break the build. This is not a clean take-theirs.


八问(决策请求):

  1. 是什么问题:PR [PR] fix(pi): inline mode now intercepts codex Responses WebSocket traffic (#4526) #4559 与 master 冲突,但冲突不是机械性的——PR 和 master 各自独立实现了同一个 inline WS bridge 功能(pi inline 模式下把 codex Responses WS 路由到 loopback bridge),设计不同,PR 的工作现在与 master 大量重复。需要 owner 拍板保留哪套实现。

  2. 什么原因导致的:PR 在 177bbce322(10-25 09:58)从 master 分叉;8 小时后 master 独立合入了同一功能的另一套实现(7371b1ee97,移植 billion-context-pi 版本的非 server 模式 #3278 follow-up,10-25 18:02)。两条分支解决了同一个问题(After enabling pi inline mode, codex's WebSocket traffic is not intercepted and still connects directly to the model (co | pi inline 模式打开后 codex 的 WebSocket 流量没被接管,仍直连模型(压缩被绕过) #4526 / 移植 billion-context-pi 版本的非 server 模式 #3278 follow-up),但用了不同的设计(PR: resolveInlineWs 函数 + wsOrigin string + 单 codec;master: wsOrigin Promise + 双 codec + 独立 inline-ws.ts),导致语义冲突。

  3. 影响范围与严重程度(按选项):

    • A(保留 master,丢弃 PR 重复工作):PR 变成 no-op(主功能 + 小修都已在 master)。无用户影响(master 的实现已上线)。严重程度:无。
    • B(保留 PR,回滚 master):需要回滚 master 的 7371b1ee97 并重新应用 PR 的设计。会改变线上行为(master 双 codec bridge → PR 单 codec bridge)。严重程度:高(回归风险——master 的实现更完整)。
    • C(两套合并):复杂,且 PR 没有独特价值(所有贡献都已在 master)。严重程度:中(两套实现不一致的风险)。
  4. 怎么修复的(推荐选项思路):推荐 A——对所有冲突文件保留 master 的版本,丢弃 PR 的重复 inline-WS 工作,PR 变成 no-op。然后由 owner 决定是否关闭 PR(关闭权在 owner,CI 侧不擅自关闭)。

  5. 是否有回归问题(按选项):

    • A:无回归(master 的实现不变,丢弃的是 PR 的重复工作)。
    • B:有回归风险(master 的双 codec bridge 被 PR 的单 codec bridge 替换;master 更干净的 API 丢失)。
    • C:有回归风险(两套实现不一致)。
  6. 是否破坏缓存:不涉及(这是 WS bridge 的事,与缓存无关)。

  7. 是否改了设计方向:A:不改(保留 master 的设计)。B:改(回滚到 PR 的设计)。C:混合。

  8. 是否引入了新的配置:不涉及(BILI_PI_INLINE 开关值表已在 master)。


Options:

  • A (recommended): Keep master's implementation, drop the PR's duplicate inline-WS work. The PR becomes a no-op. Owner then decides whether to close it (owner-only).
  • B: Keep the PR's implementation, revert master's 7371b1ee97. (Unlikely — master is already merged and more complete.)
  • C: Merge both, keeping master's as the base and preserving any PR-specific improvements. (Complex; the PR has no unique value.)

Recommendation: A.
Default if undecided: A (keep master's; the PR is redundant and should be closed by the owner).

What I did this run: Fetched the live PR state (head 44219eca6f, base master, merge state dirty, 15 commits, 26 files), checked out the PR head branch, attempted git merge origin/master (10 conflicts), analyzed the divergence (both branches independently implemented the same feature; master's is more complete; the PR's other contributions are also in master), aborted the merge (clean state, nothing pushed), applied the needs-decision label. No push performed — awaiting owner decision.

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

(ai: vllm-qwen/qwen3.8-27b)

Status: decision request already posted (floor 21), awaiting owner.

This run re-verified the live state: PR head 44219eca6f, base master, merge state still dirty. The conflict is a design decision (both the PR and master independently implemented the same inline-WS-bridge feature with different designs; the PR is largely redundant with master). My "🔶 需要决策" comment with options A/B/C + recommendation (A: keep master's, drop the PR's duplicate) is already posted at floor 21. The needs-decision label is applied.

No push performed. No further action possible until the owner decides. Stopping per owner policy 2026-11-01.

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[ework] CI fix verified green ✓

2 similar comments
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[ework] CI fix verified green ✓

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[ework] CI fix verified green ✓

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

(ai: vllm-qwen/qwen3.8-27b)

🔶 需要决策 — status update (attempt 1/6, no new action taken)

Re-verified live state this run:

  • PR head unchanged at 44219eca6f; master advanced to 4ea79acdbb; merge-base still 177bbce322.
  • Merge state still dirty (10-file conflict surface).
  • No owner response to the decision request posted earlier (floor 21).

Re-confirmed finding: the PR is NOT a pure no-op. Beyond the redundant inline-WS-bridge implementation (commit e2a7066926, superseded by master's src/inline-ws.ts from 7371b1ee97), the PR carries 4 unique commits not in master:

Commit What In master?
dc7d8885eb Render WS-bridge dispatch failures into the envelope (buildProxyFailureResponse in the WS path) No — master's src/inline-ws.ts has 0 occurrences
e82ccd7d6f Fix generationBoundaryActive positional drift in #4305 test No — grep returns nothing in master tests/
804252314c Drop internal-only ClientBuildCheck export (unused-exports CI red inherited from master's 4d34abfaf de-export sweep) No — master still exports it in src/agent/client-build-note.ts
0cea4801c2 Drop accidentally-committed scratch file .tmpfailids.txt No

One commit (5aa5833073, off-token comment fix in src/config.ts) IS already in master (line 2153).

Decision still required: which inline-WS-bridge implementation to keep.

  • A (recommended, default): keep master's src/inline-ws.ts implementation; drop the PR's inline-in-src/inline-engine.ts version. The 4 unique small fixes above can be cherry-picked onto a fresh branch if the owner wants them.
  • B: keep the PR's implementation, revert master's 7371b1ee97. Unlikely — master's is more complete (two codecs, Promise<string|undefined> wsOrigin, instanceId param, dedicated test file).
  • C: merge both. Complex, no unique value from the PR's main fix.

No push performed. Stopping per owner policy 2026-11-01 (needs-decision → stop).

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[ework] CI fix verified green ✓

2 similar comments
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[ework] CI fix verified green ✓

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[ework] CI fix verified green ✓

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

(ai: vllm-qwen/qwen3.8-27b)

🔶 需要决策 — no change since last status update (floor 29)

Re-verified: PR head still 44219eca6f, master advanced to 301e1a5459, merge-base unchanged. No owner response to the decision request. Same 10-file conflict, same design decision (which inline-WS-bridge implementation to keep). Recommendation A (keep master's src/inline-ws.ts, drop PR's inline version, cherry-pick the 4 unique small fixes) stands. No push. Stopping.

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[ework] CI fix verified green ✓

2 similar comments
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[ework] CI fix verified green ✓

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[ework] CI fix verified green ✓

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working codex duplicate This issue or pull request already exists needs-decision p2 pi scope/wiring

Projects

None yet

2 participants