You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug][omp] OMP ≥ 18.18 sends Claude turns as Anthropic message threads → bili omp and the omp native lane never compress (fix: PI_ANTHROPIC_MESSAGE_THREADS=0) | OMP 18.18 起 Claude 走 message threads,每轮只发最新一条 → bili omp 不压缩 #6088
Since OMP (oh-my-pi) 18.18, Claude requests to the official endpoint use Anthropic message threads (beta message-threads-2026-08-12). After the first turn each request carries only the newest message(s); Anthropic keeps the rest server-side. bili therefore never sees the conversation: each turn arrives as a 1–2 message request, is forked into a |sub: session, and nothing is ever folded. There is no error anywhere; the session just never compresses.
OMP decides this per request in packages/ai/src/providers/anthropic-threads.ts (wantsAnthropicThreads): a caller's statefulResponses wins, otherwise PI_ANTHROPIC_MESSAGE_THREADS, otherwise the model policy, which applies only when the base URL is the official one. bili omp routes Claude through PI_PROXY_ANTHROPIC (src/launcher.ts, omp branch, env.PI_PROXY_ANTHROPIC = origin), so the model's base URL stays official and threads stay on. Nothing in bili sets PI_ANTHROPIC_MESSAGE_THREADS (code search finds no hits on master).
Repro. One omp -p session with three one-word turns, model claude-opus-5-5 (subscription login), Claude routed to a running bili via PI_PROXY_ANTHROPIC=http://127.0.0.1:<port>:
run
bili session
requests
messages in the bili session
|sub: forks
OMP default (threads on)
01a1c38f-aa16-…
1
2
2
PI_ANTHROPIC_MESSAGE_THREADS=0
01a1c38f-cdc6-…
3
6
0
The stock launcher showed the same on 2026-11-09: bili omp 0.1.213 with OMP 18.18.3 logged request: 1 msgs on turn 2 by default, and request: 3 msgs (cache hit 99%) with PI_ANTHROPIC_MESSAGE_THREADS=0.
With the variable set, long OMP sessions compress normally again, and OMP subagents (run in-process) also arrive with their full history: a probe with one main session and three subagents produced four bili sessions with full history each and no |sub: forks.
Suggested fix
Launcher: in the omp branch, next to env.PI_PROXY_ANTHROPIC = origin, set env.PI_ANTHROPIC_MESSAGE_THREADS = "0" when the user has not set it. An explicit user value still wins.
Native lane (extension only, no launcher): OMP reads the variable at request time ($env is Bun.env), so agent/omp.js / omp-native.js could set process.env.PI_ANTHROPIC_MESSAGE_THREADS ??= "0" on load. Untested.
Diagnostics: a request carrying the message-threads-2026-08-12 beta could log one clear warning, e.g. "OMP message threads are on; bili cannot compress this session; set PI_ANTHROPIC_MESSAGE_THREADS=0".
Related: #3744 (threads on Claude Desktop). For OMP there is a simple client-side switch, so it does not need a threads lane.
bili version
0.1.213. The 2026-11-09 run was stock 0.1.213. The 2026-11-10 run used 0.1.213 with two local patches that do not touch this path: the #5441 port for #5432, and a host-transport lane that stays inactive on stock OMP.
Usage mode
Launcher (bili omp), and Plugin native (omp-native extension plus PI_PROXY_ANTHROPIC pointing at one resident proxy).
Activity
ranxianglei commentedon Nov 10, 2026
(ai: vllm-qwen/qwen3.8-27b)
查重:不重复。 open+closed 全量检索
PI_ANTHROPIC_MESSAGE_THREADS/ message threads 无其他条目。最接近的是 #3744(Claude Desktop 内嵌 CC 的 threads 问题),但那是不同客户端(Claude Desktop vs OMP)+ 不同机制(bili 服务端 reforge lane vs OMP 客户端开关),且本 issue 明确说明 OMP 有客户端开关、不需要 threads lane。同家族但不同客户端/不同机制,单独处理。标签:bug, omp, scope/wiring, p1(核心承诺「压缩」静默失灵 → p1)。
审核结论(审核先于实现):
src/launcher.tsomp 分支只做PI_PROXY_ANTHROPIC = origin的 gap-fill([Bug] Anthropic requests leak prompt_cache_key when Cowork transport bypasses native fetch interception #2583),从不设置PI_ANTHROPIC_MESSAGE_THREADS;全仓 grepPI_ANTHROPIC_MESSAGE_THREADS/message-threads-2026零命中,确认 bili 侧无任何默认值或诊断。wantsAnthropicThreads回落到 model policy 时,base URL 是官方地址即开 threads;bili omp只改代理不改模型 baseUrl,所以 threads 保持开启 → 每轮只带最新消息 → bili 永远看不到完整对话 → 不压缩,还分叉出|sub:会话。与 issue 描述完全一致。src/launcher.tsomp 分支):在PI_PROXY_ANTHROPICgap-fill 之后补PI_ANTHROPIC_MESSAGE_THREADS="0"的 gap-fill(空白=未设置;用户显式值优先)——与 OMP native: preflight SSE comments do not reset 300s first-event timeout (Working → aborted) #1774 first-event timeout 的既有 stamp 风格一致。src/agent/omp-native.ts模块求值块):在既有 gate(NODE_TEST_CONTEXTundefined &&ompTrafficRidesBili)下、applyOmpFirstEventTimeout旁补同样的??="0"。OMP 在请求时读 env,加载时写即可覆盖扩展模式。src/server/handle.ts+context-window.ts新 helper):anthropic 请求携带message-threads*beta 头时,按会话(分叉前 id)各告警一次——避免|sub:fork 刷屏;日志说明上游持有历史、bili 无法压缩该会话、建议设PI_ANTHROPIC_MESSAGE_THREADS=0。行为变更披露(按政策):旧行为 = 继承环境(未设置时 OMP ≥18.18 对官方地址 Claude 默认开 threads → 永不压缩);新行为 = launcher/native 车道默认
"0"(每轮全量历史,压缩恢复),用户显式值(含空白=未设置约定)一律优先。这是恢复 18.18 之前的语义,属修复而非漂移,仍按政策披露。下一步:实现 + 定向测试(launcher env 断言、omp-native stamp 幂等、beta 检测 helper 双向)+ PR。
docs(omp): document exported PI_ANTHROPIC_MESSAGE_THREADS default (ra…