Skip to content

fix(#638): codex plugin install self-heals malformed blocks instead of short-circuiting on the origin line - #685

Merged
ranxianglei merged 1 commit into
masterfrom
fix/638-codex-plugin-self-heal
Sep 10, 2026
Merged

fix(#638): codex plugin install self-heals malformed blocks instead of short-circuiting on the origin line#685
ranxianglei merged 1 commit into
masterfrom
fix/638-codex-plugin-self-heal

Conversation

@ranxianglei

Copy link
Copy Markdown
Owner

Fixes #638

问题

codexInstall()(v0.1.95)在 [mcp_servers.bili] 块已存在时,只比对 BILI_MCP_PROXY 那一行判断「已安装」。当块畸形(典型:args 被写成字符串 — 合法 TOML 但 codex schema 要求数组)且 origin 行恰好匹配时,重装直接返回 already installed,畸形 args 原样保留 → codex 持续报 expected a sequence,升级/重装这条最自然的自愈路径失效。

修复

  • 「已安装」判定从「只比对 origin 行」改为整块与 codexBlock() 规范块比对(两侧 trimEnd() 归一,容忍尾部换行差异)
  • 不一致 → 一律用规范块原位重写(自愈 args / command / 路径 / 格式)
  • args 为字符串的畸形块额外提示:codex: refreshed [mcp_servers.bili] -> … (repaired args: was not an array),不再让用户去啃 codex 的 serde 报错
  • 字节一致 → 保留 already installed 文案(幂等,重跑不重写文件)

测试

tests/plugin-agent.test.ts 新增 #638 回归:

  1. 畸形块(origin 匹配 + args 字符串)+ pluginInstall("codex") → 输出含 repaired args: was not an array,args = [ 数组形态,相邻 [mcp_servers.other] 表不受影响
  2. 治愈后的规范块重跑 → already installed(不再反复重写)
  3. 既有用例(origin 变更 → refreshed、追加表后 already installed、header-only 边缘删除)全部保持

全套 1298/1298 通过,typecheck / build ✓。

…f short-circuiting on the origin line

The 'already installed' check compared only the BILI_MCP_PROXY line, so a
malformed [mcp_servers.bili] block (args as a quoted string — legal TOML,
invalid codex schema) survived reinstall untouched and codex kept failing
with 'expected a sequence'. Now the whole block is compared against the
canonical codexBlock(): byte-equal -> already installed; anything else ->
rewritten in place, with an explicit hint when args was not an array.

Fixes #638
@github-actions

Copy link
Copy Markdown

📦 Built Package Artifact

Branch: fix/638-codex-plugin-self-heal (e8772ac)

Option A — Install from npm PR tag (recommended)

npm install -g billion-context@pr-685

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

Option B — Download artifact

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

This comment is automatically updated on each push.

@ranxianglei
ranxianglei merged commit 9cb732f into master Sep 10, 2026
6 checks passed
@ranxianglei ranxianglei mentioned this pull request Sep 10, 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.

bug: bili plugin install codex 无法修复已存在的畸形 [mcp_servers.bili] 块("already installed" 短路只比对 BILI_MCP_PROXY 行)

1 participant