Skip to content

Expose enableConfigDiscovery in all SDK languages#1044

Merged
stephentoub merged 2 commits intomainfrom
stephentoub/expose-enableconfigdiscovery
Apr 8, 2026
Merged

Expose enableConfigDiscovery in all SDK languages#1044
stephentoub merged 2 commits intomainfrom
stephentoub/expose-enableconfigdiscovery

Conversation

@stephentoub
Copy link
Copy Markdown
Collaborator

Motivation

The Copilot runtime already supports enableConfigDiscovery in its session create/resume protocol (resolveDiscoveredConfig() in src/core/server.ts), but none of the SDK languages exposed it. SDK consumers had no way to opt into automatic discovery of MCP servers and skill directories from the working directory.

Approach

Added enableConfigDiscovery as an optional boolean to session config types across all four SDKs, following the same patterns used by neighboring options like configDir. The property is passed through to the runtime on both session.create and session.resume RPC calls.

Per SDK:

  • Node.js — Added to SessionConfig interface, included in ResumeSessionConfig pick type, passed in both createSession and resumeSession
  • Python — Added enable_config_discovery parameter to create_session() and resume_session() with docstrings and payload serialization
  • Go — Added to SessionConfig, ResumeSessionConfig, both wire request structs, and passthrough in CreateSession/ResumeSessionWithOptions
  • .NET — Added to SessionConfig, ResumeSessionConfig (properties + clone constructors), both wire request records, and passthrough in create/resume

What it does

When enableConfigDiscovery is true, the runtime scans the working directory for:

  • MCP server configurations (.mcp.json, .vscode/mcp.json, etc.)
  • Skill directories from convention paths
  • Installed plugins and disabled skills from CLI config
  • Built-in GitHub MCP server (injected automatically)

Discovered values are merged with any explicitly provided mcpServers and skillDirectories, with explicit values taking precedence on name collision.

Note: Custom instruction files (.github/copilot-instructions.md, AGENTS.md, etc.) are loaded via a separate codepath and are always active regardless of this setting.

Validation

  • TypeScript type-check passes (tsc --noEmit)
  • Go builds and vets cleanly (go build ./..., go vet ./...)
  • .NET builds and all 13 unit tests pass (including clone tests)

Add enableConfigDiscovery option to session config types in Node.js,
Python, Go, and .NET SDKs. When set to true, the runtime automatically
discovers MCP server configurations (.mcp.json, .vscode/mcp.json) and
skill directories from the working directory, merging them with any
explicitly provided values (explicit takes precedence on name collision).

This surfaces a capability already implemented in copilot-agent-runtime's
resolveDiscoveredConfig() for SDK consumers.

Changes per SDK:
- Node.js: SessionConfig + ResumeSessionConfig pick + client passthrough
- Python: create_session/resume_session params + payload serialization
- Go: config structs + wire request structs + client passthrough
- .NET: config classes + clone constructors + wire records + client passthrough

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings April 8, 2026 15:16
@stephentoub stephentoub requested a review from a team as a code owner April 8, 2026 15:16
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR exposes the enableConfigDiscovery session option across the Node.js, Python, Go, and .NET SDKs so consumers can opt into automatic discovery/merging of MCP server configs and skill directories during session.create and session.resume.

Changes:

  • Added an optional enableConfigDiscovery / enable_config_discovery setting to each SDK’s public session configuration surface.
  • Plumbed the option through to the JSON-RPC session.create and session.resume request payloads.
  • Updated API docs/comments (TS JSDoc, Python docstrings, Go/.NET XML comments) to describe the behavior and interactions with explicit mcpServers / skillDirectories.
Show a summary per file
File Description
python/copilot/client.py Adds enable_config_discovery kwarg to create_session / resume_session and serializes it to enableConfigDiscovery.
nodejs/src/types.ts Adds enableConfigDiscovery?: boolean to SessionConfig and includes it in ResumeSessionConfig.
nodejs/src/client.ts Forwards enableConfigDiscovery in both session.create and session.resume RPC payloads.
go/types.go Adds EnableConfigDiscovery to session config structs and the wire request structs.
go/client.go Forwards EnableConfigDiscovery into create/resume request payloads when enabled.
dotnet/src/Types.cs Adds EnableConfigDiscovery to SessionConfig / ResumeSessionConfig and ensures clone constructors copy it.
dotnet/src/Client.cs Forwards EnableConfigDiscovery in create/resume wire request records.

Copilot's findings

Comments suppressed due to low confidence (3)

nodejs/src/client.ts:878

  • Add/extend tests to verify enableConfigDiscovery is forwarded in the session.resume RPC payload. Existing tests already capture/inspect sendRequest params for other forwarded options, but this new field isn’t exercised.
                hooks: !!(config.hooks && Object.values(config.hooks).some(Boolean)),
                workingDirectory: config.workingDirectory,
                configDir: config.configDir,
                enableConfigDiscovery: config.enableConfigDiscovery,
                streaming: config.streaming,

python/copilot/client.py:1612

  • Add a unit test that exercises enable_config_discovery and asserts the outgoing session.resume payload includes enableConfigDiscovery (mirroring existing forwarding tests for other fields).
        if config_dir:
            payload["configDir"] = config_dir
        if enable_config_discovery is not None:
            payload["enableConfigDiscovery"] = enable_config_discovery

dotnet/src/Types.cs:1835

  • The clone-copy tests for ResumeSessionConfig should be extended to include the new EnableConfigDiscovery property so the new field is covered alongside the other properties verified by clone tests.
        DisabledSkills = other.DisabledSkills is not null ? [.. other.DisabledSkills] : null;
        DisableResume = other.DisableResume;
        EnableConfigDiscovery = other.EnableConfigDiscovery;
        ExcludedTools = other.ExcludedTools is not null ? [.. other.ExcludedTools] : null;
  • Files reviewed: 7/7 changed files
  • Comments generated: 3

@github-actions

This comment has been minimized.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 8, 2026

Cross-SDK Consistency Review ✅

This PR does an excellent job of implementing enableConfigDiscovery consistently across all four SDK languages. Here's a summary of what was verified:

Implementation Consistency

SDK Public type Create Resume Wire key
Node.js enableConfigDiscovery?: boolean ✅ (via Pick) enableConfigDiscovery
Python enable_config_discovery: bool | None enableConfigDiscovery
Go EnableConfigDiscovery bool enableConfigDiscovery
.NET public bool? EnableConfigDiscovery enableConfigDiscovery
  • All four SDKs use the correct language naming convention (camelCase / snake_case / PascalCase)
  • All four wire the field in both createSession/create_session/CreateSession/CreateSessionAsync and resumeSession/resume_session/ResumeSessionWithOptions/ResumeSessionAsync
  • All send the identical JSON key "enableConfigDiscovery" to the runtime
  • All include documentation/docstrings with consistent descriptions
  • Clone constructors in .NET are updated for both SessionConfig and ResumeSessionConfig

Minor Documentation Gap (optional follow-up)

docs/features/session-persistence.md has a "Resume Options" table (around line 236–252) listing configDir, mcpServers, skillDirectories, etc., but enableConfigDiscovery isn't there. Since this feature is particularly relevant on resume (re-discovering local configs), it would be worth a one-liner addition to that table:

| `enableConfigDiscovery` | Auto-discover MCP servers and skill directories from working directory |

Similarly, docs/features/mcp.md could benefit from a brief mention of the auto-discovery option as an alternative to listing servers explicitly. Neither of these is blocking — just a heads-up for a follow-up commit or PR.

Overall the cross-SDK implementation is clean and well-done. 👍

Generated by SDK Consistency Review Agent for issue #1044 ·

@stephentoub stephentoub added this pull request to the merge queue Apr 8, 2026
Merged via the queue into main with commit 6029b37 Apr 8, 2026
35 checks passed
@stephentoub stephentoub deleted the stephentoub/expose-enableconfigdiscovery branch April 8, 2026 16:13
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.

3 participants