Skip to content

Task-specific query tools use wrong cache key, always get GRAPH_NOT_CACHED #97

@robotson

Description

@robotson

Bug

find_definition, find_call_sites, trace_call_chain, and trace_data_flow all fail with GRAPH_NOT_CACHED even after explore_codebase has successfully generated and cached a graph.

Root Cause

Cache key mismatch between explore_codebase and the task-specific query tools.

explore_codebase stores the graph using generateIdempotencyKey() from api-helpers.ts:

{repoName}-{pathHash}:{graphType}:{gitHash}{statusHash}
# e.g. "workspace-8af22c4:supermodel:d16bfe05a7-6a95220"

find_definition et al. look it up using getCacheKey() in each tool file:

function getCacheKey(path: string): string {
  return `cache_${path}`;
}
// e.g. "cache_/workspace"

These keys never match. The graph is in memory but the query tools can't find it.

Reproduction

  1. Start the MCP server
  2. Call explore_codebase with query: "summary" on a repo — succeeds, returns graph with source: "api"
  3. Call explore_codebase with query: "domain_map" — succeeds, source: "cache" (graph is cached)
  4. Call find_definition with path and name — fails: GRAPH_NOT_CACHED

Observed in a local mcpbr trial run against swe-bench-verified (astropy__astropy-12907). Logs available.

Impact

All four task-specific query tools are effectively broken in the current release (v0.8.0). This affects the ongoing full SWE-bench Verified run — any agent that calls explore_codebase first and then tries to use query tools will hit this error. The agent in our trial run pivoted to Grep/Read after the failure, but the query tools provided zero value.

Fix

The query tools should use generateIdempotencyKey() from api-helpers.ts instead of their local getCacheKey() function. All tools should share a single cache key generation mechanism.

Affected Files

  • src/tools/find-definition.ts (lines ~192-194)
  • src/tools/find-call-sites.ts (same pattern)
  • src/tools/trace-call-chain.ts (same pattern)
  • src/tools/trace-data-flow.ts (same pattern)

Same issue exists in mcp-task-specific-tools repo.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions