Repository navigation
[PR] fix(zcode): signal the z.ai built-in account that bypasses native routing (#4692) - #4721
ranxianglei wants to merge 11 commits into
Conversation
…ting (#4692) The z.ai built-in account connects through ZAI_BUSINESS_BASE_URL, an env var in the ZCode main process that never lands in the provider store — so the JSON surgery has no target for it and its model traffic runs direct/uncompressed with no signal at all (#1896 covered only the empty-store shape). Add a read-only detector plus a loud one-line report, wired into bootstrapZcodeNative (covers both the degraded and active outcomes) and the SessionStart hook. Pure observability: never writes config, never touches wire or thresholds. Document the stance in CLIENTS.md en/zh: the surface cannot be routed natively (a child cannot rewrite the parent's env — same wall as codex #1660/#403); cert-MITM is the alternative; note the second layer (#661 405 on zai-series model traffic, #4593/#4610). Closes #4692
📦 Built Package ArtifactBranch: Latest build — install this exact versionnpm install -g billion-context@0.0.9428-pr.4721.7f4f5d4This exact version is immutable and reproducible. The rolling Recent builds (commit → version)
Download artifact
tar xzf billion-context-pr4721.tgz
npm install -g packageInstall instructions are refreshed on each push. |
(ai: vllm-qwen/qwen3.8-27b) 查重: 不重复。open+closed 中触碰该表面( 标签: bug, zcode, scope/wiring, p2(内置账号表面整体丢压缩、有 cert-MITM 绕行;非数据丢失/缓存泄露类,不升 p1)。 审核进行中。方向判定:正确——该表面无法原生路由(子进程不能改写父进程 env,与 codex #1660/#403 同一堵墙),正确处置是响亮信号 + 文档,而不是试图路由。已发现两个小问题,将按「小问题直接修」在 PR 分支上以独立标注 commit 修掉:
本地定向验证(typecheck + zcode 套件)与 CI 结果出来后给最终八问结论。 |
…t-in-account detector (#4692) The detector's inline loopback list duplicated isLoopbackHttpUrl from json-edit.ts with drifted semantics (missed 0.0.0.0, looser /^127\./). Export the helper and call it — one predicate for both surfaces.
…th (#4692) The hook is an independent entry point from the authoritative MCP child; the #4692 signal wiring added to bootstrap-hook.ts had no test. Spawn the real hook entry: loud line present when the account var is set (attach to a dead port -> fail-open before any store write), absent under the BILI_NATIVE_ZCODE=0 kill-switch.
…ate) The interface has no consumer outside src/zcode/native.ts (the two functions are the surface; tests call them, not the type). The exported form tripped the unused-exports guard, which fail-fast-skips the whole test matrix (#2637 tiering) — red from the original head.
(ai: vllm-qwen/qwen3.8-27b) 最终审核结论(结构化八问)
行为变更披露(旧→新+原因):内置账号激活时,会话开始 bili 原零日志 → 现打一行 验证证据:typecheck clean;定向测试全绿(zcode-native 39/39、hook-graceful-exit 含新增 2 例、zcode-json-edit/mcp 全套 60/60);unused-exports 本地门禁 clean。CI:head 判定:代码层面可合(merge 由人操作)。注意两点:分支现比 master 多一个 ci-fixes 哨兵 commit(政策要求的收敛,ci-fixes 落 master 后自动从 diff 消失);最终以 |
…lp-merge sweep)
…lp-merge sweep)
…lp-merge sweep)
…lp-merge sweep)
# Conflicts: # CLIENTS.md # CLIENTS.zh-CN.md
[bot] (ai: vllm-qwen/qwen3.8-27b) 上游 PR 冲突已解决 —— 已把 结构化八问:
验证:typecheck PASS(exit 0);zcode 定向套件 60/60 绿( |
[ework] auto-fix stalled: test (windows-latest, 22, 2) — stopping for human review |
1 similar comment
[ework] auto-fix stalled: test (windows-latest, 22, 2) — stopping for human review |
The z.ai built-in account connects through
ZAI_BUSINESS_BASE_URL, an env var that lives in the ZCode main process and never lands in the provider store. Native routing rewrites only that store, so it has no target for this surface — its model traffic runs direct/uncompressed, and there was no signal at all when a session went blind on it (#1896 covered only the empty-store shape). Before the account form was identified, this was mis-diagnosed as "integration missing / hook not wired".Change
src/zcode/native.ts: read-onlydetectZcodeBuiltinAccount(env)(absent / non-http(s) //bili/-wrapped / loopback →undefined; a public URL →{baseUrl, host}; never throws) plusreportZcodeBuiltinAccount(account, log)(one loud line naming the surface, why native routing cannot see it, and the cert-MITM exit). Wired intobootstrapZcodeNativeafter the kill-switch opt-out so it fires for both the degraded and the active outcome.src/zcode/bootstrap-hook.ts: the SessionStart hook is an independent entry point from the authoritative MCP child, so it reports the same signal (stderr, like the hook's other diagnostics).CLIENTS.md/CLIENTS.zh-CN.md: document the stance — the surface cannot be routed natively (a child cannot rewrite the parent's env, the same wall as codex [Design] 定死端口 lane(claude 48787 / zcode 48789)端口被占时的 0 配置解法 #1660/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); cert-MITM is the alternative (confirm on your build that the built-in account rides the GUI proxy setting); and the second layer (billion-context ACP kernel 改写 body 导致 ZCode (zcode.z.ai) 405/3012 #661 405 on zai-series model traffic → working-but-uncompressed, zcode risk control issue | zcode风控问题 #4593/[PR] docs(zcode): clarify the zai-vs-bigmodel compression dead-end in CLIENTS Known limitations #4610). Placed after "Routing scope", deliberately outside the "Known limitations" block [PR] docs(zcode): clarify the zai-vs-bigmodel compression dead-end in CLIENTS Known limitations #4610 edits, to avoid a merge conflict.tests/zcode-native.test.ts: detector truth-table, report content, and bootstrap integration (blind case, stays-loud-when-routed, opt-out negative).Behavior change
Observability only. Old → new: when the built-in account is active, bili logged nothing → now logs one line at session start (
[bili-zcode] z.ai built-in account detected … BYPASSES bili … cert-MITM …). No routing, wire, threshold, default, or persistence change; this path never writes the store.Config surface
None.
ZAI_BUSINESS_BASE_URLis ZCode's own variable — we only read it. No newBILI_*, env var, or config field.Verification
Rebased onto current master (
ac844facd); the three code/test files were unchanged upstream, so the rebase is clean. Local (targeted): typecheck clean; zcode suite 66/66. Full regression → CI.Closes #4692