Clear python cache when running script: https://github.com/BeehiveInnovations/zen-mcp-server/issues/96
Improved retry error logging
Cleanup
This commit is contained in:
Fahad
2025-06-21 05:56:50 +04:00
parent 76edd30e9a
commit 6fa2d63eac
14 changed files with 141 additions and 154 deletions

View File

@@ -167,7 +167,7 @@ This happens every time a user tries to log in. The error occurs in the password
return False
response1_data = self._parse_debug_response(response1)
if not self._validate_investigation_response(response1_data, 1, True, "investigation_in_progress"):
if not self._validate_investigation_response(response1_data, 1, True, "pause_for_investigation"):
return False
self.logger.info(f" ✅ Step 1 successful, continuation_id: {continuation_id}")
@@ -184,7 +184,7 @@ This happens every time a user tries to log in. The error occurs in the password
"findings": "Missing 'import hashlib' statement at the top of user_auth.py file. The error occurs because hashlib is used in hash_password() method on line 12 but never imported. Simple one-line fix: add 'import hashlib' after line 2.",
"files_checked": [self.error_log_file, self.missing_import_file],
"relevant_files": [self.missing_import_file],
"relevant_methods": ["UserAuth.hash_password", "UserAuth.verify_password"],
"relevant_context": ["UserAuth.hash_password", "UserAuth.verify_password"],
"hypothesis": "Missing 'import hashlib' statement causes NameError when hash_password method executes",
"confidence": "certain", # Use certain - should skip expert analysis
"continuation_id": continuation_id,
@@ -264,7 +264,7 @@ This happens every time a user tries to log in. The error occurs in the password
"findings": "After thorough investigation, identified that the issue is caused by method name typo in Calculator.calculate_total() - calls self.add_number() instead of self.add_numbers(). Simple fix: change line 14 from 'add_number' to 'add_numbers'.",
"files_checked": [self.typo_bug_file],
"relevant_files": [self.typo_bug_file],
"relevant_methods": ["Calculator.calculate_total", "Calculator.add_numbers"],
"relevant_context": ["Calculator.calculate_total", "Calculator.add_numbers"],
"hypothesis": "Method name typo in calculate_total() calls non-existent add_number() instead of add_numbers()",
"confidence": "certain", # Should always be trusted
"model": "flash",
@@ -318,7 +318,7 @@ This happens every time a user tries to log in. The error occurs in the password
"findings": "IndentationError in data_processor.py line 8 - results.append(processed) is incorrectly indented. Should align with the 'if' statement above it.",
"files_checked": [self.indentation_file],
"relevant_files": [self.indentation_file],
"relevant_methods": ["process_data"],
"relevant_context": ["process_data"],
"hypothesis": "Incorrect indentation causes IndentationError in process_data function",
"confidence": "high", # Regular high confidence, NOT certain
"model": "flash",
@@ -400,7 +400,7 @@ This happens every time a user tries to log in. The error occurs in the password
"findings": "Found the issue: line 8 'results.append(processed)' is indented incorrectly. It should align with the 'if' statement, not be at the same level as the 'for' loop.",
"files_checked": [self.indentation_file],
"relevant_files": [self.indentation_file],
"relevant_methods": ["process_data"],
"relevant_context": ["process_data"],
"hypothesis": "Line 8 has incorrect indentation level causing IndentationError",
"confidence": "medium",
"continuation_id": continuation_id,
@@ -423,7 +423,7 @@ This happens every time a user tries to log in. The error occurs in the password
"findings": "Confirmed: line 8 'results.append(processed)' needs to be indented 4 more spaces to align with line 6 'if item > 0:'. This is a simple indentation fix.",
"files_checked": [self.indentation_file],
"relevant_files": [self.indentation_file],
"relevant_methods": ["process_data"],
"relevant_context": ["process_data"],
"hypothesis": "IndentationError on line 8 due to incorrect indentation level - needs 4 more spaces",
"confidence": "certain", # Final step with certain
"continuation_id": continuation_id,
@@ -455,10 +455,10 @@ This happens every time a user tries to log in. The error occurs in the password
self.logger.error("Expected at least 1 step in complete investigation")
return False
# Check that investigation summary includes progression
investigation_summary = complete_investigation.get("investigation_summary", "")
if "Total steps:" not in investigation_summary and "Steps taken:" not in investigation_summary:
self.logger.error("Investigation summary should show steps information")
# Check that work summary includes progression
work_summary = complete_investigation.get("work_summary", "")
if "Total steps:" not in work_summary and "Steps taken:" not in work_summary:
self.logger.error("Work summary should show steps information")
return False
self.logger.info(" ✅ Multi-step investigation with certain ending successful")

View File

@@ -191,7 +191,7 @@ RuntimeError: dictionary changed size during iteration
"findings": "Found the issue: cleanup_expired_sessions modifies self.active_sessions dictionary while iterating over it with .items(). This causes RuntimeError when del is called during iteration.",
"files_checked": [self.error_file, self.buggy_file],
"relevant_files": [self.buggy_file],
"relevant_methods": ["SessionManager.cleanup_expired_sessions"],
"relevant_context": ["SessionManager.cleanup_expired_sessions"],
"hypothesis": "Dictionary is being modified during iteration causing RuntimeError",
"confidence": "high",
"continuation_id": continuation_id,
@@ -212,8 +212,8 @@ RuntimeError: dictionary changed size during iteration
self.logger.error("Files checked count not properly tracked")
return False
if investigation_status.get("relevant_methods", 0) != 1:
self.logger.error("Relevant methods not properly tracked")
if investigation_status.get("relevant_context", 0) != 1:
self.logger.error("Relevant context not properly tracked")
return False
if investigation_status.get("current_confidence") != "high":
@@ -288,7 +288,7 @@ RuntimeError: dictionary changed size during iteration
"findings": "Found inefficient nested loops in data processor causing O(n²) complexity",
"files_checked": ["/processor/algorithm.py"],
"relevant_files": ["/processor/algorithm.py"],
"relevant_methods": ["DataProcessor.process_batch"],
"relevant_context": ["DataProcessor.process_batch"],
"hypothesis": "Inefficient algorithm causing performance issues",
"confidence": "medium",
"backtrack_from_step": 2, # Backtrack from step 2
@@ -331,7 +331,7 @@ RuntimeError: dictionary changed size during iteration
"findings": "Found dictionary modification during iteration",
"files_checked": [self.buggy_file],
"relevant_files": [self.buggy_file],
"relevant_methods": ["SessionManager.cleanup_expired_sessions"],
"relevant_context": ["SessionManager.cleanup_expired_sessions"],
},
)
if not response0 or not continuation_id:
@@ -350,7 +350,7 @@ RuntimeError: dictionary changed size during iteration
"findings": "Root cause identified: del self.active_sessions[session_id] on line 46 modifies dictionary during iteration starting at line 44. Fix: collect expired IDs first, then delete.",
"files_checked": [self.buggy_file],
"relevant_files": [self.buggy_file],
"relevant_methods": ["SessionManager.cleanup_expired_sessions"],
"relevant_context": ["SessionManager.cleanup_expired_sessions"],
"hypothesis": "Dictionary modification during iteration causes RuntimeError in cleanup_expired_sessions",
"confidence": "high",
"continuation_id": continuation_id,
@@ -404,11 +404,11 @@ RuntimeError: dictionary changed size during iteration
return False
complete_investigation = response_final_data["complete_investigation"]
if not complete_investigation.get("relevant_methods"):
self.logger.error("Missing relevant methods in complete investigation")
if not complete_investigation.get("relevant_context"):
self.logger.error("Missing relevant context in complete investigation")
return False
if "SessionManager.cleanup_expired_sessions" not in complete_investigation["relevant_methods"]:
if "SessionManager.cleanup_expired_sessions" not in complete_investigation["relevant_context"]:
self.logger.error("Expected method not found in investigation summary")
return False
@@ -436,7 +436,7 @@ RuntimeError: dictionary changed size during iteration
"findings": "The bug is on line 44-47: for loop iterates over dict.items() while del modifies the dict inside the loop. Fix is simple: collect expired IDs first, then delete after iteration.",
"files_checked": [self.buggy_file],
"relevant_files": [self.buggy_file],
"relevant_methods": ["SessionManager.cleanup_expired_sessions"],
"relevant_context": ["SessionManager.cleanup_expired_sessions"],
"hypothesis": "Dictionary modification during iteration causes RuntimeError - fix is straightforward",
"confidence": "certain", # This should skip expert analysis
"model": "flash",
@@ -604,7 +604,7 @@ def validate_input(data):
"findings": "Initial analysis of data processing components",
"files_checked": [file1, file2],
"relevant_files": [file1], # This should be referenced, not embedded
"relevant_methods": ["process_data"],
"relevant_context": ["process_data"],
"hypothesis": "Investigating data flow",
"confidence": "low",
"model": "flash",
@@ -644,7 +644,7 @@ def validate_input(data):
"findings": "Found potential issues in validation logic",
"files_checked": [file1, file2],
"relevant_files": [file1, file2], # Both files referenced
"relevant_methods": ["process_data", "validate_input"],
"relevant_context": ["process_data", "validate_input"],
"hypothesis": "Validation might be too strict",
"confidence": "medium",
"model": "flash",
@@ -690,7 +690,7 @@ def validate_input(data):
"findings": "Root cause: validator is rejecting valid data due to strict type checking",
"files_checked": [file1, file2],
"relevant_files": [file1, file2], # Should be fully embedded
"relevant_methods": ["process_data", "validate_input"],
"relevant_context": ["process_data", "validate_input"],
"hypothesis": "Validation logic is too restrictive for valid edge cases",
"confidence": "high",
"model": "flash",
@@ -797,7 +797,7 @@ class DatabaseServer:
"findings": "Application fails to start with configuration errors",
"files_checked": [config_file],
"relevant_files": [config_file],
"relevant_methods": [],
"relevant_context": [],
"hypothesis": "Configuration issue causing startup failure",
"confidence": "low",
"model": "flash",
@@ -831,7 +831,7 @@ class DatabaseServer:
"findings": "MAX_CONNECTIONS environment variable contains invalid value, causing CACHE_SIZE calculation to fail",
"files_checked": [config_file, server_file],
"relevant_files": [config_file, server_file],
"relevant_methods": ["DatabaseServer.__init__"],
"relevant_context": ["DatabaseServer.__init__"],
"hypothesis": "Invalid environment variable causing integer conversion error",
"confidence": "medium",
"model": "flash",
@@ -871,7 +871,7 @@ class DatabaseServer:
"findings": "Error occurs in config.py line 8 when MAX_CONNECTIONS is not numeric, then propagates to DatabaseServer.__init__",
"files_checked": [config_file, server_file],
"relevant_files": [config_file, server_file],
"relevant_methods": ["DatabaseServer.__init__"],
"relevant_context": ["DatabaseServer.__init__"],
"hypothesis": "Need proper error handling and validation for environment variables",
"confidence": "high",
"model": "flash",
@@ -905,7 +905,7 @@ class DatabaseServer:
"findings": "Root cause: config.py assumes MAX_CONNECTIONS env var is always a valid integer. Fix: add try/except with default value and proper validation.",
"files_checked": [config_file, server_file],
"relevant_files": [config_file, server_file],
"relevant_methods": ["DatabaseServer.__init__"],
"relevant_context": ["DatabaseServer.__init__"],
"hypothesis": "Environment variable validation needed with proper error handling",
"confidence": "high",
"model": "flash",