Skip to content

Fix copilot --mcp-config injection and repo_info facade mismatch - #39

Merged
nananek merged 1 commit into
masterfrom
fix/mcp-config-copilot-and-repo-info
Aug 11, 2026
Merged

Fix copilot --mcp-config injection and repo_info facade mismatch#39
nananek merged 1 commit into
masterfrom
fix/mcp-config-copilot-and-repo-info

Conversation

@nananek

@nananek nananek commented Aug 11, 2026

Copy link
Copy Markdown
Owner

Fixes two bugs reported against the current server.

Bug A: copilot launch fails with error: unknown option '--mcp-config'

buildMcpConfigArgsAndEnv() only branched on opencode; every other app (copilot included) fell into the claude-style else branch that assembles --mcp-config <JSON>. A standalone copilot session with notify enabled reached it via sessionManager.jsshouldInjectNotify() returning true for standalone agents → the flag was passed to the copilot binary, which errors out.

  • server/ws/mcpConfig.js: explicit copilot branch returning { args: [], env: {} } — the function is the single assembly point, so no copilot launch path can ever receive --mcp-config.
  • server/ws/notify.js: shouldInjectNotify() now excludes copilot (it has no CLI-arg/env MCP injection, so the notify server would be unreachable; also avoids binding the notify socket into its sandbox).
  • Group paths already refused copilot (POST /groups, addMember, open_tab enum) and are unchanged.

Bug B: ccserver_repo_info fails with deps.groupManager.getGroup is not a function

repoInfo() called deps.groupManager.getGroup(), but production deps pass the deliberately narrow groupManagerApi facade (groupManager.js) which never included getGroup — only group.cwd was needed. Unit tests passed the full module namespace, so the mismatch went unnoticed since repo_info was introduced (05bb3bc).

  • server/ws/groupManager.js: added getGroupCwd(groupId) to the facade (returns group?.cwd ?? null), keeping the raw group object (controlBroker socket paths, handoff channels, etc.) out of LLM-facing reach.
  • server/ws/mcpTools.js: repoInfo() now reads deps.groupManager.getGroupCwd(deps.groupId).

Tests

+6 unit tests: copilot gets no injection (plain / notify sandbox / notify host), shouldInjectNotify excludes copilot, and repoInfo regression tests against the production facade shape (no getGroup).
npm test: 300 tests, 299 pass — the single failure (sandbox-resolve.test.js) is a pre-existing environment-dependent failure unrelated to this change.

Bug A: copilot has no CLI-arg/env MCP injection, so buildMcpConfigArgsAndEnv
must never assemble one -- the claude-style else branch was emitting
'--mcp-config <JSON>' for copilot standalone sessions, making the binary die
with 'unknown option'. Add an explicit copilot branch returning empty
args/env (the function is the single assembly point, so no launch path can
inject), and exclude copilot in shouldInjectNotify (no notify-server
injection either).

Bug B: repo_info called deps.groupManager.getGroup, but production broker
deps carry the narrow groupManagerApi facade which never exposed getGroup --
crashing every repo_info call with 'getGroup is not a function'. Add
getGroupCwd to the facade (cwd only, keeping the internal group object out
of LLM reach) and switch repoInfo to it; group-not-found behavior preserved.

Tests: copilot injection-empty cases (mcpConfig), copilot shouldInjectNotify
exclusion (notify), repo_info against the production facade shape incl.
group-not-found (mcpTools). Full suite: 299 pass / 1 pre-existing
environment-dependent sandbox-resolve failure.
@nananek
nananek merged commit defdb71 into master Aug 11, 2026
4 checks passed
nananek added a commit that referenced this pull request Aug 11, 2026
master が PR #39 で同一の repo_info facade 問題を別設計 (getGroupCwd:
group 内部を露出せず cwd のみ返す) で先行修正済みのため、マージでその
設計を採用。facade への getGroup 追加を撤去し、plan のフェーズ1を
追記更新。BUN_TMPDIR (PR #41) / notify 属性・規律 (PR #37-40) も取り込み。
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.

1 participant