refactor(gateway): migrate Signal adapter to bundled plugin - #41061
Closed
kshitijk4poor wants to merge 2 commits into
Closed
refactor(gateway): migrate Signal adapter to bundled plugin#41061kshitijk4poor wants to merge 2 commits into
kshitijk4poor wants to merge 2 commits into
Conversation
Move the Signal adapter and its rate-limit companion from
gateway/platforms/signal*.py into a self-contained bundled plugin under
plugins/platforms/signal/, following the Discord/Mattermost/Home
Assistant/Yuanbao migration shape.
register() supplies the hooks that previously lived as per-platform wiring
in core:
- adapter_factory -> the elif in gateway/run.py::_create_adapter()
- check_fn -> check_signal_requirements guard there
- is_connected -> the Platform.SIGNAL lambda in gateway/config.py
- setup_fn -> _setup_signal + _PLATFORMS entry + _builtin_setup_fn
- apply_yaml_config_fn -> the signal_cfg block in load_gateway_config()
- standalone_sender_fn -> _send_signal in tools/send_message_tool.py
- cron_deliver_env_var -> SIGNAL_HOME_CHANNEL
The full signal-cli JSON-RPC sender (attachment batching + the shared
SignalAttachmentScheduler rate-limit state) moved into the plugin as
_standalone_send; tools/send_message_tool.py keeps a thin _send_signal shim
that adapts the legacy (extra, ...) signature so the in-module media + chunk
dispatch paths are unchanged. Signal is HTTP to a signal-cli daemon, so unlike
WebSocket-singleton platforms cron delivery works out-of-process.
Deliberately left generic in core: the Platform.SIGNAL enum literal, the
_apply_env_overrides SIGNAL_* bridge, and the _is_user_authorized allowlist
maps (SIGNAL_ALLOWED_USERS + SIGNAL_GROUP_ALLOWED_USERS stay there).
All consumer imports rewritten to plugins.platforms.signal.{adapter,
signal_rate_limit}. Updated the connection-checker guard test to exclude
bundled-plugin platforms whose is_connected lives in the plugin.
28 tasks
signal is now a bundled plugin; its PlatformEntry already permits /update via allow_update_command (defaults True), honored by the registry fallback in _handle_update_command. The hardcoded Platform.SIGNAL entry in _UPDATE_ALLOWED_PLATFORMS is therefore redundant. Same cleanup as NousResearch#32525 did for Discord/Mattermost.
Collaborator
Author
|
Follow-up to #32525: now that the migrated-platform |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this does
Moves the Signal adapter and its rate-limit companion from
gateway/platforms/signal*.pyinto a self-contained bundled plugin underplugins/platforms/signal/, following the Discord / Mattermost / HomeAssistant / Yuanbao migration shape.
How
register()supplies the hooks that were per-platform wiring in core:adapter_factory, check_fn, is_connected, setup_fn, apply_yaml_config_fn
(the
signal: require_mentionYAML key), standalone_sender_fn,cron_deliver_env_var.
The signal-cli JSON-RPC sender — attachment batching + the shared
SignalAttachmentSchedulerrate-limit state — moved into the plugin as_standalone_send.tools/send_message_tool.pykeeps a thin_send_signalshim adapting the legacy
(extra, …)signature, so the in-module media +chunk dispatch paths are unchanged. Signal is HTTP to a signal-cli daemon,
so cron delivery works out-of-process (no live gateway required).
Out of scope (stays generic, same as every other platform)
Platform.SIGNALenum literal, the_apply_env_overridesSIGNAL_* bridge,the
_is_user_authorizedallowlist maps (SIGNAL_ALLOWED_USERS+SIGNAL_GROUP_ALLOWED_USERSstay there).Tests
Renames R081 (adapter) + R100 (rate-limit companion). 339 focused tests pass.
Updated the connection-checker guard test to exclude bundled-plugin platforms
whose
is_connectedlives in the plugin. No new failures vs main (pre-existingmatrix/telegram xdist flakes excluded).