fix: reduced token usage, removed parameters from schema that CLIs never seem to use

This commit is contained in:
Fahad
2025-10-22 13:31:08 +04:00
parent 3efff6056e
commit 3e27319e60
31 changed files with 86 additions and 235 deletions

View File

@@ -38,8 +38,8 @@ class RefactorValidationTest(ConversationBaseTest):
if not self._test_single_refactoring_session():
return False
# Test 2: Refactoring analysis with backtracking
if not self._test_refactoring_with_backtracking():
# Test 2: Refactoring analysis requiring refocus
if not self._test_refactoring_refocus_flow():
return False
# Test 3: Complete refactoring analysis with expert analysis
@@ -389,13 +389,13 @@ class UserData:
self.logger.error(f"Single refactoring session test failed: {e}")
return False
def _test_refactoring_with_backtracking(self) -> bool:
"""Test refactoring analysis with backtracking to revise findings"""
def _test_refactoring_refocus_flow(self) -> bool:
"""Test refactoring analysis that shifts focus mid-investigation"""
try:
self.logger.info(" 1.2: Testing refactoring analysis with backtracking")
self.logger.info(" 1.2: Testing refactoring analysis refocus workflow")
# Start a new refactoring analysis for testing backtracking
self.logger.info(" 1.2.1: Start refactoring analysis for backtracking test")
# Start a new refactoring analysis for testing refocus behaviour
self.logger.info(" 1.2.1: Start refactoring analysis for refocus test")
response1, continuation_id = self.call_mcp_tool(
"refactor",
{
@@ -412,7 +412,7 @@ class UserData:
)
if not response1 or not continuation_id:
self.logger.error("Failed to start backtracking test refactoring analysis")
self.logger.error("Failed to start refocus test refactoring analysis")
return False
# Step 2: Wrong direction
@@ -437,11 +437,11 @@ class UserData:
return False
# Step 3: Backtrack from step 2
self.logger.info(" 1.2.3: Step 3 - Backtrack and focus on function decomposition")
self.logger.info(" 1.2.3: Step 3 - Refocus on function decomposition")
response3, _ = self.call_mcp_tool(
"refactor",
{
"step": "Backtracking - the real decomposition opportunity is the god function process_everything. Let me analyze function-level refactoring instead.",
"step": "Refocusing - the real decomposition opportunity is the god function process_everything. Let me analyze function-level refactoring instead.",
"step_number": 3,
"total_steps": 4,
"next_step_required": True,
@@ -462,13 +462,12 @@ class UserData:
},
],
"confidence": "partial",
"backtrack_from_step": 2, # Backtrack from step 2
"continuation_id": continuation_id,
},
)
if not response3:
self.logger.error("Failed to backtrack")
self.logger.error("Failed to refocus")
return False
response3_data = self._parse_refactor_response(response3)
@@ -477,11 +476,11 @@ class UserData:
):
return False
self.logger.info("Backtracking working correctly for refactoring analysis")
self.logger.info("Refocus working correctly for refactoring analysis")
return True
except Exception as e:
self.logger.error(f"Refactoring backtracking test failed: {e}")
self.logger.error(f"Refocusing test failed: {e}")
return False
def _test_complete_refactoring_with_analysis(self) -> bool: