Skip to content

fix(mcp): ignore bare sanitized OpenCode server prefixes - #3727

Merged
dyoshikawa merged 2 commits into
dyoshikawa:mainfrom
521Peter:fix/opencode-bare-prefix-nov02
Nov 3, 2026
Merged

dyoshikawa merged 2 commits into
dyoshikawa:mainfrom
521Peter:fix/opencode-bare-prefix-nov02

Conversation

@521Peter

@521Peter 521Peter commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

Addresses the bare sanitized-prefix import bug in #3725 (item 2).

With server a.b and tools: { a_b_: false }, import currently creates a transport-less server a with disabledTools: ["b_"]. The owner lookup requires a nonempty tool suffix, and the orphan fallback only recognizes raw server prefixes.

Exclude an exact sanitized server prefix before the orphan fallback. Valid tool filters and filters for genuinely unlisted servers still import normally. This is independent of #3723; the other comment/docs follow-ups in #3725 remain open.

The regression matrix covers OpenCode, OpenCode V1 and MiMo Code, project/global scope, raw/sanitized server names, and the flat/V2 server envelope where supported. It checks the complete imported object, including preservation of valid allows, denies and orphan filters.

Validation:

  • New tests against the unchanged implementation: 10 failed / 173 passed, reproducing the phantom-server bug.
  • Focused suite after the fix: 183 passed.
  • VITEST_MAX_WORKERS=2 pnpm cicheck: formatting, lint, type checking, all 605 test files (16,398 passed, 4 skipped), generated content, spelling and secret checks passed.
  • pnpm build: passed; existing unrelated ineffective dynamic import warning.

Earlier runs hit unrelated cleanup/test timeouts and worker startup timeouts. The complete check passed with two workers while keeping the machine awake; no test timeouts or repository configuration were changed.

Implemented with assistance from OpenAI Codex. I reviewed the diff and verified the failing baseline and checks locally.

…ith dyoshikawa#3723

Keep both new test blocks in opencode-mcp.test.ts. In opencode-mcp.ts,
merge the two comments above the orphan pre-filter: dyoshikawa#3723 called the raw
second pass redundant, which no longer holds once bare sanitized prefixes
are dropped here, so the comment now says what each pass catches.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0179ZomNiDQHCzgoxeRVmfth
@dyoshikawa
dyoshikawa merged commit 74f5fb6 into dyoshikawa:main Nov 3, 2026
6 checks passed
@dyoshikawa

Copy link
Copy Markdown
Owner

@521Peter Thank you! I merged main to resolve conflicts with #3723 and tracked a few non-blocking follow-ups in #3728.

@521Peter

521Peter commented Nov 3, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for merging and resolving the conflict with #3723! I saw the follow-ups in #3728.

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.

2 participants