Repository navigation
[PR] Stop pinning the claude MCP face to a stale lane port (#5128) - #5129
ranxianglei wants to merge 9 commits into
Conversation
The claude installer baked BILI_MCP_PROXY=<base port> into the registered MCP server. When the claude lane proxy drifts +1 on a port collision (#1660), the SessionStart hook repins ANTHROPIC_BASE_URL to the live origin but the MCP entry kept the stale pin; resolveProxyOrigin() honours the env pin before live discovery, so ACP tools/list failed (-32003) while model traffic kept compressing through the repinned URL. Same class as #926 (fixed for opencode in #936), still present in the claude installer. - claudeInstall(): no origin pin by default; a pin lands only when BILI_MCP_PROXY is set explicitly at install time (user intent). - claudeMcpFaceAction(): a no-pin entry is now the canonical/current form; a stale baked pin is healed away on reinstall (remove + add without the pin). - claude-mcp-entry.js main(): resolveClaudeMcpOrigin() prefers the managed block's last-repinned URL over a stale baked pin and bridges it into BILI_MCP_PROXY so stdio tool calls dial the same live origin as the watchdog — old installs self-heal without a reinstall.
📦 Built Package ArtifactBranch: Latest build — install this exact versionnpm install -g billion-context@0.0.7392-pr.5129.db150c9This exact version is immutable and reproducible. The rolling Recent builds (commit → version)
Download artifact
tar xzf billion-context-pr5129.tgz
npm install -g packageInstall instructions are refreshed on each push. |
(ai: vllm-qwen/qwen3.8-27b) 查重:不重复。与 #926/#936(opencode 的 MCP origin 冻结)同族——都是「安装时烘焙的 origin 在 lane 漂移后变死端口」这一机制,但客户端不同(本 PR 是 claude 安装器 审核方式:带 结构化八问:
测试有效性:断言有牙,正负双向门禁齐备——新装不烘焙且命令不含 CI 状态:PR #5129 head 判定:独立代码/回归分析全部通过——修法打到根因、与既有范式一致、测试有牙、无回归、diff 干净。建议 CI 转绿后合并;我会盯 CI,转绿/转红第一时间补一条确认。 |
(ai: vllm-qwen/qwen3.8-27b) CI 红判定:继承性失败,已按 CI 协调政策处理——merge 证据链:四个红分片的失败签名逐条拉日志核对,全部落在本 PR diff 之外的子系统:
本 PR 只改三文件( 八问:
已在 #4599 留一行结论(PR #5130 红,已 merge ci-fixes,sha=2b1bb24ae)。CI 重跑结果出来前本条即最终处置;若重跑仍有非继承红,再开下一轮定向排查。 |
(ai: vllm-qwen/qwen3.8-27b) CI 结论更新(接上一条 review):PR 现已转绿,之前那条「CI 进行中」作废,以此为准。
最终判定:独立代码/回归分析通过(修法打到根因、与 #936 opencode 范式一致、测试有牙正负双向、无回归、diff 干净)+ 当前 head CI 全绿。可合并。 |
(ai: vllm-qwen/qwen3.8-27b) Merge guard 结果(第五轮):master 本轮推进很快(约 19 commits, |
Closes #5128
What & why
bili plugin install claudebakedBILI_MCP_PROXY=<base port>into the registered MCP server. When the claude lane proxy drifts +1 on a port collision (#1660), the SessionStart hook repinsANTHROPIC_BASE_URLto the live origin but the MCP entry kept the stale pin;resolveProxyOrigin()honours the env pin before live discovery, so ACPtools/listfailed with-32003while model traffic kept compressing through the repinned URL. Same class as #926 (fixed for opencode in #936), still present in the claude installer.The mismatch is one layer deeper than the symptom: the mid-session watchdog probes the managed block's live origin (correct), but the stdio tool calls resolve through the env pin (stale) — so the watchdog sees a healthy proxy while every tool call dials a dead port.
Changes
claudeInstall()— no origin pin by default; a pin lands only whenBILI_MCP_PROXYis set explicitly at install time (user intent). Mirrors fix(plugin): stop freezing a stale MCP origin into opencode installs (Fixes #926) #936.claudeMcpFaceAction()— a no-pin entry is now the canonical current form; a stale baked pin is healed away on reinstall (mcp remove+mcp addwithout the pin). A matching explicit pin stays current.claude-mcp-entry.jsmain()— new pureresolveClaudeMcpOrigin(managed, env): managed-block last-repinned URL > explicit pin > live discovery. When the repin won, it bridges that origin intoBILI_MCP_PROXYso stdio tool calls dial the same live proxy the watchdog probes. Old installs self-heal without a reinstall or waiting out the ~90 s watchdog window.Behavior change (flagged)
bili plugin install claudealways wrotemcpServers.bili.env.BILI_MCP_PROXY = http://127.0.0.1:<install-time base port>.BILI_MCP_PROXYis exported during the install; reinstalling over a legacy pinned entry removes the pin.Tests
Targeted suites green locally (full-suite verdict is remote CI):
tests/claude-mcp-entry.test.ts: 23/23 — fresh install bakes no pin, no-pin entry stays current, stale pin healed, explicit-env pin honored (positive+negative gate),resolveClaudeMcpOriginprecedence (managed beats stale pin — the exact repro), foreign/unreadable paths.tests/claude-native.test.ts: installer round-trip unaffected (65 tests, live-E2E ones skip by default).npm run typecheckclean (exit 0).Related: #1660 (port drift), #926/#936 (opencode twin), #5001 (MCP shim cold proxy, different symptom).