Use Claude Code, Codex, VSCode, Pi, and OpenCode (and 6 other harnesses) for free (1.3B+ free tokens) from your terminal, app, IDE, or phone, and now from the browser with native browser sessions (multi-harness + multi-model) like OpenClaw (voice supported + ToS friendly)
Python
Fix type check errors and CI
Cursor Agent034d1857704d
diff --git a/messaging/discord.py b/messaging/discord.pyindex 6aa408d4..84b43e8c 100644--- a/messaging/discord.py+++ b/messaging/discord.py@@ -4,6 +4,14 @@ from .platforms.discord import (DiscordPlatform,DISCORD_AVAILABLE,DISCORD_MESSAGE_LIMIT,+ _parse_allowed_channels,+ _get_discord,)-__all__ = ["DiscordPlatform", "DISCORD_AVAILABLE", "DISCORD_MESSAGE_LIMIT"]+__all__ = [+ "DiscordPlatform",+ "DISCORD_AVAILABLE",+ "DISCORD_MESSAGE_LIMIT",+ "_parse_allowed_channels",+ "_get_discord",+]diff --git a/messaging/discord_markdown.py b/messaging/discord_markdown.pyindex 351b61a7..25d3fe97 100644--- a/messaging/discord_markdown.py+++ b/messaging/discord_markdown.py@@ -8,6 +8,8 @@ from .rendering.discord_markdown import (format_status,format_status_discord,render_markdown_to_discord,+ _is_gfm_table_header_line,+ _normalize_gfm_tables,)__all__ = [@@ -18,4 +20,6 @@ __all__ = ["format_status","format_status_discord","render_markdown_to_discord",+ "_is_gfm_table_header_line",+ "_normalize_gfm_tables",]diff --git a/messaging/telegram.py b/messaging/telegram.pyindex 6c0f1934..6475e3ae 100644--- a/messaging/telegram.py+++ b/messaging/telegram.py@@ -5,4 +5,11 @@ from .platforms.telegram import (TELEGRAM_AVAILABLE,)+# Re-export telegram.error types when python-telegram-bot is installed__all__ = ["TelegramPlatform", "TELEGRAM_AVAILABLE"]+try:+ from telegram.error import NetworkError, RetryAfter, TelegramError++ __all__ += ["NetworkError", "RetryAfter", "TelegramError"]+except ImportError:+ passdiff --git a/tests/messaging/test_discord_platform.py b/tests/messaging/test_discord_platform.pyindex 674cd693..22f525aa 100644--- a/tests/messaging/test_discord_platform.py+++ b/tests/messaging/test_discord_platform.py@@ -16,7 +16,7 @@ class TestGetDiscord:"""Tests for _get_discord helper."""def test_raises_when_discord_not_available(self):- import messaging.discord as discord_mod+ import messaging.platforms.discord as discord_modwith patch.object(discord_mod, "DISCORD_AVAILABLE", False):with patch.object(discord_mod, "_discord_module", None):@@ -246,7 +246,7 @@ class TestDiscordPlatform:with patch.object(platform._client, "get_channel", MagicMock(return_value=mock_channel)):- with patch("messaging.discord._get_discord") as mock_get:+ with patch("messaging.platforms.discord._get_discord") as mock_get:mock_discord = MagicMock()mock_get.return_value = mock_discordmsg_id = await platform.send_message("123", "Hello", reply_to="456")@@ -283,7 +283,7 @@ class TestDiscordPlatform:with patch.object(platform._client, "get_channel", MagicMock(return_value=mock_channel)):- with patch("messaging.discord._get_discord") as mock_get:+ with patch("messaging.platforms.discord._get_discord") as mock_get:mock_get.return_value = MagicMock()await platform.delete_message("123", "456")mock_msg.delete.assert_awaited_once()diff --git a/tests/messaging/test_telegram_edge_cases.py b/tests/messaging/test_telegram_edge_cases.pyindex 85ec9122..1edb8254 100644--- a/tests/messaging/test_telegram_edge_cases.py+++ b/tests/messaging/test_telegram_edge_cases.py@@ -6,9 +6,7 @@ import pytestdef test_telegram_platform_init_raises_when_dependency_missing():- from messaging import telegram as telegram_mod-- with patch.object(telegram_mod, "TELEGRAM_AVAILABLE", False):+ with patch("messaging.platforms.telegram.TELEGRAM_AVAILABLE", False):from messaging.telegram import TelegramPlatformwith pytest.raises(ImportError):@@ -19,7 +17,7 @@ def test_telegram_platform_init_raises_when_dependency_missing():async def test_telegram_platform_start_requires_token():with (patch.dict("os.environ", {}, clear=True),- patch("messaging.telegram.TELEGRAM_AVAILABLE", True),+ patch("messaging.platforms.telegram.TELEGRAM_AVAILABLE", True),):from messaging.telegram import TelegramPlatform@@ -30,7 +28,7 @@ async def test_telegram_platform_start_requires_token():@pytest.mark.asyncioasync def test_telegram_platform_stop_no_application_is_noop():- with patch("messaging.telegram.TELEGRAM_AVAILABLE", True):+ with patch("messaging.platforms.telegram.TELEGRAM_AVAILABLE", True):from messaging.telegram import TelegramPlatformplatform = TelegramPlatform(bot_token="t")@@ -42,7 +40,7 @@ async def test_telegram_platform_stop_no_application_is_noop():@pytest.mark.asyncioasync def test_with_retry_returns_none_when_message_not_modified_network_error():- with patch("messaging.telegram.TELEGRAM_AVAILABLE", True):+ with patch("messaging.platforms.telegram.TELEGRAM_AVAILABLE", True):from messaging.telegram import TelegramPlatform, NetworkErrorplatform = TelegramPlatform(bot_token="t")@@ -55,7 +53,7 @@ async def test_with_retry_returns_none_when_message_not_modified_network_error()@pytest.mark.asyncioasync def test_with_retry_retries_network_error_then_succeeds(monkeypatch):- with patch("messaging.telegram.TELEGRAM_AVAILABLE", True):+ with patch("messaging.platforms.telegram.TELEGRAM_AVAILABLE", True):from messaging.telegram import TelegramPlatform, NetworkErrorplatform = TelegramPlatform(bot_token="t")@@ -76,7 +74,7 @@ async def test_with_retry_retries_network_error_then_succeeds(monkeypatch):@pytest.mark.asyncioasync def test_with_retry_honors_retry_after_timedelta(monkeypatch):- with patch("messaging.telegram.TELEGRAM_AVAILABLE", True):+ with patch("messaging.platforms.telegram.TELEGRAM_AVAILABLE", True):from messaging.telegram import TelegramPlatform, RetryAfterplatform = TelegramPlatform(bot_token="t")@@ -97,7 +95,7 @@ async def test_with_retry_honors_retry_after_timedelta(monkeypatch):@pytest.mark.asyncioasync def test_with_retry_drops_parse_mode_on_markdown_entity_error():- with patch("messaging.telegram.TELEGRAM_AVAILABLE", True):+ with patch("messaging.platforms.telegram.TELEGRAM_AVAILABLE", True):from messaging.telegram import TelegramPlatform, TelegramErrorplatform = TelegramPlatform(bot_token="t")@@ -116,7 +114,7 @@ async def test_with_retry_drops_parse_mode_on_markdown_entity_error():@pytest.mark.asyncioasync def test_queue_send_message_without_limiter_calls_send_message():- with patch("messaging.telegram.TELEGRAM_AVAILABLE", True):+ with patch("messaging.platforms.telegram.TELEGRAM_AVAILABLE", True):from messaging.telegram import TelegramPlatformplatform = TelegramPlatform(bot_token="t")@@ -131,7 +129,7 @@ async def test_queue_send_message_without_limiter_calls_send_message():@pytest.mark.asyncioasync def test_queue_edit_message_without_limiter_calls_edit_message():- with patch("messaging.telegram.TELEGRAM_AVAILABLE", True):+ with patch("messaging.platforms.telegram.TELEGRAM_AVAILABLE", True):from messaging.telegram import TelegramPlatformplatform = TelegramPlatform(bot_token="t")@@ -144,7 +142,7 @@ async def test_queue_edit_message_without_limiter_calls_edit_message():def test_fire_and_forget_non_coroutine_uses_ensure_future(monkeypatch):- with patch("messaging.telegram.TELEGRAM_AVAILABLE", True):+ with patch("messaging.platforms.telegram.TELEGRAM_AVAILABLE", True):from messaging.telegram import TelegramPlatformplatform = TelegramPlatform(bot_token="t")@@ -158,7 +156,7 @@ def test_fire_and_forget_non_coroutine_uses_ensure_future(monkeypatch):@pytest.mark.asyncioasync def test_on_start_command_replies_and_forwards():- with patch("messaging.telegram.TELEGRAM_AVAILABLE", True):+ with patch("messaging.platforms.telegram.TELEGRAM_AVAILABLE", True):from messaging.telegram import TelegramPlatformplatform = TelegramPlatform(bot_token="t")@@ -175,7 +173,7 @@ async def test_on_start_command_replies_and_forwards():@pytest.mark.asyncioasync def test_on_telegram_message_handler_error_sends_error_message():- with patch("messaging.telegram.TELEGRAM_AVAILABLE", True):+ with patch("messaging.platforms.telegram.TELEGRAM_AVAILABLE", True):from messaging.telegram import TelegramPlatformplatform = TelegramPlatform(bot_token="t", allowed_user_id="123")@@ -201,7 +199,7 @@ async def test_on_telegram_message_handler_error_sends_error_message():@pytest.mark.asyncioasync def test_telegram_start_retries_on_network_error(monkeypatch):- with patch("messaging.telegram.TELEGRAM_AVAILABLE", True):+ with patch("messaging.platforms.telegram.TELEGRAM_AVAILABLE", True):from messaging.telegram import TelegramPlatform, NetworkErrorplatform = TelegramPlatform(bot_token="token", allowed_user_id=None)@@ -226,7 +224,7 @@ async def test_telegram_start_retries_on_network_error(monkeypatch):@pytest.mark.asyncioasync def test_edit_message_with_text_exceeding_4096_raises():"""edit_message with text > 4096 raises TelegramError (BadRequest)."""- with patch("messaging.telegram.TELEGRAM_AVAILABLE", True):+ with patch("messaging.platforms.telegram.TELEGRAM_AVAILABLE", True):from messaging.telegram import TelegramPlatform, TelegramErrorplatform = TelegramPlatform(bot_token="t")@@ -243,7 +241,7 @@ async def test_edit_message_with_text_exceeding_4096_raises():@pytest.mark.asyncioasync def test_edit_message_empty_string():"""edit_message with empty string - Telegram accepts (no-op edit)."""- with patch("messaging.telegram.TELEGRAM_AVAILABLE", True):+ with patch("messaging.platforms.telegram.TELEGRAM_AVAILABLE", True):from messaging.telegram import TelegramPlatformplatform = TelegramPlatform(bot_token="t")@@ -260,7 +258,7 @@ async def test_edit_message_empty_string():@pytest.mark.asyncioasync def test_send_message_empty_string():"""send_message with empty string - Telegram may reject; we pass through."""- with patch("messaging.telegram.TELEGRAM_AVAILABLE", True):+ with patch("messaging.platforms.telegram.TELEGRAM_AVAILABLE", True):from messaging.telegram import TelegramPlatformplatform = TelegramPlatform(bot_token="t")@@ -278,7 +276,7 @@ async def test_send_message_empty_string():@pytest.mark.asyncioasync def test_on_telegram_message_non_text_update_ignored():"""Update with message.photo but no text returns early without calling handler."""- with patch("messaging.telegram.TELEGRAM_AVAILABLE", True):+ with patch("messaging.platforms.telegram.TELEGRAM_AVAILABLE", True):from messaging.telegram import TelegramPlatformplatform = TelegramPlatform(bot_token="t", allowed_user_id="123")@@ -300,7 +298,7 @@ async def test_on_telegram_message_non_text_update_ignored():@pytest.mark.asyncioasync def test_with_retry_message_not_found_returns_none():"""'message to edit not found' returns None without retry."""- with patch("messaging.telegram.TELEGRAM_AVAILABLE", True):+ with patch("messaging.platforms.telegram.TELEGRAM_AVAILABLE", True):from messaging.telegram import TelegramPlatform, TelegramErrorplatform = TelegramPlatform(bot_token="t")