Skip to content

fold_ready degradation context missing in MCP status #1973

Description

@Widthdom

Summary

When fold_ready=false, the CLI status command populates degraded_reason, recommended_action, and alternative_action via BuildFoldNotReadyExplanation() (src/CodeIndex/Cli/QueryCommandRunner.cs:1644-1648). The MCP status tool (src/CodeIndex/Mcp/McpToolHandlers.cs:937-954) does not mirror this logic — it only emits hotspotFamilyDegradedReason and sqlGraphContractDegradedReason. So MCP clients see the readiness bit drop but receive no actionable explanation. CLI vs MCP signal asymmetry.

Where

  • src/CodeIndex/Cli/QueryCommandRunner.cs:1644-1648 (CLI fold-degradation explanation)
  • src/CodeIndex/Mcp/McpToolHandlers.cs:937-954 (ExecuteStatus — fold context missing)
  • src/CodeIndex/Models/QueryResults.cs:331-344 (StatusResult fields defined but partially populated)

Suggested approach

  1. Extract the fold-degradation reason logic (BuildFoldNotReadyExplanation, BuildFoldBackfillCommand, etc.) into a shared helper module reachable from both CLI and MCP.
  2. In McpToolHandlers.ExecuteStatus(), after the hotspot/sql population, populate the symmetric fold fields when fold_ready is false.
  3. Consider introducing a nested FoldSignal record parallel to the existing HotspotFamilySignal / SqlGraphContractSignal for shape parity.
  4. Add an integration test comparing CLI status --json and MCP status response: assert identical degradation metadata for a fold-degraded fixture DB.
  5. Document the readiness signal contract once in DEVELOPER_GUIDE.md so both paths reference one source of truth.
  6. Update the status-contract section of CLAUDE.md / AGENTS.md to mention the parity requirement.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions