Skip to content

[PR] fix(omp): identity register is NOT carriage evidence for compaction ownership - #7076

Open
ranxianglei wants to merge 2 commits into
masterfrom
wt-7061-ework-daemon
Open

ranxianglei wants to merge 2 commits into
masterfrom
wt-7061-ework-daemon

Conversation

@ranxianglei

Copy link
Copy Markdown
Owner

Summary

Fixes the omp-lane ownership evidence hole reported in #7060: the ownsCompaction function used state.identityAt === sid as local evidence to claim compaction ownership directly, but the identity registration only populates registeredIds — it does NOT create a tracked session. So the plugin could cancel native compaction for a conversation the proxy never tracked, leading to "no fold + no fallback" overflow.

This is the #1383 evidence gate hole on the identity-stamp path: the gate was designed to prevent #1382 (cancelling compaction for a conversation the proxy doesn't carry), but the identity-stamp path bypassed the carriage check.

Fix

Remove the omp local-evidence short-circuit so the status probe always runs for omp. The probe (GET /__bili/plugin/status) is the authoritative carriage check — if the proxy reports the conversation unknown, the plugin does NOT claim ownership and native compaction proceeds.

This restores the documented design intent ("carriage evidence still decides", pi.ts:1010) and the safety principle ("a wrong cancel overflows the session", pi.ts:1016).

Behavior change

Old: omp's ownsCompaction returned true (claim ownership) when state.identityAt === sid, without probing the proxy.
New: omp's ownsCompaction always probes the proxy (fetchStatus). If the proxy reports the conversation unknown, the plugin does NOT claim ownership and native compaction proceeds.

Impact: omp sessions where the identity register succeeded but the proxy does NOT track the conversation will now let native compaction proceed (instead of cancelling it). This is the desired behavior — it prevents the "no fold + no fallback" overflow.

Safe fallback: if the proxy is temporarily down/hung, the probe fails → no evidence → native compaction proceeds (documented safe behavior, pi.ts:1014-1016).

Regression test

Updated test (H) in tests/plugin-agent.test.ts to assert the correct behavior (identity-registered session is NOT carried by construction — proxy reports unknown → native compaction proceeds).

Closes #7060

@ranxianglei ranxianglei added bug Something isn't working omp p1 scope/wiring labels Nov 17, 2026
@github-actions

github-actions Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

📦 Built Package Artifact

Branch: wt-7061-ework-daemon (3e7bb28)

Latest build — install this exact version

npm install -g billion-context@0.0.10668-pr.7076.f037fca

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
3e7bb28 billion-context@0.0.10668-pr.7076.f037fca build
48d2ca0 billion-context@0.0.10661-pr.7076.a73e805 build
92c5c6d billion-context@0.0.10659-pr.7076.2962055 build

Download artifact

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

Install instructions are refreshed on each push.

…wnership (#7060)

The omp lane's ownsCompaction used state.identityAt === sid as local
evidence to claim compaction ownership directly, but the identity
registration only populates registeredIds — it does NOT create a tracked
session. So the plugin could cancel native compaction for a conversation
the proxy never tracked, leading to 'no fold + no fallback' overflow.

This is the #1383 evidence gate hole on the identity-stamp path: the
gate was designed to prevent #1382 (cancelling compaction for a
conversation the proxy doesn't carry), but the identity-stamp path
bypassed the carriage check.

Fix: remove the omp local-evidence short-circuit so the status probe
always runs for omp. The probe (GET /__bili/plugin/status) is the
authoritative carriage check — if the proxy reports the conversation
unknown, the plugin does NOT claim ownership and native compaction
proceeds.

This restores the documented design intent ('carriage evidence still
decides', pi.ts:1010) and the safety principle ('a wrong cancel
overflows the session', pi.ts:1016).

Regression test: updated test (H) in tests/plugin-agent.test.ts to
assert the correct behavior (identity-registered session is NOT carried
by construction — proxy reports unknown → native compaction proceeds).
@ranxianglei ranxianglei changed the title fix(omp): identity register is NOT carriage evidence for compaction ownership [PR] fix(omp): identity register is NOT carriage evidence for compaction ownership Nov 17, 2026
…7060)

The #7076 probe-only fix still let ownsCompaction claim ownership on the
status endpoint's no-session 200s: pre-first-request (runtime-info
registered, no tracked session yet) and chain-advisory (content verdict
only) both answer 200 with sessionId: null. In the exact #7060 bypass
shape — proxy up, identity registered, runtime-info reported, but the
conversation never tracked — the probe returned 200, the plugin claimed
ownership, cancelled native compaction, and the session overflowed with
no fold and no fallback.

Carriage is a LIVE tracked session: require a non-null session id from the
probe. A 200 without one is not carriage; native compaction proceeds.

Test (H) now reproduces the real #7060 shape (200 pre-first-request,
sessionId null → no claim) instead of the 404 "unknown" shape; the fake
proxy status endpoint returns realistic full-session (sessionId set) and
pre-first-request (sessionId null) responses.
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

查重: 不重复 —— 本 PR 是 #7060 的修复(方向:证据门,非 #2113 watchdog);检索 open issue/PR 无其他针对同一 omp 压缩所有权漏洞的条目(#6351 是 pi 车道折叠时序、#6803 是 omp 直发 prompt_cache_key,机制均不同)。

审核结论

方向正确,但 PR 未闭合 #7060 的真实绕过形态 —— 已当场补上(additive commit 3e7bb28f74 推到 PR 分支)。

  1. 方向关(①):PR 走「证据门」路线(去掉 omp 的 identity-stamp 本地短路、强制走 status 探针),这是对的。[omp lane] session_before_compact veto has no takeover watchdog in 0.1.215: ownership claimed via identity stamp, no fold ever lands, native compaction never released → context overflowed to 500366/500000 #7060 提案 fix: keep system prompt byte-stable for prefix cache #1(把 fix(#2110): pi/omp compaction takeover watchdog — release native compaction when no proxy fold lands #2113 的 takeover watchdog 移植到 omp 车道)已被 owner 在 [pi plugin] session_before_compact 无条件接管后无降级路径:nudge 双闸门饿死 → Auto-compaction cancelled 反复出现,上下文涨到有效窗口 348% #2110 明确否决(2026-10-06,PR fix(#2110): pi/omp compaction takeover watchdog — release native compaction when no proxy fold lands #2113 未合并关闭):release-back watchdog 会把 proxy 侧折叠失败(nudge 饥饿 / fold 回滚 / preflight 超时)伪装成静默降级——「348% 是警报;换成消音器会让根因继续隐藏」。所以 PR 不含 watchdog 是正确的,我不要求它。

  2. 回归关(②)—— 发现残留漏洞(同机制):PR 把 omp 改成「always probe」,但探针判据是 fetchStatus(...) !== undefined,而 status 端点对未跟踪的会话也回 200:

    • pre-first-request(runtime-info 已上报、尚无 tracked session)→ 200 sessionId: null
    • chain-advisory(仅内容裁决)→ 200 sessionId: null

    在 [omp lane] session_before_compact veto has no takeover watchdog in 0.1.215: ownership claimed via identity stamp, no fold ever lands, native compaction never released → context overflowed to 500366/500000 #7060 的精确绕过形态里(proxy 在线、identity 已注册、runtime-info 已上报、但会话从未被跟踪),探针回 200 → fetchStatus 返回对象 → ownsCompaction 仍返回 true → 取消原生压缩 → 无 fold 无 fallback → 溢出。PR 的 probe-only 修法在这个子场景下没有闭合报告的失败。

    已当场修(commit 3e7bb28f74):carriage 证据 = 活的 tracked session,即探针必须返回非空 sessionId。ownsCompaction 改为 status !== undefined && typeof status.sessionId === "string" && status.sessionId.length > 0。无 session 的 200 不再是证据,原生压缩照常进行。测试 (H) 改为复现真实 [omp lane] session_before_compact veto has no takeover watchdog in 0.1.215: ownership claimed via identity stamp, no fold ever lands, native compaction never released → context overflowed to 500366/500000 #7060 形态(200 pre-first-request、sessionId null → 不认领),fake proxy 的 status 端点改为返回真实的 full-session(sessionId 有值)与 pre-first-request(sessionId null)两种响应。

  3. 行为变更披露(旧 → 新):

  4. proxy 侧折叠可靠性 = 另一条 owner 方向,不在本 PR:[pi plugin] session_before_compact 无条件接管后无降级路径:nudge 双闸门饿死 → Auto-compaction cancelled 反复出现,上下文涨到有效窗口 348% #2110 的结论是「takeover 安全必须来自让 proxy 折叠可靠」。即「carried 但 fold 从未落地」(nudge 饥饿 / fold 回滚 / preflight 超时)是 proxy 侧可靠性问题,属 owner 另行安排的方向,本 PR 不处理也不应处理——证据门只负责「别为 proxy 不 carry 的会话取消压缩」。

八问

  1. 是什么问题:omp 车道把 identity 注册(只填 registeredIds、不建 tracked session)当压缩所有权证据,会为 proxy 从未 carry 的会话取消原生压缩 → 无 fold 无 fallback → 上下文溢出([omp lane] session_before_compact veto has no takeover watchdog in 0.1.215: ownership claimed via identity stamp, no fold ever lands, native compaction never released → context overflowed to 500366/500000 #7060)。
  2. 什么原因导致的:所有权证据门(Pi plugin cancels Pi's auto-compaction for conversations the proxy never sees (breaks pi-claude-bridge) #1382/fix: cancel pi/omp auto-compaction only on evidence the proxy carries the conversation (#1382) #1383)本应要求「carriage 证据」,但 identity-stamp 路径绕过了 carriage 检查;PR 改成强制探针后,探针判据(!== undefined)又把「无 session 的 200」误判成 carriage。两层都是把「proxy 知道这个 id」误当成「proxy 在 carry 这个会话」。
  3. 影响范围与严重程度:omp 车道、proxy 在线但会话未被跟踪的场景(注册 / runtime-info 成功、流量从未建 tracked session)。严重——完全无法压缩,上下文涨到溢出(报告实例 500366/500000)。
  4. 怎么修复的:证据门收紧为「carriage = 活的 tracked session」——探针必须返回非空 sessionId 才认领;无 session 的 200(pre-first-request / chain-advisory)与 404、探针失败一律不认领,原生压缩进行。
  5. 是否有回归问题:审过 pi 本地路径(carriedSids,不变)、pi/omp 探针路径、非 http baseUrl 否决、无 sid 的历史取消、探针失败降级——均保持;唯一有意变更是「无 session 200 不再认领」(已披露)。无 fail-fast 变吞错、无阈值/时序/输出格式漂移。
  6. 是否破坏缓存:不涉及——只改所有权判定,不动缓存/重试/游标/去重键。
  7. 是否改了设计方向:否。仍走 Pi plugin cancels Pi's auto-compaction for conversations the proxy never sees (breaks pi-claude-bridge) #1382/fix: cancel pi/omp auto-compaction only on evidence the proxy carries the conversation (#1382) #1383 的证据门方向,只是把「carriage」判据从「200」精确到「活 session」,与设计意图(pi.ts 注释「carriage evidence still decides」)一致。
  8. 是否引入了新的配置:无。

判定:方向正确、残留漏洞已当场补上并推 commit(3e7bb28f74),定向测试 76/76 绿、typecheck/build 过。新 commit 的 CI 待跑(镜像缓存仍是旧 sha 48d2ca0b83)。proxy 侧折叠可靠性是 owner 另行方向,不阻塞本 PR。建议:CI 绿后可合。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

CI 更新:补修 commit 3e7bb28f74 的全量 CI 已跑完 —— 49 个 check-run 全部 success/skipped,0 失败(e2e 车道按 gate 跳过,非本次改动触发)。定向 tests/plugin-agent.test.ts 76/76 绿、typecheck/build 过。

最终判定:方向正确、#7060 真实绕过形态(200 pre-first-request / chain-advisory 的无 session 200)已闭合,无回归、无缓存影响、无新配置。CI 绿,可合。proxy 侧折叠可靠性(nudge 饥饿 / fold 回滚 / preflight 超时)是 #2110 定的 owner 另行方向,不阻塞本 PR。

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

Projects

None yet

1 participant