fix: resolve all invalid-return-type ty diagnostics across codebase

Widen return type annotations to match actual control flow, add
unreachable assertions after retry loops ty cannot prove terminate,
split ambiguous union returns (auth.py credential pool), and remove
the AIOHTTP_AVAILABLE conditional-import guard from api_server.py.
This commit is contained in:
alt-glitch 2026-04-21 14:55:09 +05:30
parent d3dde0b459
commit 224e6d46d9
23 changed files with 102 additions and 103 deletions

View file

@ -891,7 +891,7 @@ BROWSER_TOOL_SCHEMAS = [
# Utility Functions
# ============================================================================
def _create_local_session(task_id: str) -> Dict[str, str]:
def _create_local_session(task_id: str) -> Dict[str, Any]:
import uuid
session_name = f"h_{uuid.uuid4().hex[:10]}"
logger.info("Created local browser session %s for task %s",
@ -904,7 +904,7 @@ def _create_local_session(task_id: str) -> Dict[str, str]:
}
def _create_cdp_session(task_id: str, cdp_url: str) -> Dict[str, str]:
def _create_cdp_session(task_id: str, cdp_url: str) -> Dict[str, Any]:
"""Create a session that connects to a user-supplied CDP endpoint."""
import uuid
session_name = f"cdp_{uuid.uuid4().hex[:10]}"
@ -918,7 +918,7 @@ def _create_cdp_session(task_id: str, cdp_url: str) -> Dict[str, str]:
}
def _get_session_info(task_id: Optional[str] = None) -> Dict[str, str]:
def _get_session_info(task_id: Optional[str] = None) -> Dict[str, Any]:
"""
Get or create session info for the given task.
@ -1678,7 +1678,7 @@ def browser_scroll(direction: str, task_id: Optional[str] = None) -> str:
from tools.browser_camofox import camofox_scroll
# Camofox REST API doesn't support pixel args; use repeated calls
_SCROLL_REPEATS = 5
result = None
result: str = ""
for _ in range(_SCROLL_REPEATS):
result = camofox_scroll(direction, task_id)
return result