Repository navigation
[PR] feat: Codex Desktop Plugin (Git marketplace + MCP tools + version sync) | feat: Codex 桌面版插件(Git marketplace + MCP 工具 + 版本同步) - #4449
Conversation
把 billion-context 适配成 Codex 桌面版可安装的插件,并让更新检测可用。 为什么必须是 Git marketplace: Codex 的 PluginSummary.version 只在 Git 源下才有版本语义;local / npm 源的 version 恒为 null,插件页面永远看不到「有更新」。Git 源会被 Codex 识别成 sourceType=git,走内置的 plugins-marketplace-auto-upgrade 后台拉取上游更新。 改动: - .agents/plugins/marketplace.json:Codex marketplace 清单,指向 plugins/codex - plugins/codex/:Codex 插件本体 - .codex-plugin/plugin.json:清单 + interface(显示名/简介/品牌色/默认提示词) - .mcp.json + mcp-server.mjs:注册 bili 的 MCP server(stdio JSON-RPC 转发) - scripts/install.ps1:一键安装(CLI 检查 → marketplace → 插件 → enable_mcp_apps) - README.md:安装、用法、排障 - scripts/sync-codex-plugin-version.mjs:以 package.json 为唯一真相源,同步所有 插件清单的版本号(顺带修掉 .claude-plugin 里 0.1.188 的陈旧版本漂移) - .github/workflows/release.yml:发布前校验并同步清单版本,防止版本号漂移 再次进入 release 验证(本地实测 Codex 26.1016): - Git marketplace 装上后 codex mcp list 出现 bili,六个工具可用 (compress / decompress / search_context / acp_status / acp_cache / acp_read_original_image) - 模拟上游发新版:marketplace upgrade 后已装缓存 1.0.0 → 2.0.0,插件列表 版本同步推进(即插件页面的「有更新」) - mcp-server.mjs 在插件目录 / 根目录 / 用户目录三种 cwd 下都能定位入口并握手
Follow-up to the Codex plugin manifest work: rebasing onto current master bumped package.json to 0.1.205, so the four manifests that mirror it had to move too: - .agents/plugins/marketplace.json - plugins/codex/.codex-plugin/plugin.json - .claude-plugin/marketplace.json - .claude-plugin/plugin.json This is exactly the drift the sync script exists to catch: before the script existed, .claude-plugin/ still said 0.1.188 while package.json said 0.1.204, which is what makes Codex's plugin page report a stale version. No behavioral change; `node scripts/sync-codex-plugin-version.mjs --check` now passes.
(ai: vllm-qwen/qwen3.8-27b) 查重:不重复。 相关条目比对:
标签:codex / scope/wiring / p3(新客户端车道功能请求,非缺陷;客户端接入层) 开始按 PR 审查规范做完整审阅(方向 → 回归 → 代码 → 测试有效性 → diff 整洁度),结论稍后以结构化八问给出。 |
…nxianglei#4449) Review alignment for ranxianglei#4449: the original gate sat AFTER 'Create tag' in release.yml only, and its --check step fails by design under the documented flow (a release branch carries a package.json bump but not yet synced manifests) — every release would go red with an orphan pushed tag, and the manual/bugfix lanes had no gate at all (they would silently ship drift). - release.yml: move the --check gate before any CI dispatch/tag/publish and drop the dead write+git-diff tail (the check already exits on drift); the synced manifests now ride as their own commit on the release branch (reference/release.md step 3.5) - release-manual.yml: run the sync inside its in-CI bump step and widen the 'Verify bump diff' allowlist to the four manifest files - release-bugfix.yml: add the same --check gate against the frozen head
The new release gate fails unless release branches carry a manifest-sync commit, so the flow must say how to produce one: AGENTS.md §5 lists the step and its rationale; reference/release.md gains step 3.5 (run the sync script after the bump, own 'chore:' commit, idempotent) and the bugfix carve-out process now requires the synced manifests on the frozen head.
…bustness (ranxianglei#4449) Review alignment for ranxianglei#4449: - install.ps1: read/write config.toml through [System.IO.File] instead of Get/Set-Content — PS 5.1 Get-Content decodes as ANSI/GBK and would write mojibake back over non-ASCII (e.g. Chinese comments); Set-Content -Encoding UTF8 adds a BOM under 5.1 (double-BOM edge). Also resolve codex once up front with a clear error instead of invoking a potentially null command. - mcp-server.mjs: the header comment listed the probe priority in the wrong order (code prefers the repo layout over a possibly-stale global install — keep the code, fix the comment); drop two candidate paths that can never resolve ('npm prefix -g' joined as an install dir, and an _npx layout that does not match npx's real <hash>/node_modules structure) — zero behavior change; handle child spawn 'error' instead of crashing on an unhandled event. - .mcp.json: pass through XDG_CONFIG_HOME/XDG_DATA_HOME/XDG_STATE_HOME/TMPDIR alongside HOME for Linux/macOS completeness. - README.md: list all four lookup tiers in the troubleshooting section.
…anglei#4449) Hermetic regression tests for the two load-bearing pieces of ranxianglei#4449 that had no coverage: - codex-plugin-version-sync.test.ts: runs the real sync script against a temp fixture — --check must fail (exit 1, naming every drifted file) when the manifests lag package.json, pass when aligned, converge without clobbering untouched manifest fields, stay idempotent, and skip a marketplace with no billion-context entry instead of drifting it. - codex-mcp-shell.test.ts: copies the real shell two levels deep so its repo-layout probe cannot hit a real build — no resolvable entry must exit 1 listing every attempted path, repo layout must win over plugin-dir self, stdio must relay byte-exact from a foreign cwd, and SIGTERM must reach the MCP child (POSIX runners).
(ai: vllm-qwen/qwen3.8-27b) PR #4449 审核结论(外部贡献,按规范直接对齐重构)方向正确、schema 全部核实无误,但原稿的 release 校验门在文档化发布流程下必然失败(回归),另有若干健壮性缺陷。已按「外部提交质量不达标即直接对齐重构」的规范把修复作为 4 个附加 commit 推到了你的分支( 独立验证做了什么(不复述 PR 描述):
结构化八问
行为变更披露(旧值 → 新值,均有原因)
遗留(不在本 PR 范围,供参考)
判定:可合并(人类操作)。等 标签:pr / codex / scope-wiring / p3(功能类非缺陷;p3 = 新增车道,无存量用户受影响,核心风险在发布流程已由门禁兜住)。 |
|
感谢审阅和直接重构,4 个修复 commit 已确认(af8e5dc8)。本地已同步验证:
10 个 workflow 目前都是 action_required(fork PR 首次运行需维护者批准),麻烦帮忙 Approve and run。CI 绿后请直接合并,我不再改动分支。 |
(ai: vllm-qwen/qwen3.8-27b) 收到,你本地那组数字(7 passed / 1 skipped)和预期完全吻合——SIGTERM 转发那条测试按设计只在 POSIX runner 上跑(Windows 的 两件事都帮不上,说明一下原因:
CI 结果出来我这边会自动跟进:任何 lane 红了我会直接定位并修;全绿就等 owner 点合并。分支保持不动即可。 |
📦 Merged Build PublishedThis merge to master was published as npm install -g billion-context@0.0.789-master.751c354 # this exact build
npm install -g billion-context@master # always the newest merged build
|
ranxianglei#4449 added tests/codex-mcp-shell.test.ts and tests/codex-plugin-version-sync.test.ts; both match the SPAWN_RE tripwire but were never registered in scripts/live-files.mjs, so every CI test shard dies at startup before running a single test (red master since 751c354, inherited by all open PRs). Concurrency review required by the tripwire: - codex-mcp-shell.test.ts spawns node MCP-server children over stdio only — no port binding, temp dirs only; - codex-plugin-version-sync.test.ts execFileSyncs sync-codex-plugin-version.mjs against mkdtemp fixtures — no ports. Both are safe under --test-concurrency 4; their zone bands stay unused. Appended per the append-only slot rule in live-files.mjs. Verified by replicating run-ci-tests.mjs's full-set tripwire scan locally. No bili behavior change.
…_FILES Both files landed on master via af8e5dc (#4449) without LIVE_FILES registration, so the run-ci-tests process-spawn tripwire fails every shard of every PR branch (inherited red master, unrelated to this PR's change). Neither binds a port: codex-mcp-shell coordinates its spawned shell child via ENTRY_REPORT_FILE, codex-plugin-version-sync runs execFileSync synchronously. Appended at list end (slot = index).
…tripwire red since #4481 merge)
|
Thanks for reviewing and merging this PR! 🎉 A short note on how this is being used downstream, in case it is useful for future What landed
Verified locally
Observed in the Codex desktop app
One thing worth confirming
Thanks again — happy to pick up any follow-up issues on the Codex side. |
…ane-guard [PR] fix(release): train mode survives pre-#4449 patch lanes
…guard the manifest-sync script call and the manifest git-add (both fatal on lanes cut from tags older than b87732e)
The four plugin manifests (.agents/plugins/marketplace.json, .claude-plugin/marketplace.json + .claude-plugin/plugin.json, plugins/codex/.codex-plugin/plugin.json) sat at 0.1.205 while package.json is 0.1.207 — the #4449 gate (node scripts/sync-codex-plugin-version.mjs --check) fails on master, so any release branch cut now would be rejected by release.yml's pre-tag check, and the Codex/Claude marketplaces have not offered updates since v0.1.206. Run the sync script (no code changes).
…lane, missing-manifest gate, autoFold docs Three unfixed items from the #4725 review ledger (#4757 landed separately via the ci-fixes sweep): - release-bugfix.yml lost the #4449 manifest --check when the v3 lane rewrite landed (v0.1.208 ran it before Publish guard; master's rewrite dropped it). Ported back with the #4576 pre-#4449 lane existence guard, gated on the resolve step's actual proceed output (this variant has no path output). - scripts/sync-codex-plugin-version.mjs silently SKIPPED a missing manifest file — in --check mode a missing file greened the gate, neutering the release guard. A missing target is now a hard error naming the file; the four manifests are a fixed contract. Regression test added (RED on the old skip). - CONFIGURATION.md en+zh: document the autoFold benefit gate (#3444: growth folds arm only on ≥4096 tokens over the effective target; sub-4096 saving arms the backoff; image-dominant exempt) and the measured floor (irreducible baseline raises an unreachable target, never above the window). Both languages in sync. Sync tests 5/5, typecheck clean.
The 0.1.208 carve-out lane shipped off the v0.1.207 tag (storage v8 emergency, #4677) without landing a version bump on master, so master's package.json (0.1.207) no longer equals npm latest (0.1.208) and the one-click release drift guard aborts (run 40520077248, step 'Drift guard'). Version-string sync ONLY: master already carries the 0.1.208 content under its own commits (#4708 for #4677, #4666). Plugin manifests synced via scripts/sync-codex-plugin-version.mjs (#4449) so the publish workflows' --check gate stays green. No code change; branch deliberately does NOT match *_release-v* so merging publishes nothing.
…anxianglei#5430) on top of the reverted flow, with four regressions fixed ranxianglei#5446 ('恢复老的ci release manal') restored the classic pre-flight npm ci + typecheck + build and dropped today's emergency buttons. Owner decision (2026-11-01, incident): keep BOTH — the old full-CI normal path AND the emergency channel. This restores release-manual.yml from 1115455 (the last state that had the channel, i.e. ranxianglei#5430-era workflow) and adds back the single line ranxianglei#5446 kept: npm ci inside the Pre-flight gate. Net effect vs master: A. skip_ci_gate + raw_publish inputs, Raw emergency publish step and all the if-conditions that wire them — back. Emergency = deps download + build + publish, zero CI, no master push, tag + GitHub Release + version-sync PR. B. Full CI dispatch again carries CI_FULL_DISPATCH=1 — direct releases dispatch the COMPLETE lane set at the publish sha, not ci.yml's CORE default (the ranxianglei#3539 windows/node24 gap ranxianglei#5446 reopened). C. Bump version syncs the plugin manifests via scripts/sync-codex-plugin-version.mjs and Verify bump diff accepts them again (ranxianglei#4449). D. job timeout-minutes: 90 is back — a wedged release run can no longer pin the one-click-release concurrency group for hours. E. Drift guard keeps its pending-bump state (ranxianglei#5376) instead of hard-failing whenever master leads npm by one patch. Plus the ranxianglei#5445 fix folded in: on the raw_publish path a master/npm version skew (the state right after emergency publish ranxianglei#1, before its version-sync PR merges) logs a loud audit warning instead of exit 1 — back-to-back emergency publishes work. The duplicate-publish guard (npm version already exists) stays. Verified: YAML parses; inline scripts of Drift guard / Raw emergency publish / Bump version pass bash -n.
背景
上游仓库已经有
.claude-plugin/(Claude Code 生态),但没有 Codex 生态的清单,所以
codex plugin marketplace add ranxianglei/billion-context装下来的插件里没有
.mcp.json,codex mcp list查不到bili,四个上下文工具(compress / decompress / search_context / acp_status)在 Codex 里根本不可用。
这个 PR 补上 Codex 侧的清单与 MCP 外壳,让同一份仓库同时服务两个生态。
为什么用 Git marketplace,而不是 npm 源
Codex 的插件更新检测依赖
PluginSummary.version(源宣告)与localVersion(已装)的差异。实测四种源类型:version字段localnullnpmnull(Codex 不解析 registry 版本)gitremote只有 Git 源有版本推进语义,而且 Codex 内置了
plugins-marketplace-auto-upgrade会后台
git pull。所以 README 和安装脚本都引导用户走codex plugin marketplace add ranxianglei/billion-context。改动
.agents/plugins/marketplace.json(新增)Codex marketplace 清单,指向
./plugins/codex。Codex 的 marketplace 名取自清单的
name字段,所以 marketplace 就叫billion-context。plugins/codex/(新增).codex-plugin/plugin.jsoninterface(显示名/简介/品牌色/默认提示词).mcp.jsonbiliMCP servermcp-server.mjsdist/mcp.js的 stdio 外壳scripts/install.ps1README.mdmcp-server.mjs按优先级找入口:BILI_MCP_ENTRY→ 全局 npm 安装目录 →仓库源码布局 → 插件目录自身。全找不到时把已尝试的路径打到 stderr,而不是
静默失败。
必须 spawn 而不是
import():dist/mcp.js的 stdio 循环只在「作为脚本被直接执行」时启动(
src/mcp.ts:417的 argv 守卫),被 import 时只会导出runMcpStdio,不接管 stdin。scripts/sync-codex-plugin-version.mjs(新增)以
package.json为唯一真相源,同步四份清单的版本号。写这个脚本的直接原因是仓库里已经存在版本漂移:
package.json是0.1.204,而.claude-plugin/还写着
0.1.188—— Codex 侧会因此显示过期版本,永远等不到「有更新」。--check模式供 CI 使用。.github/workflows/release.yml(修改)发布前先
--check校验四份清单与package.json一致,不一致直接让 release失败,避免版本漂移再次进入发布产物。
验证
在 Codex 26.1016(Windows)实测:
codex mcp list出现bilicompress/decompress/search_context/acp_status/acp_cache/acp_read_original_imagecodex plugin marketplace upgrade后已装缓存从1.0.0自动刷新到
2.0.0,插件列表版本同步推进mcp-server.mjs在插件目录 / 根目录 / 用户目录三种 cwd 下都能定位入口并完成MCP 握手
npm run typecheck通过node scripts/sync-codex-plugin-version.mjs --check通过兼容性
src/、dist/、kernel/,不影响现有任何客户端车道plugins/codex/不进 npm 包(package.json的files未改动),只走 Git marketplace 分发
package.json的version(遵循 AGENTS.md §4:版本只在 release分支变更)
已知限制
(
visibleByDefault只对内置code-review开放)。用户手动 pin 一次后会跨启动保留,README 里已说明。
biliCLI 在 PATH 上(README 有排障说明)tools/list报 proxy unreachable;要让压缩真正生效需要
bili start或bili codex