Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion autobot-backend/agents/base_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,10 @@ async def _handle_communication_request(
return StandardMessage(
header=MessageHeader(message_type=MessageType.ERROR),
payload=MessagePayload(
content={"error": "Communication request failed", "error_type": type(e).__name__}
content={
"error": "Communication request failed",
"error_type": type(e).__name__,
}
),
)

Expand Down
6 changes: 5 additions & 1 deletion autobot-backend/agents/knowledge_retrieval_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,11 @@ async def find_similar_documents(

except Exception as e:
logger.error("Similar document search error: %s", e)
return {"status": "error", "documents": [], "error": "Document search failed"}
return {
"status": "error",
"documents": [],
"error": "Document search failed",
}

async def quick_fact_lookup(
self, fact_query: str, max_docs: int = 3
Expand Down
4 changes: 3 additions & 1 deletion autobot-backend/agents/librarian_assistant.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,9 @@ async def assess_content_quality(
return self._parse_assessment_response(response, content_data)
except Exception as e:
logger.error("Error assessing content quality: %s", e)
return self._build_fallback_assessment(content_data, "Content quality assessment failed")
return self._build_fallback_assessment(
content_data, "Content quality assessment failed"
)

async def store_in_knowledge_base(
self, content_data: Dict[str, Any], assessment: Dict[str, Any]
Expand Down
6 changes: 5 additions & 1 deletion autobot-backend/agents/npu_code_search_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,11 @@ async def index_codebase(

except Exception as e:
self.logger.error("Codebase indexing failed: %s", e)
return {"status": "error", "error": "Codebase indexing failed", "indexed_files": indexed_files}
return {
"status": "error",
"error": "Codebase indexing failed",
"indexed_files": indexed_files,
}

def _build_file_index_data(
self, relative_path: str, language: str, content: str, elements: Dict[str, List]
Expand Down
6 changes: 5 additions & 1 deletion autobot-backend/agents/system_knowledge_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -874,4 +874,8 @@ def get_knowledge_categories(self) -> Dict[str, Any]:

except Exception as e:
logger.error("Failed to get knowledge categories: %s", e)
return {"success": False, "error": "Failed to retrieve knowledge categories", "categories": {}}
return {
"success": False,
"error": "Failed to retrieve knowledge categories",
"categories": {},
}
4 changes: 3 additions & 1 deletion autobot-backend/api/agent_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,9 @@ async def _get_available_providers() -> list:
try:
from services.provider_health import ProviderHealthManager

results = await ProviderHealthManager.check_all_providers(timeout=3.0, use_cache=True)
results = await ProviderHealthManager.check_all_providers(
timeout=3.0, use_cache=True
)
return [name for name, result in results.items() if result.available]
except Exception as e:
logger.warning("Could not check provider availability: %s", e)
Expand Down
4 changes: 3 additions & 1 deletion autobot-backend/api/analytics_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@
re.compile(r"^\d+$"),
# Alphanumeric slugs that look generated: starts with alpha/digit, contains
# both letters and digits, length ≥ 8. Avoids collapsing short word slugs.
re.compile(r"^(?=[a-z0-9_-]{0,200}[a-z])(?=[a-z0-9_-]{0,200}\d)[a-z0-9_-]{8,}$", re.I),
re.compile(
r"^(?=[a-z0-9_-]{0,200}[a-z])(?=[a-z0-9_-]{0,200}\d)[a-z0-9_-]{8,}$", re.I
),
]


Expand Down
8 changes: 6 additions & 2 deletions autobot-backend/api/codebase_analytics/endpoints/sources.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,9 @@ async def _run_git_clone(url: str, dest: str, branch: str) -> str:
stderr=asyncio.subprocess.PIPE,
)
try:
_, stderr = await asyncio.wait_for(proc.communicate(), timeout=_GIT_TIMEOUT_SECONDS)
_, stderr = await asyncio.wait_for(
proc.communicate(), timeout=_GIT_TIMEOUT_SECONDS
)
except asyncio.TimeoutError:
proc.kill()
await proc.wait()
Expand All @@ -119,7 +121,9 @@ async def _run_git_pull(clone_path: str) -> str:
stderr=asyncio.subprocess.PIPE,
)
try:
_, stderr = await asyncio.wait_for(proc.communicate(), timeout=_GIT_TIMEOUT_SECONDS)
_, stderr = await asyncio.wait_for(
proc.communicate(), timeout=_GIT_TIMEOUT_SECONDS
)
except asyncio.TimeoutError:
proc.kill()
await proc.wait()
Expand Down
4 changes: 1 addition & 3 deletions autobot-backend/api/intelligent_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -360,8 +360,6 @@ async def websocket_stream(websocket: WebSocket):
except Exception as e:
logger.error("WebSocket error: %s", e)
try:
await websocket.send_json(
{"type": "error", "content": "WebSocket error"}
)
await websocket.send_json({"type": "error", "content": "WebSocket error"})
except Exception as conn_error:
logger.debug("Connection error: %s", conn_error) # Connection closed
12 changes: 9 additions & 3 deletions autobot-backend/api/long_running_operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,13 @@ async def start_codebase_indexing(
from pathlib import Path

try:
safe_codebase_path = Path(validate_path(request.codebase_path, must_exist=True))
safe_codebase_path = Path(
validate_path(request.codebase_path, must_exist=True)
)
except (ValueError, PermissionError):
raise HTTPException(status_code=400, detail="Invalid or inaccessible codebase path")
raise HTTPException(
status_code=400, detail="Invalid or inaccessible codebase path"
)

estimated_files = 0
try:
Expand Down Expand Up @@ -259,7 +263,9 @@ async def start_comprehensive_testing(
try:
safe_test_path = Path(validate_path(request.test_path, must_exist=True))
except (ValueError, PermissionError):
raise HTTPException(status_code=400, detail="Invalid or inaccessible test path")
raise HTTPException(
status_code=400, detail="Invalid or inaccessible test path"
)

estimated_tests = 0
try:
Expand Down
4 changes: 1 addition & 3 deletions autobot-backend/api/terminal_websocket.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,7 @@ async def handle_terminal_session(self, websocket: WebSocket, chat_id: str):
await self._send_error(websocket, "Invalid JSON")
except Exception as e:
logger.error(f"Error handling WebSocket message: {e}")
await self._send_error(
websocket, "Error processing message"
)
await self._send_error(websocket, "Error processing message")

except Exception as e:
logger.error(f"WebSocket session error: {e}")
Expand Down
16 changes: 12 additions & 4 deletions autobot-backend/chat_workflow/graph_inject_warning_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,9 @@ class _SystemMessage(_BaseMessage):
"langgraph": types.ModuleType("langgraph"),
"langgraph.checkpoint": types.ModuleType("langgraph.checkpoint"),
"langgraph.checkpoint.redis": types.ModuleType("langgraph.checkpoint.redis"),
"langgraph.checkpoint.redis.aio": types.ModuleType("langgraph.checkpoint.redis.aio"),
"langgraph.checkpoint.redis.aio": types.ModuleType(
"langgraph.checkpoint.redis.aio"
),
"langgraph.graph": types.ModuleType("langgraph.graph"),
"langgraph.types": types.ModuleType("langgraph.types"),
"typing_extensions": types.ModuleType("typing_extensions"),
Expand Down Expand Up @@ -126,7 +128,9 @@ def test_appends_hint_to_prompt(self):
result = _inject_mid_conversation_warning(
"Avoid repeating tool calls.", "Answer the question."
)
assert result == "Answer the question.\n\n[Guidance: Avoid repeating tool calls.]"
assert (
result == "Answer the question.\n\n[Guidance: Avoid repeating tool calls.]"
)

def test_empty_prompt(self):
"""Helper works when initial_prompt is empty."""
Expand Down Expand Up @@ -195,9 +199,13 @@ def test_mid_conversation_system_message_rejected(self):
messages = [
SystemMessage(content="You are a helpful assistant."),
HumanMessage(content="Hello"),
SystemMessage(content="[Warning: loop detected]"), # mid-conversation — WRONG
SystemMessage(
content="[Warning: loop detected]"
), # mid-conversation — WRONG
]
with pytest.raises(ValueError, match="Anthropic does not support system messages"):
with pytest.raises(
ValueError, match="Anthropic does not support system messages"
):
self._mock_format_messages(messages)

def test_human_message_injection_accepted(self):
Expand Down
6 changes: 5 additions & 1 deletion autobot-backend/chat_workflow/tool_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -1318,7 +1318,11 @@ async def _handle_browser_tool(
except Exception as e:
logger.error("[Issue #1368] Browser tool '%s' failed: %s", tool_name, e)
execution_results.append(
{"tool": tool_name, "status": "error", "error": "Browser tool execution failed"}
{
"tool": tool_name,
"status": "error",
"error": "Browser tool execution failed",
}
)
yield WorkflowMessage(
type="error",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,10 @@ def process_file(self, file_path: Path) -> bool:

except Exception as e:
self.report["errors"].append(
{"file": str(file_path.relative_to(self.project_root)), "error": "File standardization failed"}
{
"file": str(file_path.relative_to(self.project_root)),
"error": "File standardization failed",
}
)
return False

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,10 @@ def process_file(self, file_path: Path) -> bool:

except Exception as e:
self.report["errors"].append(
{"file": str(file_path.relative_to(self.project_root)), "error": "File optimization failed"}
{
"file": str(file_path.relative_to(self.project_root)),
"error": "File optimization failed",
}
)
return False

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,11 @@ def fix_playwright_report(self, file_path: str) -> Dict[str, Any]:

except Exception as e:
logger.error("Error processing %s: %s", file_path, e)
return {"file": file_path, "status": "error", "error": "File processing failed"}
return {
"file": file_path,
"status": "error",
"error": "File processing failed",
}

def _compute_report_stats(self, results: List[Dict[str, Any]]) -> Dict[str, int]:
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,11 @@ def fix_file(self, file_path: str) -> Dict[str, Any]:

except Exception as e:
logger.error("Error processing file %sfile_path : %se ")
return {"file": file_path, "status": "error", "error": "File processing failed"}
return {
"file": file_path,
"status": "error",
"error": "File processing failed",
}

def scan_directory(self, directory: str) -> List[str]:
"""Scan directory for HTML files to fix."""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,11 @@ def fix_file(self, file_path: str) -> Dict[str, Any]:

except Exception as e:
logger.error("Error processing file %sfile_path : %se ")
return {"file": file_path, "status": "error", "error": "File processing failed"}
return {
"file": file_path,
"status": "error",
"error": "File processing failed",
}

def scan_directory(self, directory: str) -> List[str]:
"""Scan directory for HTML files to fix."""
Expand Down
12 changes: 10 additions & 2 deletions autobot-backend/code_intelligence/pattern_analysis/analyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,11 @@ async def _run_clone_detection(self, directory: str) -> Dict[str, Any]:

except Exception as e:
logger.error("Clone detection failed: %s", e)
return {"type": "clone_detection", "patterns": [], "error": "Clone detection failed"}
return {
"type": "clone_detection",
"patterns": [],
"error": "Clone detection failed",
}

async def _run_regex_detection(self, directory: str) -> Dict[str, Any]:
"""Run regex optimization detection.
Expand All @@ -620,7 +624,11 @@ async def _run_regex_detection(self, directory: str) -> Dict[str, Any]:

except Exception as e:
logger.error("Regex detection failed: %s", e)
return {"type": "regex_detection", "patterns": [], "error": "Regex detection failed"}
return {
"type": "regex_detection",
"patterns": [],
"error": "Regex detection failed",
}

async def _run_complexity_analysis(self, directory: str) -> Dict[str, Any]:
"""Run complexity analysis.
Expand Down
4 changes: 3 additions & 1 deletion autobot-backend/conversation.py
Original file line number Diff line number Diff line change
Expand Up @@ -744,7 +744,9 @@ async def _conduct_research(self, user_message: str) -> Dict[str, Any]:

except Exception as e:
logger.error("Research failed: %s", e)
self._add_system_message("External research failed", "debug", {"error": True})
self._add_system_message(
"External research failed", "debug", {"error": True}
)
return {"success": False, "error": "External research failed"}

def _generate_search_queries(self, user_message: str) -> List[str]:
Expand Down
5 changes: 4 additions & 1 deletion autobot-backend/dependency_container.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,10 @@ async def health_check_all_services(self) -> Dict[str, Dict[str, Any]]:
}
except Exception as e:
logger.error("Health check failed for service %s: %s", service_name, e)
results[service_name] = {"status": "unhealthy", "error": "Health check failed"}
results[service_name] = {
"status": "unhealthy",
"error": "Health check failed",
}

return results

Expand Down
12 changes: 10 additions & 2 deletions autobot-backend/diagnostics.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,10 @@ def _get_system_info(self) -> Dict[str, Any]:
}
except Exception as e:
logger.error("Error gathering system info: %s", e)
return {"error": "Failed to gather system info", "timestamp": datetime.now().isoformat()}
return {
"error": "Failed to gather system info",
"timestamp": datetime.now().isoformat(),
}

def _get_gpu_info(self) -> Dict[str, Any]:
"""Get GPU information for performance monitoring"""
Expand Down Expand Up @@ -450,7 +453,12 @@ def _generate_performance_recommendations(self) -> List[Dict[str, str]]:

except Exception as e:
logger.error("Error generating recommendations: %s", e)
return [{"category": "error", "recommendation": "Error generating recommendations"}]
return [
{
"category": "error",
"recommendation": "Error generating recommendations",
}
]

def cleanup_and_optimize_memory(self):
"""Force memory cleanup and optimization"""
Expand Down
12 changes: 10 additions & 2 deletions autobot-backend/elevation_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,11 @@ async def _execute_normal(self, command: str) -> Dict:

except Exception as e:
logger.error("Normal execution failed: %s", e)
return {"success": False, "error": "Command execution failed", "return_code": -1}
return {
"success": False,
"error": "Command execution failed",
"return_code": -1,
}

async def _execute_elevated(self, command: str, session_token: str) -> Dict:
"""Execute command with elevation using session token"""
Expand All @@ -186,7 +190,11 @@ async def _execute_elevated(self, command: str, session_token: str) -> Dict:

except Exception as e:
logger.error("Elevated execution failed: %s", e)
return {"success": False, "error": "Elevated command execution failed", "return_code": -1}
return {
"success": False,
"error": "Elevated command execution failed",
"return_code": -1,
}

def clear_session(self):
"""Clear the current elevation session"""
Expand Down
11 changes: 6 additions & 5 deletions autobot-backend/initialization/lifespan.py
Original file line number Diff line number Diff line change
Expand Up @@ -645,13 +645,14 @@ async def _launch_workflow(workflow_id: str, payload: dict) -> None:
"""Launcher callback invoked by TriggerService when a trigger fires."""
from services.workflow_automation import get_workflow_manager

logger.info("Trigger fired for workflow %s with payload keys=%s",
workflow_id, list(payload.keys()) if payload else [])
logger.info(
"Trigger fired for workflow %s with payload keys=%s",
workflow_id,
list(payload.keys()) if payload else [],
)
mgr = get_workflow_manager()
if mgr:
await mgr.start_workflow_execution(
workflow_id, trigger_payload=payload
)
await mgr.start_workflow_execution(workflow_id, trigger_payload=payload)

await trigger_service.start(launcher=_launch_workflow)
app.state.trigger_service = trigger_service
Expand Down
4 changes: 3 additions & 1 deletion autobot-backend/judges/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,9 @@ async def make_judgment(

except Exception as e:
logger.error("Error in %s judgment: %s", self.judge_type, e)
return await self._create_error_judgment(subject, "Judgment evaluation failed")
return await self._create_error_judgment(
subject, "Judgment evaluation failed"
)

async def _finalize_judgment_result(
self, judgment_result: JudgmentResult, start_time: datetime
Expand Down
Loading
Loading