Skip to content

fix(paths): return repository-relative paths for local sources - #133

Merged
spelech merged 2 commits into
mainfrom
fix/local-source-relative-paths
Nov 12, 2026
Merged

spelech merged 2 commits into
mainfrom
fix/local-source-relative-paths

Conversation

@spelech

@spelech spelech commented Nov 12, 2026

Copy link
Copy Markdown
Owner

Problem

A folder can be a local source (a row in indexed_paths). For a local source, the index keeps the absolute disk path of each file. Git sources keep repo://relative/path.

Some tools returned the stored path without the source root:

  • find_symbol, get_file_outline, trace_path, find_routes, and find_api_callers returned the absolute disk path (for example C:/Development/TEMP/claude/debug-eval/hub-prefix/server/X.cs).
  • diagnose_issue returned the disk path without its drive (for example Development/TEMP/claude/debug-eval/hub-prefix/server/X.cs).

read_file and grep_code take the path relative to the source root (server/X.cs). Thus an agent had to change each path by hand.

Fix

  • Add app/services/source_paths.py with the LocalSourceRoots class. It reads the indexed_paths roots once for each tool call. It removes the root from a stored absolute path. It removes the repo:// prefix from a stored Git path. When local sources are nested, the longest root applies. The comparison ignores letter case and the slash type.
  • Use this class in find_symbol, get_file_outline, find_routes, find_api_callers, trace_path, and diagnose_issue (resolved frames, callers, callees, matched routes, and matched symbols).
  • In diagnostics.py, change only the lines that make the output file values. The frame and symbol matching does not change.
  • search_code already used the relative rel_path from the vector payload. It does not change.
  • The stored data does not change. A re-index is not necessary.
  • Update docs/mcp-tools-and-resources.md.

Tests

  • Add tests/test_local_source_relative_paths.py. The test puts a local source with Windows paths and a Git source into a SQLite database. It makes sure that each tool returns server/... paths for the local source and src/... paths for the Git source.
  • Without the fix, 6 of the 16 tests fail. With the fix, all 16 tests pass.
  • The full test suite has no new failures when compared with origin/main.

🤖 Generated with Claude Code

Steve Pelech and others added 2 commits November 12, 2026 15:35
@spelech
spelech merged commit 5a58141 into main Nov 12, 2026
15 checks passed
@spelech
spelech deleted the fix/local-source-relative-paths branch November 12, 2026 21:53
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