Skip to content

feat: per-call conversation_id for MCP tools (#760) - #761

Merged
ranxianglei merged 6 commits into
masterfrom
2026-09-14_per-call-conversation-id
Sep 15, 2026
Merged

ranxianglei merged 6 commits into
masterfrom
2026-09-14_per-call-conversation-id

Conversation

@ranxianglei

@ranxianglei ranxianglei commented Sep 14, 2026 •

Copy link
Copy Markdown
Owner

What

Hosts that share ONE MCP shim process across several concurrent conversations (kimi web et al.) have no env/meta session channel — all three existing identity paths need client cooperation. This adds a fourth channel that needs none: the model supplies its own conversation id on every tool call, and the proxy routes by a unified canonical session id so wire requests and MCP tool calls share one identity space.

Changes

  • src/session.ts — unified canonical id. Every session exposes a stable pfa-* canonical id: anonymous sessions already ARE pfa-* (canonical == session.id); legacy client-named sessions derive one deterministically from their session id (pfa-${sha256("legacy:"+sessionId)}, 16 hex chars), materialized onto persisted metadata.canonicalId. Exports ensureCanonicalId (materialize+persist, idempotent) and findSessionByCanonicalId (read-only reverse lookup over the resident pool — always consistent with the live set, no separate index to desync on evict/load).
  • src/server.ts — the injected note prints the session's canonical id (all three prepare paths), so the model echoes back one uniform id space regardless of how its session was named. Byte-stable per session → prefix-cache safe.
  • src/plugin.ts — manifest advertises an optional conversation_id param in all three tool formats (kernel constants cloned, never mutated; wire-mode injection serves them directly and is untouched). handlePluginTool/handlePluginCompact/handlePluginStatus resolve the target through resolveConversation: map → verbatim session id → canonical reverse lookup. First calls route before any binding recorded the mapping; unknown ids still 404 (no model request has arrived) and create nothing. Evidence-based plugin-mode flip: a successful MCP tool execution binds that session to plugin mode (metadata.pluginAgent = "mcp", guarded — never overrides an existing agent binding). Nudge stays injected (owner decision); only ephemeral wire tools are suppressed post-flip.
  • src/mcp.ts — shim routes per-call ids: tools/call reads conversation_id, overrides the default binding for that one call only, strips the arg, forwards on the body field. Per-call lazy registration removed (post-review): the sticky flip comes from successful-tool evidence, and a registration keyed by the canonical id would never be consumed by a raw-client-id request anyway while evicting identity-register LRU slots (cap 64). initialize/register is kept for known single-session hosts to enter plugin mode before their first model request. Per-call failures never trigger orphan adoption. No-id error hints at the per-call parameter.

Key decisions

  1. Canonical id, not raw client id, is the routing token. The model copies whatever the note prints (pfa-*). Legacy sessions get a deterministic alias so old ids keep working AND the canonical reverse lookup works; nothing existing breaks.
  2. Evidence-based flip replaces per-call registration. The flip fires inside the tool call (model called the tool ⇒ saw it ⇒ client provided it), which also eliminates the headless-pending-register mis-binding hazard class. Registration survives only as the single-session-host pre-first-request path.
  3. Nudge stays in plugin mode — owner confirmed (0.1.69 回归: plugin 模式 nudge 注入被 !pluginMode 静默禁用 — INJECT 日志照打但从不投递, 自动压缩只剩 preflight 应急 #451 semantics: it is the agent's only proactive trigger).
  4. Scan-over-index for the reverse lookup. The pool is bounded (≤ MAX_SESSIONS); a scan is always consistent with the live session set and avoids a separate index desyncing on evict/load.

Tests

tests/issue760-percall-conversation.test.ts (8 tests):

  • manifest schema × 3 formats + kernel-constants-unmutated;
  • wire-mode id note present + byte-stable;
  • first-call routing with no registration / no pck record (verbatim path);
  • canonical pfa-* id routes a legacy-named session (canonical reverse-lookup path) while the raw id still works; unknown id 404 without creating a session;
  • successful MCP tool execution flips the session to plugin mode (evidence flip);
  • shared-shim e2e: two sessions route independently using the canonical ids from the notes (not raw ids), both flip to plugin mode, an unrelated session landing between stays wire mode (proves the flip touches only the session whose own tool ran);
  • mock-proxy shim unit: arg stripping, routing on the body field, NO registration issued for per-call ids, no-id hint, ghost-404 no-adoption.

Pre-flight

  • npm run typecheck ✅
  • npm test: 1467 pass / 0 fail / 2 skipped (gated e2e)
  • npm run build ✅
  • E2E codex: E2E_CHECK=1 preflight ✅; full run NOT completable here — the local sglang upstream (:8199) is down in this environment (ECONNREFUSED, zero completions; environmental, unrelated to the diff). Please run .github/workflows/ci-e2e.yml dispatch before merge since server.ts prompt injection changed.

Fixes #760

@github-actions

github-actions Bot commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

📦 Built Package Artifact

Branch: 2026-09-14_per-call-conversation-id (b6e3782)

Option A — Install from npm PR tag (recommended)

npm install -g billion-context@pr-761

Each push to this PR publishes a new version under the pr-761 npm tag.

Option B — Download artifact

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

This comment is automatically updated on each push.

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 PR #761 review — merge-ready, two items outstanding (owner decision + CI e2e dispatch)

I checked out pr-761 (c4e6a0a, single clean commit atop master) and audited the diff line-by-line. All five files are strictly on-topic — no stray changes, no whitespace churn, diff passes the cleanliness gate.

Independent validation (re-ran everything, not just trusting the description):

  • npm run typecheck ✅
  • npm test: 1465 pass / 0 fail / 2 skipped (gated e2e) — matches your numbers exactly
  • npm run build ✅ (self-contained dist/index.js)
  • E2E_CHECK=1 node --import tsx --test tests/e2e/e2e-codex.test.ts preflight ✅
  • Full codex e2e NOT completable here (local sglang :8199 down in this sandbox, same as your note). Please dispatch .github/workflows/ci-e2e.yml manually before merge — server.ts system-prompt injection changed, so this is the one path unit tests don't fully cover.

Audit findings (both compression modes considered, per AGENTS.md §6):

  1. identity-not-headless is correct and genuinely tested. Verified against the binding chain (server.ts:1378-1398): identity regs are consumed by consumePluginRegisterFor(clientConv ?? conversation) and sticky-LRU-refreshed (never deleted after consume, so mid-conversation model/upstream switches keep binding); headless pending registers only fire when session.stats.requests === 0. The spawned-shim test landing an unrelated conv-other request between A's registration and A's next request is the right proof — a headless reg would have stolen it.
  2. Kernel constants truly unmutated. withConversationIdParam structuredClones; wire-mode injection serves the originals. Cross-checked all three shapes against acp-kernel's actual constants (anthropic input_schema.properties / openai function.parameters / responses top-level parameters), including the absorb tools. Test 1's doesNotMatch(ACP_TOOLS_ANTHROPIC, /conversation_id/) guards this.
  3. Prefix-cache safety holds. Note value is session.id — the same stable key used for every client-provided identity — so the static system part is byte-stable across turns (test 2 asserts exact equality of turn 1 vs turn 2 bytes).
  4. Adoption trigger preserved. handlePluginTool 404 messages are byte-for-byte identical to master (the no model request has arrived substring the MCP tools fail with 'unknown plugin conversation' after Claude Code --resume (shim holds a stale session id) #656 adoption guard keys on). The handlePluginCompact message change (entry-exists case now says "id registered but session not resident") is safe — its only consumer is src/agent/pi.ts:439, fire-and-forget .catch(() => {}), no message matching anywhere.
  5. Native agents unaffected. pi/omp/opencode fetch the same manifest so their models see the param + note too, but it's inert: direct /__bili/plugin/tool calls route on the body-level conversationId (the agent's own binding) and args.conversation_id is stripped proxy-side. Cross-repo (billion-context-pi, opencode-acp) needs no changes since they forward params as args.

Minor observations (non-blocking, noting for the record):

  • MAX_PENDING_REGISTERS = 64 (src/plugin.ts:218): with >64 concurrent fresh conversations registering before each one's next model request, an identity reg could be LRU-evicted pre-consume → that session stays in mixed mode (wire ephemeral tools + mcp tools both visible). Routing still works via the verbatim fallback, so degradation not breakage — but worth knowing if kimi-web-scale concurrency ever approaches that.
  • ensureRegistered adds to registeredConversations before the fetch resolves (issue-once even on failure). If the proxy restarts after a failed registration fetch, the shim won't re-register that id. Same behavior as the existing default-binding path; the peekSession fallback keeps routing working, so no action needed.

Open question for the owner (flagged in the PR description, restating): the acceptance text says flip to pure plugin mode suppresses ephemeral tools and the nudge; this PR follows existing pluginMode sticky semantics (#451: the proxy nudge is the agent's only proactive compression trigger) and keeps the nudge. Please confirm which behavior you want before merge — if the literal reading wins, it's a small follow-up change.

Verdict: diff is clean, logic is sound in both modes, tests are deterministic and well-targeted (the conv-other interleaving and the mock-proxy adoption-guard assertions are exactly the right proofs). Merge once (a) the nudge question is settled and (b) the manual ci-e2e dispatch is green.


审查了 PR #761(MCP 工具按调用传 conversation_id):独立复跑了全部验证(typecheck、1465 项测试、build、e2e 预检均通过),逐行审计确认 identity 懒注册不会误绑他人新会话、kernel 常量未被污染、前缀缓存字节稳定、孤儿收养触发子串原样保留;无需在分支上补修任何问题,待 owner 确认 nudge 保留决策并手动跑一次 ci-e2e 后即可合并。

ework-agent and others added 3 commits September 14, 2026 19:16
Every session now exposes a stable pfa-* canonical id that MCP tools route by, independent of what the client calls itself. Anonymous sessions already ARE pfa-* (canonical == session.id); legacy client-named sessions derive a deterministic pfa-* from their session id, materialized onto persisted metadata.canonicalId.

- wire notes inject the canonical id (all three prepare paths), so the model echoes back one uniform id space

- tool/compact/status endpoints gain a canonical reverse-lookup path (map -> verbatim -> canonical); old ids keep working, unknown ids still 404 and create nothing

- evidence-based plugin-mode flip: a successful MCP tool execution binds that session to plugin mode (guarded: never overrides an existing agent binding)

Extends PR #761 (per-call conversation_id). Fixes #760.
…outing

Per review of #760: per-call ensureRegistered() was dead weight. The sticky plugin-mode flip already comes from successful-tool evidence inside handlePluginTool, and a registration keyed by the canonical pfa-* id would never be consumed by a raw-client-id request anyway (consumePluginRegisterFor(raw-id) misses it) while still evicting identity-register LRU slots (cap 64).

- src/mcp.ts: remove the per-call register call and the now-unused ensureRegistered(); keep initialize/register (single-session hosts enter plugin mode before their first model request) and rely on evidence for shared-host flips.

- tests: the shared-shim e2e now passes the canonical pfa-* id (what the model copies from the injected note) instead of the raw client id, so it exercises the canonical reverse-lookup path end-to-end; the mock-proxy unit asserts NO registration is issued for per-call ids; comments/assertion messages updated from 'identity-mode lazy registration' to 'successful-tool evidence'.

Extends PR #761. Fixes #760.
@ranxianglei

Copy link
Copy Markdown
Owner Author

更新了很多重新review最新代码 是否有回归问题

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 Re-review of updated head (8889ed4 + my doc fix 9009973) — no regressions found

Reviewed the two new commits (4b56101 canonical id space, 5f1e0df drop lazy registration) plus the master merge (v0.1.110, which brought in #759/#768/#770/#771). The true PR delta vs current master stays scoped to 6 files (+651/-35).

Verdict on the redesign: it's strictly simpler than v1 and eliminates the failure surface I flagged last round.

  1. Per-call registration removed — correct call. The commit message's analysis is right: a registration keyed by the canonical pfa-* id would never be consumed by a raw-client-id request anyway (consumePluginRegisterFor(rawId) misses), while still burning one of the 64 MAX_PENDING_REGISTERS LRU slots — exactly the cap concern from my first review. That whole class of edge case (eviction-before-consume → stuck mixed mode) no longer exists. Initialize-time default-binding registration is kept, so single-session hosts (claude/codex) still enter plugin mode before their first model request; the orphan-adoption guard (conversationIdOverride === undefined) is untouched.
  2. Evidence-based flip is sound. Synchronous inside the first successful tool call, guarded by typeof session.metadata.pluginAgent !== "string" so it can never override a native pi/omp/opencode binding or a launcher-registered agent (native agents are always bound at their first request, which necessarily precedes any model-generated tool call). Only the session whose own tool executed flips — the spawned-shim test's unrelated conv-other proves siblings stay wire mode. Flip persists via metadata → survives restart.
  3. Canonical pfa-* id space checked out. Deterministic sha256 derivation means the value survives even if persisted metadata is lost; materialization is idempotent; the reverse lookup scans the resident pool (≤ MAX_SESSIONS) instead of maintaining a second index that could desync on evict/load — good call. Uniform short hex format is what models actually echo faithfully, and as a side effect the raw client identifier (pck value / env session id) no longer leaks into the prompt sent to third-party upstreams. Old raw ids keep routing via the verbatim path (tested); fabricated pfa-deadbeef… ids 404 without creating anything, and the MCP tools fail with 'unknown plugin conversation' after Claude Code --resume (shim holds a stale session id) #656 adoption trigger substring is byte-preserved.
  4. handlePluginStatus fallback condition change ((!entry || !session) → !session) is a strict improvement: an explicitly-resolvable id now wins over latest-fallback where the old code could have redirected to an arbitrary latest session; the adoption flow (stale id, session gone) behaves identically.
  5. Both modes considered. Native agents get the manifest param + note too but it's inert for them (their calls route on body-level binding, arg stripped proxy-side); nudge behavior is unchanged from v1 (still injected in both modes per 0.1.69 回归: plugin 模式 nudge 注入被 !pluginMode 静默禁用 — INJECT 日志照打但从不投递, 自动压缩只剩 preflight 应急 #451 — see outstanding item below). Prefix-cache stability holds: the canonical id is deterministic per session.id, so the static system part stays byte-stable across turns (test asserts exact equality).

Independent validation on the new head:

  • npm run typecheck ✅
  • npm test: 1497 pass / 0 fail / 2 skipped (new file now 8/8, incl. canonical-routing and evidence-flip tests); full suite also covers the merged-master changes
  • npm run build ✅
  • E2E_CHECK=1 codex e2e preflight ✅ — full run still needs the manual ci-e2e.yml dispatch (the wire-note value source changed again this round)

One small fix pushed directly to the branch (9009973, comment-only): the src/mcp.ts module header still said per-call ids "lazily register the named conversation on first use" — dead text after 5f1e0df; corrected to describe route-without-registration. Re-ran typecheck + the 8-test file after the edit, both green.

Outstanding before merge (unchanged from last round):

  1. Nudge decision: implementation keeps injecting the proxy-side nudge in plugin mode (0.1.69 回归: plugin 模式 nudge 注入被 !pluginMode 静默禁用 — INJECT 日志照打但从不投递, 自动压缩只剩 preflight 应急 #451 semantics — it's the MCP host's only proactive compression trigger); the issue's literal acceptance text ("不再注入 nudge") is not implemented. Please confirm which wins.
  2. Manual ci-e2e.yml dispatch (secrets-configured runner) since server.ts injection paths changed.

Merge-ready once those two land.


重新审查了更新后的 PR(新增 canonical pfa-* 统一 id 空间 + 证据式 plugin-mode 翻转,移除了按调用懒注册):逐机制核对无回归——懒注册移除恰好消除了上轮指出的 64 槽 LRU 边界问题,翻转有守卫不会覆盖原生 agent 绑定,canonical id 确定性派生且旧 raw id 向后兼容、伪造 id 仍 404 不建会话;独立复跑 typecheck/1497 项测试/build/e2e 预检全部通过,顺手在分支上修了一处 mcp.ts 头部过期注释(9009973),待 owner 确认 nudge 决策并手动跑一次 ci-e2e 即可合并。

@ranxianglei

Copy link
Copy Markdown
Owner Author

owner 确认 nudge 决策 指的是什么决策?

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 指的是这个问题:

Issue #760 的验收文字写的是——会话翻转到纯 plugin mode 后,proxy「不再注入 ephemeral 压缩工具与 nudge」(即 ephemeral compress 工具和 nudge 两者都不再注入)。

但本 PR 的实现只停掉了 ephemeral 工具,nudge 仍然注入(两种模式都注入,src/server.ts:2068-2074,注释明确写着 "Injected in BOTH modes (#451)")。原因是 #451 确立的语义:plugin/MCP host 的模型自己不会主动发起压缩,proxy 侧这条 nudge 消息是它唯一的主动压缩触发器;preflight 只在硬限制处触发。如果按验收文字字面把 nudge 也停掉,这些共享 MCP host 的会话就完全没有主动压缩时机了,上下文会一直涨到内核硬截断带才被动处理——正是 nudge 要防止的场景。而 issue 第 4 点又说"follow existing pluginMode sticky semantics",与验收文字自相矛盾。实现选了 #451 一侧(保留 nudge),所以需要你拍板:

  • A(当前实现,我的建议):翻转后 ephemeral 工具消失,nudge 保留。理由如上——nudge 是这类 host 唯一的主动触发器,停掉是压缩行为的回归。
  • B(验收文字字面):翻转后 nudge 也停掉。改动很小(按 session.metadata.pluginAgent === "mcp" 跳过注入即可),但上述后果成立,我不推荐。

如果你认为 A 没问题,这条就算关闭,PR 只剩手动跑一次 ci-e2e.yml dispatch 就可以合并了。

@ranxianglei

Copy link
Copy Markdown
Owner Author

所以现在考虑看看有回归问题吗?

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 结论:没有发现回归问题。这轮我专门针对本 PR 唯一的新行为——会话中途从 wire mode 翻转到 plugin mode(现有流程都是绑定时就定好模式,没有中途翻转过)——做了一组针对性检查:

  1. nudge 文案与模式无关:内核的 nudge 文本用的是 compress({ content: [...] }) 这种参数级引用(acp-kernel/dist/chunk-37CVFHFQ.js renderNudgeText),不点名 wire 侧的 ephemeral 工具名。翻转后模型看到的压缩工具是 mcp__bili__compress,参数 schema 完全一致——而且这正是 pi/omp/opencode 这类原生 plugin agent 自 0.1.69 回归: plugin 模式 nudge 注入被 !pluginMode 静默禁用 — INJECT 日志照打但从不投递, 自动压缩只剩 preflight 应急 #451 起每天在生产里收到的同一条 nudge。翻转后的 MCP 会话进入的是已有 plugin agent 早已稳定运行的状态,不是新状态;新的只是"何时进入"这个时机。
  2. 前缀缓存在翻转瞬间不被击穿:id 注释用确定性派生的 canonical id(同一 session.id 永远同一个值),静态 system 块跨翻转字节不变;nudge 是 ephemeral 尾随 user 消息(不持久化、不进 agent 重发历史),src/server.ts:2068-2074 注释明确这是 cache-friendly 设计。测试里断言了翻转前后 system 字节相等。
  3. 无模式假设的状态残留:rememberPluginMessages(src/server.ts:1647/1730)在所有模式下都调用、只喂 /__bili/plugin/status 面板显示最新一轮,请求管线不依赖它,翻转不会让任何缓存状态错位。
  4. 翻转失败的最坏情况 = 留在 wire mode,即完全正常的旧行为(ephemeral 工具 + nudge + mcp 工具并存),路由始终有效——不存在"翻转了一半"的坏状态。翻转本身是同步的(首次工具调用成功即置 metadata.pluginAgent,带守卫不覆盖原生绑定),没有可丢失的异步环节。

加上第二轮已核过的(canonical id 空间、raw id 向后兼容、伪造 id 404 不建会话、#656 收养触发子串保留、adoption guard 未动)和独立复跑的验证(typecheck ✅ / 1497 pass 0 fail / build ✅ / e2e preflight ✅),我的判断维持:可以合并,只剩手动 dispatch 一次 .github/workflows/ci-e2e.yml(server.ts 注入路径两轮都动过,单测覆盖不到真实 client 行为)。nudge 若按我建议的 A(保留)确认,就没有任何 open item 了。

@ranxianglei

Copy link
Copy Markdown
Owner Author

解决冲突

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 冲突已解决并推送到 PR 分支(b6e3782,merge commit,9009973..b6e3782)。

冲突本身只有一处:src/server.ts 的 prepareAnthropic 里 injectSystem(...) 调用行——本 PR 加了第 5 个参数 ensureCanonicalId(session)(canonical id 注入),master 侧(v0.1.112)同一行的函数签名演进(新增 absorb system prompt 等改动)导致两边都动了这一行。解法:保留 PR 侧调用;函数定义本体 git 已自动合并且验证过同时包含两边改动(PR 的 noteId 参数 + withConversationIdNote,master 的 buildAbsorbSystemPrompt 行),全文件仅此一个调用点,无遗漏。

合并带入的 master 内容已逐一核对与本 PR 无交互:

合并后树独立复跑全绿:typecheck ✅ · npm test:1593 pass / 0 fail / 2 skipped(含本 PR 的 8 项)· build ✅ · E2E_CHECK=1 codex e2e preflight ✅。

PR 现在与 master(v0.1.112)零冲突。剩余事项不变:手动 dispatch 一次 .github/workflows/ci-e2e.yml(server.ts 两轮都动过)+ nudge 决策确认(我的建议:按 #451 保留)。


解决了 PR 与 master(v0.1.112)的合并冲突(server.ts 中 injectSystem 调用行一处,保留 PR 的 canonical id 参数,函数定义自动合并已验证含双方改动),核对了 master 带入的 plugin.ts 计费改动与 server.ts 重构均与本 PR 无交互,合并后树复跑 typecheck/1593 项测试/build/e2e 预检全部通过并已推送(b6e3782),PR 现与 master 零冲突。

@ranxianglei
ranxianglei merged commit 36d407a into master Sep 15, 2026
7 checks passed
ranxianglei pushed a commit that referenced this pull request Sep 17, 2026
…sation_id

Extends the #760/#761 per-call conversation_id plumbing with a second, execution-layer semantic for search_context: when the id does not match the caller's own session (verbatim or canonical alias), the call searches that historical session instead of re-routing to it.

- resolveForeignSessionState: resident memory first (peekSession / findSessionByCanonicalId), else SessionStore.loadStateForSearch — a new strictly read-only persistence path that never schedules saves (unlike loadSync, which has the #408 clamp side effect).
- Cross-session results are scoped and namespaced: output lines carry 'in session <id>' plus a note that block ids are per-session namespaces; decompress stays anchored to the current session, bulk content via 'bili export <id> [--full]'.
- Unknown ids fail loudly ([search_context FAILED: unknown session ...]) without creating state.
- search_context's conversation_id param description is specialized in the plugin manifest (routing text kept for all other tools); wire-mode schemas gain the optional param via BILI_* derived constants so proxy-mode clients can target historical sessions too. Kernel constants are never mutated.
- MCP shim keeps conversation_id in args only for search_context so the proxy resolves the target itself; routing semantics for every other tool are unchanged, and no tool call ever mutates a foreign session.

Closes #841
ranxianglei pushed a commit that referenced this pull request Sep 17, 2026
…sation_id

Extends the #760/#761 per-call conversation_id plumbing with a second, execution-layer semantic for search_context: when the id does not match the caller's own session (verbatim or canonical alias), the call searches that historical session instead of re-routing to it.

- resolveForeignSessionState: resident memory first (peekSession / findSessionByCanonicalId), else SessionStore.loadStateForSearch — a new strictly read-only persistence path that never schedules saves (unlike loadSync, which has the #408 clamp side effect).
- Cross-session results are scoped and namespaced: output lines carry 'in session <id>' plus a note that block ids are per-session namespaces; decompress stays anchored to the current session, bulk content via 'bili export <id> [--full]'.
- Unknown ids fail loudly ([search_context FAILED: unknown session ...]) without creating state.
- search_context's conversation_id param description is specialized in the plugin manifest (routing text kept for all other tools); wire-mode schemas gain the optional param via BILI_* derived constants so proxy-mode clients can target historical sessions too. Kernel constants are never mutated.
- MCP shim keeps conversation_id in args only for search_context so the proxy resolves the target itself; routing semantics for every other tool are unchanged, and no tool call ever mutates a foreign session.

Closes #841
@ranxianglei
ranxianglei deleted the 2026-09-14_per-call-conversation-id branch October 15, 2026 05:32
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.

feat: per-call conversation_id for MCP tools — let the model supply its session id

1 participant