Skip to content

lane 统一决策点收尾:四处 B 类名字旁路迁入 + nudgeOn 单点(#3482) - #3490

Merged
ranxianglei merged 3 commits into
masterfrom
2026-10-17_lane-decisions-b
Oct 17, 2026
Merged

ranxianglei merged 3 commits into
masterfrom
2026-10-17_lane-decisions-b

Conversation

@ranxianglei

Copy link
Copy Markdown
Owner

Closes #3482(#3417 收尾)。纯搬移,零 wire 字节变更。

Step 2:B 类站点迁移(四站全清)

站点 改法
①dsh billing block(#2189) prepare-anthropic 提取门控改为 laneDecisions.billingBlockWanted = profile 声明(wantsBillingBlock,dsh)或 wire 观察到块(billingBlockObserved,证据优先,与 toolsReachable 同形状)。wantsBillingBlock 死属性落位为真实消费者。
②omp Cowork 旁路 coworkTransportPossible 进注册表(该传输是否可能);逐请求真相仍是环境观察 ompCoworkTransportBypassesFetch(provider/api/代理 env)。
③omp 身份戳通道 stampPromptCacheKey 的 agent !== "omp" 门 → hostProfileFor(agent).stampsBodyPromptCacheKey;pi 的头戳通道差异写进注册表注释。
④codex instructions 指纹 WIRE_CLIENTS 注册表(codex=#150 任务 id 复用、claude-responses=#970 子代理共享会话 id,均 instructionsFingerprintKeyed: true);instructionsFingerprintApplies 只做信号观察,头名字面量只活在注册表。

issue 表格前提修正:三处 ledger floor 调用点(prepare-openai:364 / responses:501 / google:305)不迁——dshLedgerFloorTokens 本无 lane 名查,metadata 键由 #1729 守卫写入,而该守卫故意 identity-blind(#2193:marker-decisive,任何车道发 dsh 形状的 compaction 调用都拒)。按 profile 门控会回归该设计并引入 corner case 的 wire delta。

Step 2.5:nudgeOn 单点

四份手抄 willInjectNudge 合取(就是 #3293 漂移的地方)收敛为 nudgeOn() 九布尔入参纯函数。三处差异全部显式化:

  1. compactionTrigger——仅 responses(hasCompactionTrigger(parsed.input)),其余三线无此概念传 false;
  2. codex-intercept 健康窗——调用方预算好 growthFoldingArmed(loopConfig, modelContextLimit × CODEX_COMPACT_HEALTH_RATIO),gate 只见布尔;
  3. anthropic 曾缺 injectTool 合取(开了 absorb 之后,插件模式会话被指示调用一个永远不会出现的 absorb 工具(与 #3177 同症状家族,机制不同) #3293 漂移)已由 Lane decisions: single resolver for the four wire adapters — observed tool reachability fixes #3401 (#3417) #3427 修;openai/google 的独立 shouldInject 合取被 compressSurfaceOn(≡ shouldInject && reach)吸收,纯冗余消除。

等价性钉死:tests/lane-decisions-b-class.test.ts 1024 点布尔立方 × 四份旧公式逐字对照(旧公式从迁移前源码转录);三个有意差异各有独立钉测。

结构守卫扩展

  • B 类站点禁裸 lane 名门控(pi.ts 戳函数大括号平衡切片、session-id 指纹函数禁头名字面量);
  • WIRE_CLIENTS 每条目必须有 matches()(防复制粘贴腐烂)。

验证

@github-actions

github-actions Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

📦 Built Package Artifact

Branch: 2026-10-17_lane-decisions-b (aa56257)

Option A — Install this exact build (recommended)

npm install -g billion-context@0.0.4144-pr.3490.30ae08e

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-pr3490.tgz
npm install -g package

Install instructions are refreshed on each push.

@ranxianglei
ranxianglei force-pushed the 2026-10-17_lane-decisions-b branch from c5e513a to d0dd6d7 Compare October 17, 2026 05:41
ranxianglei and others added 2 commits October 17, 2026 14:51
…nudgeOn gate (#3482)

Step 2 (B-class sites, #3417 follow-up):
- omp body-pck stamp channel: hostProfileFor(agent).stampsBodyPromptCacheKey
  (site 3); Cowork-transport possibility is registry property
  coworkTransportPossible, per-request truth stays environmental (site 2).
- codex/claude-responses instructions fingerprint: WIRE_CLIENTS registry with
  instructionsFingerprintKeyed; session-id.ts observes, never decides (site 4).
- billing block (#2189) extraction gated by laneDecisions.billingBlockWanted
  (profile-declared OR wire-observed — evidence over defaults); wantsBillingBlock
  now has a real consumer (site 1).
- ledger floor call sites unchanged: dshLedgerFloorTokens carries no lane-name
  check (#1729 guard is deliberately identity-blind, #2193).

Step 2.5 (nudgeOn single point):
- four hand-copied willInjectNudge conjunctions -> nudgeOn() nine-input pure
  function; responses' deliberate differences (compaction-trigger exemption,
  codex-intercept health window) are explicit inputs; openai/google's redundant
  shouldInject conjunct is subsumed by compressSurfaceOn.
- 1024-point boolean cube + verbatim legacy formulas per lane pin equivalence.

Structural guard extended: B-class sites carry no raw lane-name gates; every
WIRE_CLIENTS entry needs a matches().

Zero wire byte changes (pure migration).
The agent-side consumer (src/agent/pi.ts) imported hostProfileFor from
server/lane-decisions, whose preflight import drags acp-kernel and proxy
server modules into dist/agent/pi.js / omp.js client-process bundles
(measured: both doubled, ~1.33 MB -> ~2.79 MB). Move layer-1 HostProfile
registry (table + resolver + ANONYMOUS) into src/host-profiles.ts with
zero imports; lane-decisions re-imports/re-exports it; pi.ts imports the
leaf directly. Structural guard pins host-profiles.ts import-free.

Bundle sizes restored: pi.js 1330878 / omp.js 1330742 (master baseline
1329672 / 1329536; delta now only the ~1 KB leaf table).
@ranxianglei
ranxianglei force-pushed the 2026-10-17_lane-decisions-b branch from 7e37ab1 to 48ecfce Compare October 17, 2026 06:56
…se flakes

Windows runner flake: listen(0) can land in an OS-reserved port range and
emit error (EACCES/EADDRINUSE) instead of listening; events.once(server,
"listening") rejects on error, so a failed listen strands the test promise
("Promise resolution is still pending but the event loop has already
resolved") and cancels siblings. Retry ephemeral-port listens, destroy
keep-alive sockets in teardown (closeAllConnections), and bound every test
with a 60s timeout so any residual hang surfaces with a stack.
@ranxianglei

Copy link
Copy Markdown
Owner Author

ai: zhipuai-lb/glm-5.3

逐行审完,结论:可合(等 test 腿转绿)。四处 B 类迁移我对照 master 逐个验证了等价性,没有发现行为变化。

等价性核验(对照 origin/master):

  1. nudgeOn 收敛:responses 的旧式(master:271 nudgeEligible 含 !isCompactionTrigger + codex-intercept 健康窗)被 nudgeOn 的两个显式入参精确复刻;anthropic/openai/google 丢掉的独立 shouldInject 合取本就被 compressSurfaceOn(= shouldInject && reachable)蕴含。1024 点布尔立方 + 三条旧公式逐位对照把这一点钉死了,连 开了 absorb 之后,插件模式会话被指示调用一个永远不会出现的 absorb 工具(与 #3177 同症状家族,机制不同) #3293 那次 drift(anthropic 丢 injectTool)的回归形状也会在立方上炸——这个测试设计好。
  2. billing 块门控:clientSystem = parsed.system(master:170 同一对象),billingBlockObserved 观察的就是同一份内容 → 块在=提取(旧行为),块不在=旧提取也返回 undefined、新直接跳过,dsh 声明=照提。逐分支等价。
  3. site 3/4(pi.ts 身份戳 + instructions 指纹):agent !== "omp" → !profile.stampsBodyPromptCacheKey 逐字反转;instructionsFingerprintApplies 的观察→注册表拆分保留了空白值不算信号、case-sensitive UA 语义(经 isCodexClient 复用),WIRE_CLIENTS 条目与旧字面量一一对应。
  4. bundle 回归修复:首版把 preflight→kernel 拖进 dist/agent 包翻倍的问题,用 import-free 叶子模块 + 结构守卫(host-profiles.ts 禁 import)钉住,处理干净。

两个非阻塞 nit:

CI:除 test (ubuntu, 24, 1) 还在跑,其余全绿,MERGEABLE。留给人类合。

@ranxianglei
ranxianglei merged commit 494571f into master Oct 17, 2026
43 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

📦 Merged Build Published

This merge to master was published as 0.0.527-master.494571f (rolling master tag).

npm install -g billion-context@0.0.527-master.494571f  # this exact build
npm install -g billion-context@master  # always the newest merged build

npm view billion-context@master prints the current version at any time.

@github-actions github-actions Bot mentioned this pull request Oct 17, 2026
ranxianglei pushed a commit that referenced this pull request Oct 17, 2026
@github-actions github-actions Bot mentioned this pull request Oct 19, 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.

lane 统一决策点收尾:还剩四处按客户端名字自算的旁路要搬进来(#3417 待做)

1 participant