From af68e8bf7c0b67ade4030adc1d2556382e950172 Mon Sep 17 00:00:00 2001 From: Fahad Date: Tue, 10 Jun 2025 09:56:20 +0400 Subject: [PATCH] fix: ensure review_changes properly translates both path and files for Docker MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Added explicit translation of files parameter using translate_file_paths() - Now both path and files parameters are properly translated for Docker environments - Ensures consistent behavior between dockerized and normal installations - Updated all references to use translated_files consistently This fixes the bug where files parameter wasn't being explicitly translated, even though resolve_and_validate_path was handling it internally. The explicit translation makes the behavior clear and consistent with path translation. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- tools/review_changes.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/tools/review_changes.py b/tools/review_changes.py index 6a7b748..cadfcf9 100644 --- a/tools/review_changes.py +++ b/tools/review_changes.py @@ -10,7 +10,7 @@ from pydantic import Field from config import MAX_CONTEXT_TOKENS from prompts.tool_prompts import REVIEW_CHANGES_PROMPT -from utils.file_utils import read_files, translate_path_for_environment +from utils.file_utils import read_files, translate_file_paths, translate_path_for_environment from utils.git_utils import find_git_repositories, get_git_status, run_git_command from utils.token_utils import estimate_tokens @@ -134,8 +134,9 @@ class ReviewChanges(BaseTool): if updated_files is not None: request.files = updated_files - # Translate the path if running in Docker + # Translate the path and files if running in Docker translated_path = translate_path_for_environment(request.path) + translated_files = translate_file_paths(request.files) # Check if the path translation resulted in an error path if translated_path.startswith("/inaccessible/"): @@ -280,18 +281,18 @@ class ReviewChanges(BaseTool): context_files_summary = [] context_tokens = 0 - if request.files: + if translated_files: remaining_tokens = max_tokens - total_tokens # Use standardized file reading with token budget file_content = read_files( - request.files, max_tokens=remaining_tokens, reserve_tokens=1000 # Small reserve for formatting + translated_files, max_tokens=remaining_tokens, reserve_tokens=1000 # Small reserve for formatting ) if file_content: context_tokens = estimate_tokens(file_content) context_files_content = [file_content] - context_files_summary.append(f"✅ Included: {len(request.files)} context files") + context_files_summary.append(f"✅ Included: {len(translated_files)} context files") else: context_files_summary.append("⚠️ No context files could be read or files too large") @@ -377,7 +378,7 @@ class ReviewChanges(BaseTool): ) # Add instruction for requesting files if needed - if not request.files: + if not translated_files: prompt_parts.append( "\nIf you need additional context files to properly review these changes " "(such as configuration files, documentation, or related code), "