Skip to content

MCP suggestion sampling should fail closed or require explicit opt-in #3405

Description

@Widthdom

Found while dogfooding the current source with the locally built cdidx.

MCP suggestion metadata sampling currently treats unknown or malformed environment values as enabled/defaulted behavior. For metadata emitted through tool responses, the safer behavior is explicit opt-in or fail-closed semantics.

Evidence:

  • src/CodeIndex/McpToolHandlers.cs computes suggestion metadata sampling from env-controlled settings.
  • Unknown values do not clearly disable sampling or warn with a safe diagnostic.

Suggested fix: require an explicit affirmative value for sampling, treat unknown values as disabled, and report a bounded diagnostic so misconfiguration is visible.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions