Skip to content

fix: make get_minimal_context_tool async via asyncio.to_thread#394

Open
sdeonvacation wants to merge 7 commits intotirth8205:mainfrom
sdeonvacation:fix/get-minimal-context-async
Open

fix: make get_minimal_context_tool async via asyncio.to_thread#394
sdeonvacation wants to merge 7 commits intotirth8205:mainfrom
sdeonvacation:fix/get-minimal-context-async

Conversation

@sdeonvacation
Copy link
Copy Markdown
Contributor

Summary

  • Offloads blocking git-diff + BFS traversal work in get_minimal_context_tool to a thread via asyncio.to_thread, preventing event-loop blocking on large repos
  • Adds get_minimal_context_tool to HEAVY_TOOLS coverage in TestLongRunningToolsAreAsync

Motivation

get_minimal_context_tool was the last high-traffic tool missing the asyncio.to_thread wrapper already applied to other blocking tools (see #136, #46). Without this fix, large-repo calls block the MCP stdio event loop.

Changes

  • code_review_graph/main.py: wrap get_minimal_context_tool handler body in asyncio.to_thread
  • tests/test_main.py: include get_minimal_context_tool in HEAVY_TOOLS list

Prevents event-loop blocking on large repos by offloading the
blocking git-diff + BFS work to a thread. Updates TestLongRunningToolsAreAsync
to include get_minimal_context_tool in HEAVY_TOOLS coverage.
…text-async

# Conflicts:
#	code_review_graph/main.py
Revert all parameter reflow, blank line churn, and non-semantic
formatting introduced by earlier merge/fix commits. Keep only:
- import sort (ruff I001 fix)
- async def get_minimal_context_tool
- await asyncio.to_thread wrapper + docstring
- show_banner=False assertion
- get_minimal_context_tool in heavy-tools set
@sdeonvacation
Copy link
Copy Markdown
Contributor Author

The failing PR checks fail in upstream as well.

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