fix: codex plugin install self-heals drifted [mcp_servers.bili] block (#638) - #652
Open
ranxianglei wants to merge 1 commit into
Open
fix: codex plugin install self-heals drifted [mcp_servers.bili] block (#638)#652ranxianglei wants to merge 1 commit into
ranxianglei wants to merge 1 commit into
Conversation
…#638) The 'already installed' short-circuit only compared the BILI_MCP_PROXY line, so a block whose args/command drifted (e.g. args written as a string instead of an array) was reported as already installed and never rewritten — making the upgrade/reinstall self-heal path a silent no-op. Now the whole block is compared against the canonical one (trailing-whitespace-normalized); only a byte-identical block reports 'already installed', otherwise it is rewritten. Adds a regression test for the malformed-args block.
📦 Built Package ArtifactBranch: Option A — Install from npm PR tag (recommended)npm install -g billion-context@pr-652Each push to this PR publishes a new version under the Option B — Download artifact
tar xzf billion-context-pr652.tgz
npm install -g packageThis comment is automatically updated on each push. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
bili plugin install codexcould not repair an existing malformed[mcp_servers.bili]block. Thealready installedshort-circuit incodexInstall()only compared theBILI_MCP_PROXYenv line:So a block whose
envline matched the current origin but whoseargswas written as a string (instead of an array) — valid TOML, but rejected by codex's schema (invalid type: string, expected a sequence in mcp_servers.bili.args) — was reported asalready installedand left untouched. The upgrade/reinstall self-heal path (the most natural user recovery) was a silent no-op; onlyremove+installfixed it.Fix
already installednow means the whole block matches the canonical one (codexBlock()), compared trailing-whitespace-normalized (handles the block-at-EOF vs block-followed-by-table trailing-newline difference). Only a byte-identical block reportsalready installed; any drift (args / command / origin / path) rewrites the block in place. The rewrite splices the canonical block back without disturbing surrounding tables.This is the "simplest implementation" suggested in the issue: content is deterministic and naturally idempotent.
Tests
tests/plugin-agent.test.ts: a block whose env line matches the origin but whoseargsis a string must berefreshed(args becomes a real array) and then reportalready installedon the next run.argsto an array + real node path → second install is idempotent.Pre-flight
npm run typecheck— cleannpm test— 1239 pass, 1 fail (resolveClientCommand: codex/claude resolve to themselves) — pre-existing on clean master, unrelated to this changenpm run build— successFixes #638