Skip to content
Merged
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
17 changes: 15 additions & 2 deletions astrbot/core/platform/sources/satori/satori_adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
register_platform_adapter,
)
from astrbot.core.platform.astr_message_event import MessageSession
from astrbot.core.utils.config_number import coerce_int_config
from astrbot.core.utils.media_utils import MediaResolver

if TYPE_CHECKING:
Expand Down Expand Up @@ -57,8 +58,20 @@ def __init__(
"ws://localhost:5140/satori/v1/events",
)
self.auto_reconnect = self.config.get("satori_auto_reconnect", True)
self.heartbeat_interval = self.config.get("satori_heartbeat_interval", 10)
self.reconnect_delay = self.config.get("satori_reconnect_delay", 5)
self.heartbeat_interval = coerce_int_config(
self.config.get("satori_heartbeat_interval", 10),
default=10,
min_value=1,
field_name="satori_heartbeat_interval",
source="Satori config",
Comment on lines +61 to +66

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (bug_risk): coerce_int_config raises OverflowError when the configuration value is positive or negative infinity, because it calls int(value) without catching OverflowError; the Satori adapter then fails during construction instead of falling back to its default.

Triggers: When a hand-edited JSON configuration contains Infinity, -Infinity, or a numeric value large enough for Python's JSON parser to produce an infinite float.

Suggested fix: Catch OverflowError alongside TypeError and ValueError in coerce_int_config, or reject non-finite numeric values before conversion.

)
self.reconnect_delay = coerce_int_config(
self.config.get("satori_reconnect_delay", 5),
default=5,
min_value=1,
field_name="satori_reconnect_delay",
source="Satori config",
)

self.metadata = PlatformMetadata(
name="satori",
Expand Down
Loading