fix: ensure review_changes properly translates both path and files for Docker

- 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 <noreply@anthropic.com>
This commit is contained in:
Fahad
2025-06-10 09:56:20 +04:00
parent 483ae7dd6d
commit af68e8bf7c

View File

@@ -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), "