Skip to content

Reduce MCP review latency via shared changed-file resolution and safe cache invalidation#552

Open
Bakul2006 wants to merge 3 commits into
tirth8205:mainfrom
Bakul2006:MCPSpeedUp
Open

Reduce MCP review latency via shared changed-file resolution and safe cache invalidation#552
Bakul2006 wants to merge 3 commits into
tirth8205:mainfrom
Bakul2006:MCPSpeedUp

Conversation

@Bakul2006

@Bakul2006 Bakul2006 commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Pull Request

Addressed Review Feedback

Thanks for the detailed review. I've updated this PR to address the concerns raised while preserving the original optimization intent of reducing repeated changed-file detection across MCP review workflows.

What changed

  • Added validation for Git refs before subprocess invocation using the existing safe ref checks.

  • Routed changed-file resolution through VCS detection to preserve SVN compatibility.

  • Avoided caching timeout/empty detection results to prevent cache poisoning across subsequent calls.

  • Revisited untracked file handling so newly added files are included in review workflows.

  • Resolved merge conflicts against the latest main.

  • Added focused unit tests covering:

    • cache hit and expiry behaviour,
    • cache invalidation paths,
    • invalid Git refs,
    • timeout handling,
    • SVN compatibility,
    • untracked file handling.

Original intent preserved

This optimization is still designed specifically for short-lived MCP review orchestration bursts where multiple tools execute against effectively identical repository state.

The goal remains to avoid repeated changed-file detection during multi-tool review flows while failing fast when automatic detection is slow.

Validation

  • Rebased/merged with the latest main.
  • Resolved the reported conflicts.
  • Verified the updated test suite after conflict resolution.

Thanks again for the review and guidance. I'd appreciate another pass whenever you have time.

Linked issue

#457

Closes #457

What & why

How it was tested

uv run pytest tests/ --tb=short -q
uv run ruff check code_review_graph/
uv run mypy code_review_graph/ --ignore-missing-imports --no-strict-optional

Checklist

  • Tests added for new functionality
  • All tests pass: uv run pytest tests/ --tb=short -q
  • Linting passes: uv run ruff check code_review_graph/
  • Type checking passes: uv run mypy code_review_graph/ --ignore-missing-imports --no-strict-optional
  • Lines are at most 100 characters
  • Docs updated where behavior changed (README, docs/, docstrings)

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