Description
(ai: zai/glm-5.3)
这是啥问题(一句话)
代理和十条宿主车道之间没有契约:生命周期没有共享状态机、能力靠猜、降级是一次性闩锁、大小靠估算——同一个缺口在每条车道各自复发一遍,补丁打了一条车道下一条又冒出来。本 issue 统一治理,并且立规矩:先打桩固定行为,再讨论方案,批准后才动工。
流程规矩(所有动工必须遵守)
为了兼容性、避免引入回归,本 issue 管辖的每一项改动都走同一条路:
- 先打桩:对要动的模块先写特征化测试(characterization tests),把现在的行为(包括有问题的行为)原样钉住;覆盖不足的先补测试。桩测试红了不算失败,它就是现状的记录。
- 方案讨论:动工前在 issue 评论区贴「老方案 vs 新方案」对比——老方案=现状怎么做的+历次补丁为什么修不干净;新方案=具体实现(接口、文件、迁移步骤、风险)。讨论通过、owner 批准后才能写实现代码。
- 行为等价优先:纯搬运/收敛类 PR 必须让桩测试全绿(行为不变);要改行为的 PR 必须单独说明改哪条桩、为什么,再经批准。
- 每步独立 PR、可回滚、CI 绿;一个 issue 一个 PR,Closes 挂到本 issue 的子任务。
为什么逐点修不动(打地鼠证据链)
四个失败家族在非 dsh 的 9 条车道全部成簇出现(dsh 只占 29%,是最重的报告者,不是病因):
| 家族 | 全局出现 | 同型 bug 跨车道独立复发 |
|---|---|---|
| F1 生命周期/监督无共享状态机 | 17 处/9 车道 | 端口漂移钉死:#926(opencode,已修)→ #4566(omp)→ #5127(claude);verifyAttachAndRecover 四份逐字拷贝(pi-native.ts:178 / omp-native.ts:271 / opencode-native.ts:311 / dsh-native.ts:771,~90 行×4) |
| F2 能力/身份靠推断 | 18 处 | 冷启动工具丢失:#4134(dsh)→ #4998(pi)→ #5001(claude-code)→ #4641(hermes);exposedTools 全库 0 命中——声明机制不存在 |
| F3 降级一次性闩锁无恢复 | 15 处 | #5032 自证:直发守卫存在但逐车道手工武装(dsh #4904 有、pi #5027 有、omp/opencode 裸奔);readonly 静默降级 #4614/#5229/#4816/#5086 |
| F4 大小靠估算不实测 | 17 处 | 熔断只量部分字段:#5000(只量 text)= #4819(不测图像)= #4315(CJK 扩展区按 1/4 记);入口 5GiB 整段 parse → OOM 向量 #4021 |
现状不是零起点:状态机的 7 个发射点已存在(claimStartingMarker=spawned、armWatchdog/ensureSqliteEngine=booting、announceListening=listening、markBootReady=ready[server.ts:615]、runtime-status 四原因源=degraded、三条 adopt 路径=adopted、finishShutdown/watchdog=exited),NativeInterceptState 已是事实上的生命周期接口,CA/SQLite 自举/存储隔离(#4175)的自愈样板都在。缺的是单源聚合和契约化,不是重写。
六条契约(治理目标)
- C1 生命周期状态机单源:
spawned→booting→listening→ready→degraded(reason)→adopted→exited一份实现;实例注册表加lifecycle字段,/__bili/health用同一枚举,一句话回答「什么模式、为什么、何时重试」。 - C2 能力声明,禁止推断:宿主握手时声明注册的工具与流量归属(Plugin lanes: host declares exposed bili tools per request via x-bili-plugin-exposed-tools (structural fix for #3884/#3600 name-guessing) | 插件车道:宿主按请求声明暴露的 bili 工具(根治 #3884/#3600 认名字脆弱性) #3906 方向重开);内容 hash/env 推断降级为显式声明的兜底。
- C3 降级三必须:可告警、可恢复、有 TTL——禁止一次性闩锁。现存违规:shadow.ts:186
stats.disabled进程内永不重试(→ 改冷却 TTL,照抄 engine-bootstrap 冷却样板)、loggermarkStderrDead永久(→ 有界重探)、DIRECT([Bug][dsh] After one upstream 400, takeover latches to DIRECT for the rest of the host process (attribution throw never recovers) #4183)/readonly(SQLite unified storage degraded to legacy-only (bili v0.1.205, node v24.22.1, win32-x64) #4614 族)/429-hold(429 governor hold is keyed by origin+credential with no model dimension — one model's quota exhaustion freezes the whole lane (healthy models get local 429/424) #5199)无恢复路径。唯一结构性豁免:宿主进程内 attribution 失败走 direct(宿主里的代码换不了自己),契约只要求醒目可见+「重启宿主恢复」指引。 - C4 measure-then-act:入口/出口实测字节,估算值只准做启发不准判死。入口准入早拒(0.1.197: A single 25 MiB request drives the heap to the 4 GB ceiling → process aborts → ~10 s per crash-restart cycle (D | 0.1.197:单个 25 MiB 请求把堆吃到 4 GB 上限 → 进程 abort → 约 10 秒一轮崩溃重启(DSH 双窗口同时 Connection error) #3386 [Bug] Codex Responses WebSocket blocks long sessions at 100 MiB before ACP compression, including small incremental continuations #4804 The invariant judge has no size cap on oversized bodies: performing a full-body JSON.parse on a 5 GiB request is an OOM | 不变量裁判对超大 body 无上限:5GiB 请求上做整 body JSON.parse,是 OOM/事件循环阻塞向量 #4021)、decompress 预检(decompress lacks preflight size check — oversized restore fails at upstream instead of failing early #5013)、熔断/计数字段补全([Bug][dsh][0.1.208] Kill switch / egress fuse only measures message.text: a session with 26,903 messages and only 1.44 M | [Bug][dsh][0.1.208] 判死/egress fuse 只量 message.text:26,903 条消息、core text 仅 1.44 MiB 的会话绕过 fuse 发出 55.2 MiB 请求体,被上游 413 拒收(ModelArts.… #5000 The context can't be compressed, there are too many images displayed. I'm not sure if it's an issue with my upstream. | 上下文无法压缩,显示图片过多,我不知道是不是我上游的问题 #4120 [Bug] defaultCountTokens undercounts Extended CJK characters; supplementary-plane characters fall into the UTF-16 /4 bra | [Bug] defaultCountTokens 漏计扩展汉字,补充平面落入 UTF-16 /4 分支 #4315)、窗口口径唯一(Effective window silently halved: 25% default output headroom + hardcoded 70% escalation nudge, both non-configurable #5230
preflightand[headroom]disagree on the effective window, and preflight folding silently creates no block #5172)。 - C5 流量路由可观测:每条车道能发「流量没经过我」信号(route=miss),不许静默失明([ZCode native] z.ai builtin account (ZAI_BUSINESS_BASE_URL) bypasses the provider store — bili-zcode goes silently blind after the switch | [ZCode native] z.ai 内置账号(ZAI_BUSINESS_BASE_URL)绕过 provider store——切换后 bili-zcode 静默失明 #4692 In oh my pi's native plugin mode, the recap feature does not capture conversation traffic, resulting in conversations re | oh my pi 使用原生插件模式下recap 功能对话流量未被捕获导致对话未被压缩 #4897 Pi + claude-bridge: native sends no model requests to proxy; launcher compress returns 404 #3429)。
- C6 新车道上线 checklist:直发守卫已武装、--lane 参数、工具声明、告警接入、背压安全通道——omp/opencode lanes: oversized history egresses uncompressed when the proxy is down — direct-send window guard still unarmed (#5025 family residual) #5032 的教训产品化,新宿主只写 ~150 行 lane 文件。
分阶段(每阶段都走上面的规矩:打桩→方案对比→批准→动工)
- 阶段 0|打桩:对 native-intercept 状态机、四份 verifyAttachAndRecover、shadow disabled 闩、stderr-dead 闩、注册状态机、尺寸会计、/__bili/health 逐一写特征化测试钉住现状(不改代码)。
- 阶段 1|生命周期单源(先纯搬运):四拷贝合一 → adapter/lifecycle.ts;
lifecycle字段进实例注册表;ready 之前不宣告 compaction active(decision request: dsh declares takeover before the proxy is ready, leaving host compaction off forever — pick the declaration-timing approach | dsh 代理未就绪就宣告接管,宿主压缩永久关闭——宣告时机怎么改 #4905);收编 F1 全家;[PR] fix: dsh lane self-heals after a respawn give-up (#4755) #4773(dsh 自愈)作为部件合入。 - 阶段 2|闩锁治理:shadow→TTL、stderr→有界重探、DIRECT/readonly/429-hold 加恢复路径;冷启动就绪屏障(waitToolsGate 推广,In each new session, the first turn carries no ACP tools: the second turn triggers a full prefix recomputation, and the | 每个新会话第 1 拍没带 ACP 工具:第二拍整前缀重算,前缀缓存每次冷启动断一次 #4134 Pi RPC native package: ACP tools absent on first request to local OpenAI-compatible provider #4998 [Bug][claude] MCP shim gives up on tools/list before a cold claude-lane proxy is listening — per-message hosts (CloudCLI) lose compress tools | 冷启动时 MCP shim 等不到 proxy,CloudCLI 这类每条消息新起 claude.exe 的宿主拿不到压缩工具 #5001 bug(hermes): /acp and plugin tools disappear entirely after cold start — register() blocks beyond the host's 10s load bu | bug(hermes): 冷启动后 /acp 与插件工具整体消失——register() 阻塞超过宿主 10s 加载预算被丢弃 #4641);流终止语义统一(# [Bug] Responses: a read failure after a forwarded terminal event emits contradictory upstream_stream_truncated #4059 [Bug] Stalled upstream before first response byte holds the client silently up to 12 min and burns host retries — first-byte watchdog is warn-only and deduped per origin #5164)。
- 阶段 3|能力声明:manifest 加
exposedTools+ 宿主握手声明(Plugin lanes: host declares exposed bili tools per request via x-bili-plugin-exposed-tools (structural fix for #3884/#3600 name-guessing) | 插件车道:宿主按请求声明暴露的 bili 工具(根治 #3884/#3600 认名字脆弱性) #3906);头拼装收敛;注册状态机合一(Plugin tool registration self-lock: after a failed proxy respawn, re-registration is blocked by its own prior registrations — identity headers lost forever (wire mode) → 413 preflight_compress_failed on large sessions | [Bug] 插件工具注册状态自锁:proxy respawn 失败后重注册被自己挡死,永久失去身份头(wire 模式)→ 大会话 413 preflight_compress_failed #3380 语义参数化)。 - 阶段 4|入口实测:字节准入+4xx 早拒、decompress 预检、熔断/计数补全、窗口口径唯一;收编 F4。
- 阶段 5|通道与收尾:route=miss 信号、MCP 6 通道身份统一声明、checklist 落 CI。
目标形态:src/agent/adapter/{contract,lifecycle,headers,registration,acp-command}.ts 共享层 + 每宿主薄 lane(pi/dsh/opencode/omp,未来 hermes/trae 各 ~150 行)。真实宿主差异不收敛:dsh compaction 站队/APIG 重签/UI 双面、pi subagents、opencode 三代共存。
被收编的 issue(代表,~67 条)
- F1:[Bug] Plugin bootstrap spawns a new instance while the old one still holds the port and drops proxying (goes direct): la | [Bug] 插件 bootstrap 在旧实例仍占端口时新起实例并放弃代理(goes direct):大会话随即以未压缩历史撞上游上限(400 Range of input length / 413) #4125 pi startup hangs at "bili: attaching to running proxy" even when the proxy is healthy (headless runs die at our 900 s supervisor timeout, rc=124) #4129 [Bug][omp lane] lane port moves under live omp hosts, and the host's cached proxy hop survives re-targeting — every Anthropic turn dies (connection refused / SELF_SIGNED_CERT_IN_CHAIN) #4566 [Bug][claude] plugin install pins MCP face to base port 18787; lane drift leaves ACP tools unreachable (same class as #926) #5127 [Bug][claude] MCP shim gives up on tools/list before a cold claude-lane proxy is listening — per-message hosts (CloudCLI) lose compress tools | 冷启动时 MCP shim 等不到 proxy,CloudCLI 这类每条消息新起 claude.exe 的宿主拿不到压缩工具 #5001 bug(hermes): /acp and plugin tools disappear entirely after cold start — register() blocks beyond the host's 10s load bu | bug(hermes): 冷启动后 /acp 与插件工具整体消失——register() 阻塞超过宿主 10s 加载预算被丢弃 #4641 [feat][plugin] hermes native lane always spawns on an ephemeral port → long-lived hosts strand on a dead HTTPS_PROXY (opencode got #1664) #2714 In the ZCode environment, the proxy takes 64 seconds to recover after being terminated by an external signal — recommend | ZCode 环境下 proxy 被外部信号终止后需 64 秒才能恢复——建议将看门狗间隔改为可配置 #4006 Watchdog attach gate: BILI_PARENT_PID is forgeable, so an orphaned proxy can report armed:true with no live owner #4367
bili starthas no --lane flag: manually started instances silently land in the worst attach class without the undocumented BILI_LAUNCHER_LANE #4368 Storage banner falsely warns «second process writing index.db» when same-lane bili instances share the machine-global sessions dir | 同车道多实例共享存储误报损坏告警 #5014 [Bug][pi] Stale native client rejects upgraded proxy; twin-collision recovery sends 2M-token uncompressed history #5072 Host restart re-attaches to the running bili helper instead of restarting it — config edits stay inert until a manual proxy shutdown #4705 Long-lived proxy wedges on local DNS after WSL network/VPN changes — tunnel admission staysunresolvable(502) until process restart #5221 dsh-native never reconnects after respawn gave up (healthy proxy listening) → unattributed over-window body refused locally (422) → session unrecoverable | [dsh-native] respawn 放弃后客户端永不重连(代理已健康监听)→ 未归属超窗 body 被本地 422 拒绝、会话不可恢复 #4755 [dsh] bili dsh web fails to boot: "package billion-context resolves from multiple active Loader sources" (bili-native + bili-compaction-gate rows) #4627 decision request: dsh declares takeover before the proxy is ready, leaving host compaction off forever — pick the declaration-timing approach | dsh 代理未就绪就宣告接管,宿主压缩永久关闭——宣告时机怎么改 #4905 - F2:Plugin lanes: host declares exposed bili tools per request via x-bili-plugin-exposed-tools (structural fix for #3884/#3600 name-guessing) | 插件车道:宿主按请求声明暴露的 bili 工具(根治 #3884/#3600 认名字脆弱性) #3906 Pi RPC native package: ACP tools absent on first request to local OpenAI-compatible provider #4998 DSH 0.2.x PTC: ACP tools are in host scope, but nudge determines reachability via run_code ⇒ tools.compress is not a fun | DSH 0.2.x PTC:ACP 工具在宿主作用域,nudge 却按 run_code 判可达 ⇒ tools.compress is not a function、从未压缩 #4976 [Bug] nudgeModelDecided decide lane is unusable on default-thinking models: empty content at max_tokens=200 (reasoning tax) + hardcoded 15s DECIDE_TIMEOUT_MS vs full-context side-calls (glm-5.3: 0/112 success) #5030 Hermes lane: proxy adds ACP tools to toolless structured-output requests from child processes, which strict backends reject (400) #5073 Pi: tree recovery can override pi-loadout disabled tools #4988 [Bug] 0% cache hit whenever a per-request image-rescale flag toggles one ACP tool mid-session #4789 In each new session, the first turn carries no ACP tools: the second turn triggers a full prefix recomputation, and the | 每个新会话第 1 拍没带 ACP 工具:第二拍整前缀重算,前缀缓存每次冷启动断一次 #4134 No stable conversation identity: 34 real conversations become 166 sessions with 43 distinct titles, 139 of which are raw XML injection text #4776 [ZCode host] MCP shim cannot auto-discover session ID — after CLAUDE_CODE_SESSION_ID expires, acp_status/compress resolv | [ZCode host] MCP shim 无法自动发现会话 id —— CLAUDE_CODE_SESSION_ID 过期后 acp_status/compress 查到冻结旧会话(表现为可压缩范围索引为空) #4661
- F3:[Bug][dsh] After one upstream 400, takeover latches to DIRECT for the rest of the host process (attribution throw never recovers) #4183 pi lane: no-proxy direct send is unguarded — oversized raw history egresses and blows the provider window #5025 omp/opencode lanes: oversized history egresses uncompressed when the proxy is down — direct-send window guard still unarmed (#5025 family residual) #5032 Incremental lane: two minor improvements — dual hosts sharing a session mutually terminate each other with no alert; cac | 增量车道两个次要改进:双宿主共用会话互相打死无告警;cache-marks 只增不减 #4868 plugin pipe: the degraded turn after a continuation retry will inevitably become a fatal in-band stream error — no toggl | plugin pipe:续写重试后的退化回合必然变成致命 in-band stream error —— 无任何开关,且 #2756 的 "bare" 豁免在重试这一趟根本不会执行 #4913 SQLite unified storage degraded to legacy-only (bili v0.1.205, node v24.22.1, win32-x64) #4614 SQLite unified storage degraded to legacy-only (bili v0.1.209, node v22.23.4, win32-x64) #5229 SQLite unified storage degraded to legacy-only (bili v0.1.208, node v24.21.0, win32-x64) #4816 decision request: watchdog heartbeat-branch death needs consecutive confirmation (proxy suicide during busy turns, #4994) #5086 429 governor hold is keyed by origin+credential with no model dimension — one model's quota exhaustion freezes the whole lane (healthy models get local 429/424) #5199 Upstream man-in-the-middle certificate failures caused by DNS poisoning are classified as unknown: no alert, no circuit | DNS 污染导致的上游中间人证书失败被归类为 unknown:无告警、无断路器,且修复提示指向"信任该证书 #4403 [Bug] Mid-session wire/dialect switch leaves a permanent unmatched-id residual that rides the wire unfolded and taxes the prefix cache every turn (v0.1.201) #3849 EMERGENCY truncate latch can store a clip under the
"BLOCKED"sentinel ref, corrupting unrelated tool-call arguments into non-JSON → upstream 400 on every turn #5217 [resilience] Preflight compress/timeout loop on sustained mass fold-coverage loss has no graceful degrade #2438 [Bug][Codex Responses] SSE context overflow bypasses evidence arming, leaving estimate-only preflight probing (0.1.206) #4950 [Bug] jimp is an optionalDependency: missing after global install → outbound image downscaling silently disabled (downsc | [Bug] jimp 是 optionalDependency:全局安装后缺失 → 出口图片降采样静默失效(downscaled=0),WS 会话 idle timeout 反复重连 / jimp optionalDependency missing after… #4819 Codex WS context-only prewarm runs as an ACP turn: folds wiped, all forged summaries re-injected; probe relay skips the upstream proxy #4594 [Bug][pi] Stale native client rejects upgraded proxy; twin-collision recovery sends 2M-token uncompressed history #5072 - F4:0.1.197: A single 25 MiB request drives the heap to the 4 GB ceiling → process aborts → ~10 s per crash-restart cycle (D | 0.1.197:单个 25 MiB 请求把堆吃到 4 GB 上限 → 进程 abort → 约 10 秒一轮崩溃重启(DSH 双窗口同时 Connection error) #3386 [Bug] CJK payloads slip past the egress byte-floor fuse: a 4.1 MiB outbound was forwarded at 1,121,674 tok into a 1,000,000-token window (0.1.206, plugin lane) #4543 [Bug][dsh][0.1.208] Kill switch / egress fuse only measures message.text: a session with 26,903 messages and only 1.44 M | [Bug][dsh][0.1.208] 判死/egress fuse 只量 message.text:26,903 条消息、core text 仅 1.44 MiB 的会话绕过 fuse 发出 55.2 MiB 请求体,被上游 413 拒收(ModelArts.… #5000 [Bug] Codex Responses WebSocket blocks long sessions at 100 MiB before ACP compression, including small incremental continuations #4804 The invariant judge has no size cap on oversized bodies: performing a full-body JSON.parse on a 5 GiB request is an OOM | 不变量裁判对超大 body 无上限:5GiB 请求上做整 body JSON.parse,是 OOM/事件循环阻塞向量 #4021 MySQL storage backend v8 backfill loads the whole table into memory at once and skips dedup | MySQL 存储后端 v8 回填一次性加载全表且不按 msg_id 去重 #4806 decompress lacks preflight size check — oversized restore fails at upstream instead of failing early #5013 The context can't be compressed, there are too many images displayed. I'm not sure if it's an issue with my upstream. | 上下文无法压缩,显示图片过多,我不知道是不是我上游的问题 #4120 [Bug] defaultCountTokens undercounts Extended CJK characters; supplementary-plane characters fall into the UTF-16 /4 bra | [Bug] defaultCountTokens 漏计扩展汉字,补充平面落入 UTF-16 /4 分支 #4315 [bug] Soft nudge fires late: pendingT1 uses the raw chars/4 estimate, but billed input grows 2.2× faster on Claude (summarized thinking) and 1.2→1.7× on Responses (encrypted reasoning) | 软 nudge 偏晚:pendingT1 用未校准的本地估算,计费增长比估算快 1.2–2.2 倍 #4579 Effective window silently halved: 25% default output headroom + hardcoded 70% escalation nudge, both non-configurable #5230
preflightand[headroom]disagree on the effective window, and preflight folding silently creates no block #5172 [Performance] v0.1.208 long sessions exceed 2 GiB memory and spend 14–22 seconds in local processing #4788 [perf][Codex/Responses WS] Peak memory for active long-lived session processes is ~1.26GiB; please confirm whether R3/in | [perf][Codex/Responses WS] 活跃长会话进程内存峰值约 1.26GiB,请确认 R3/增量模式是否覆盖这条路径 #3437 Active long-session memory: share history materialization across lastMessages / transient views / WS checkpoint | 活动长会话内存:历史在 lastMessages/临时视图/WS checkpoint 间的共享物化(设计提案) #3643 codexForgedSummaries grows without bound and is re-injected in full whenever a request lacks the echoed compaction item #4600 - 已修/在途部件全部复用:[PR] fix: wedged proxy self-exits instead of holding its port forever (#4762) #4784(自退出)[PR] fix(launcher): adopt proven-healthy child at spawn timeout instead of killing it (#4994) #5010(收养)[PR] fix(#5012): trust the log file over dead pipes — mute the stderr tee once the file leg proves live #5089(管道静音)[PR] fix: make startup-failure paths self-contained and actionable (#5104) #5157(复用+提示)[PR] fix: Root cause detection for Windows startup EPERM-type issues — self-check on startup and provide remediation command | fix: Windows 启动 EPERM 一类问题的根因检测——node.exe 被 Low 完整性标签污染时启动即自检并给出修复命令 (#5154) #5159(完整性自检)[PR] fix: dsh lane self-heals after a respawn give-up (#4755) #4773(自愈,待合)
验收
/__bili/health能一句话回答「现在什么模式、为什么、何时重试」- 桩测试成为永久回归网:四家族相关模块的行为改动必须显式过桩
- 四家族新增 issue 速率归零趋势(不是存量清零,是复发停止)
完整调研底稿(宿主接线全景 33 文件、全仓失败路径穷举、404 条 open issue 四家族交叉验证)在本地,按需贴出任何一节的证据。
Activity
[-][Design] 宿主契约 v2:先打桩固定行为,再统一生命周期/能力声明/降级恢复/入口实测(讨论通过后才动工)| [Design] Host contract v2: pin behavior with tests first, then unify lifecycle / capability declaration / latch recovery / size admission (discuss before implement)[/-][+][Design] Host contract v2: pin behavior with stubs first, then unify lifecycle / capability declaration / degradation re | [Design] 宿主契约 v2:先打桩固定行为,再统一生命周期/能力声明/降级恢复/入口实测(讨论通过后才动工)| [Design] Host contract v2: pin behavior with tests first, then unify lif…[/+]ranxianglei commentedon Oct 30, 2026
(ai: zai/glm-5.3)
阶段 1 方案讨论:四车道启动生命周期抽取(动工前审批稿)
按 #5241 规矩,实现之前先对比老/新方案,请 owner 批准后才动工。阶段 0 桩(#5242)已把这四份代码的行为钉死,是本方案的等价性验收网。
老方案:同一份逻辑手抄四遍
四车道各有一份几乎相同的
verifyAttachAndRecover(启动时:探测目标代理 → 健康就 attach,死了就 fallback 拉自己的):src/agent/pi-native.ts:178src/agent/omp-native.ts:271src/agent/opencode-native.ts:311src/agent/dsh-native.ts:771同型 bug 跨车道独立复发(端口钉死 #926→#4566→#5127、冷启动工具 #4134→#4998→#5001→#4641)就是这份手抄的直接代价:修一处,另外三处照旧带病。
打桩过程还挖出一个没写进任何文档的隐含契约:四份代码都假设"我是这个进程里唯一的 native 车道"——四条车道抢同一个
process.env.BILLION_CONTEXT_PROXY、同一个全局 fetch 拦截槽。生产里每车道一个宿主进程所以碰巧没事;但把两条车道塞进一个进程(测试已实测)会互相覆盖地址、假 spawn、顶掉拦截。阶段 1 合并共享代码时这个契约必须显式化,否则未来一个进程装两条车道就是生产事故。新方案:一个共享适配器 + 每车道一份配置(纯搬运)
新文件
src/agent/native-attach.ts,导出参数化的单份实现:四条车道的
*-native.ts变成:构造自己的 spec + 调共享实现。规则:纯搬运,行为一字节不变——包括保留现有的不一致(桩就是干这个的)。另外共享模块加一条显式互斥:同一进程 arm 第二条车道直接报错,把上面那个隐含契约变成代码里看得见的约定(报错信息用大白话,说清"一个进程只能跑一条车道")。明确不做的:
rotateOlderResident开关后面,统一成哪种另开专项讨论,不混进搬运 PR;_setSpawnForTest等,桩和既有测试依赖);切片:四个 PR,每个独立可合可回滚
native-attach.ts+ 迁移 pi(基线最简单、测试最全:pi-native.test.ts 19 测 + 桩矩阵);其余三车道暂不迁移,新旧并存验证一个周期;验收标准(每个 PR)
风险与回滚
请 owner 裁决
批 A 我就从 PR-1a 开工。
ranxianglei commentedon Oct 30, 2026
(ai: zai/glm-5.3)
阶段 1(生命周期单源化)四刀全部开完,按批准的方案 A(纯搬运)+ 一处诚实修正:
src/agent/native-attach.ts(NativeLaneSpec 参数化)+ 新增 armNativeLane 车道互斥守卫每一刀的等价性验收都靠 #5242 的桩矩阵一行未改全绿背书;交叉车道污染(双车道同进程互相覆盖 BILLION_CONTEXT_PROXY/fetch 拦截槽)从隐含假设变成显式契约,issue3304 的有意双车道共驾测试显式豁免。
合并顺序:#5242 → #5244 → #5246 → #5247 → #5248(全部叠栈,前者合并后 GitHub 自动 retarget)。
下一阶段(等这批合完再启动,按规矩先出方案讨论):阶段 2 闩锁治理——shadow 三振闩(storage/shadow.ts,disabled 后进程内永不复位)与 stderr-dead 闩(logger.ts)的「可告警、可恢复、有 TTL」化,现状已被 #5242 桩冻结。
ranxianglei commentedon Oct 30, 2026
(ai: vllm-qwen/qwen3.8-27b)
查重:不重复——本条是独立的宿主契约治理伞,全仓无同题 issue(按 lifecycle/状态机/车道统一/verifyAttachAndRecover 组合检索,0 命中)。
标签:
scope/wiring+p2(跨车道问题按规则不打客户端标签;这是治理/重构 tracker 而非缺陷报告,不打 bug;p2 = 聚合多条真实功能债务、各有绕行、正在系统性收编,非单点不可用)。收到阶段 1 进度报告。背书前我先按规矩核了本地仓库(master @
5594c1315,Merge #5054),结论:报告里的产物目前一个都不在主树里——src/agent/native-attach.ts(共享模块)不存在;armNativeLane/NativeLaneSpec符号在src/+tests/0 命中;verifyAttachAndRecover仍原样挂在pi-native.ts:178/omp-native.ts:271/opencode-native.ts:311/dsh-native.ts:771,未迁移;这与「四个未合并的叠栈 PR」自洽(PR 还没进 master),所以我不据此否定报告;但我这边拿不到这些 PR 的 head 与 CI 状态,无法确认它们真实存在且绿,所以在核到之前我不会把「阶段 1 已完成/已合」当既成事实转述。
有一个必须对齐的硬矛盾:表里写的是
PR-1a | pi | #5244,而 #5244 就是本 issue 本身——GitHub 上 issue 与 PR 共用同一编号空间,不可能同时存在两个 5244。请一并发#5242(桩矩阵)、#5246/#5247/#5248的准确编号或链接。拿到正确链接后我会逐个核对 head diff + CI(重点看 #5242 桩矩阵是否真的一行未改全绿、四处迁移是否纯搬运行为等价),再按八问出 review 结论、确认合并顺序。若其中某个其实还没开,也直接说,我按本 issue 流程从 Phase 0 桩开始接手。
按流程,阶段 2(闩锁治理)继续 gate 在这批合并完成 + 先出「老 vs 新」方案讨论之后,不抢跑。
docs: name the dsh guard's arm point in the split comment (review fol…
ranxianglei commentedon Oct 30, 2026
(ai: vllm-qwen/qwen3.8-27b)
补充核验(接上一条):我把分支从上游按名字捞出来了——这批工作真实存在。我上一条说「无法确认存在」是因为本地
origin指向的是滞后的本地镜像、没同步到这些未合并的头,不是工作不存在。上游实有:2026-10-31_contract-v2-stake-tests(= 报告里的桩矩阵)2026-10-30_native-attach-{pi,omp,opencode,dsh}(= 四刀)diff --stat(vs master)逐条对上了报告描述:
tests/contract-v2-stake-*,517 行新增,零src/生产改动 —— 符合阶段 0「打桩不改代码」。四文件正好覆盖 health(/__bili/health)、latches(shadow disabled + stderr-dead)、verify-attach(四拷贝)、lane-probe(route=miss)。src/agent/native-attach.ts(随栈 141→148→155 行),对应*-native.ts各自缩水;armNativeLane("dsh")守卫」一致;issue3304-incremental-direct-send.test.ts(+7)= 双车道共驾显式豁免。实质内容我基本认账。唯一硬伤仍是编号列:
PR-1a | pi | #5244,可 #5244 就是本 issue,issue 与 PR 共用编号空间不可能撞号。请给这五个 PR 的准确号或链接。合入前我还会补齐三步(不跳):① 确认五支都真开成了 PR(分支在 ≠ PR 在);② 逐个 head 拉 CI(走镜像缓存,拿到 PR 号后查);③ 每刀出八问 review —— 重点核迁移行为等价(opencode
spec.tag逐字节日志前缀、ompclearOrigin/publishOrigin钩子是否真保住原语义)+ 桩矩阵是否一行未改全绿。给我正确 PR 号(或授权我按分支名继续),我就把这三步走完再给合并判定。
ranxianglei commentedon Oct 30, 2026
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b)
收工小结(接前两条更新):阶段 1 那批已核实真实存在且结构自洽 —— 上游五支分支:
2026-10-31_contract-v2-stake-tests(桩矩阵)+2026-10-30_native-attach-{pi,omp,opencode,dsh}(四刀)。diff --stat 逐条对上报告:桩矩阵纯测试、零src/改动;pi/omp/opencode 真迁入共享native-attach.ts;dsh 按「诚实修正」只加armNativeLane("dsh")守卫、不迁移;叠栈与issue3304双车道豁免均在。我这边已完成:查重(独立治理伞,无同题)、打标签(
scope/wiring+p2)、逐支结构核验。卡在你这里的一项:五个 PR 的准确号或链接 —— 报告编号列把 pi 那格写成
#5244,而 #5244 就是本 issue(issue 与 PR 共用编号空间,不可能撞号),所以我取不到权威编号。给我正确号(或授权我按分支名推进),我就补齐合入前三步再出合并判定:① 确认五支都开成了 PR;② 逐个 head 拉 CI(走镜像缓存);③ 每刀八问 review,重点核迁移行为等价(opencodespec.tag日志前缀逐字节、ompclearOrigin/publishOrigin钩子)+ 桩矩阵一行未改全绿。test: pin landed never-give-up shadow contract in #5241 phase-0 stake…
agent: shared attach/recovery lifecycle — migrate the pi lane (#5241 …
agent: shared attach/recovery lifecycle — migrate the omp lane (#5241 …
agent: shared attach/recovery lifecycle — migrate the opencode lane (#…
agent: one-lane guard for dsh; thick lifecycle stays local, documented (
docs: name the dsh guard's arm point in the split comment (review fol…
Merge origin/master into 2026-10-31_contract-v2-stake-tests