hermes-agent/tests/gateway
Teknium 10297fa23c
fix(discord): `/reload-skills` now refreshes the `/skill` autocomplete live (#18754)
`_register_skill_group` captured the skill catalog in closure variables
(`entries` and `skill_lookup`) so the single `tree.add_command` call at
startup owned the only live copy. The closure is never re-entered after
startup, so `/reload-skills` — which rescans the on-disk skills dir and
refreshes the in-process `_skill_commands` registry — had no way to
propagate results into the `/skill` autocomplete on Discord. New skills
stayed invisible in the dropdown, and deleted skills returned
"Unknown skill" when the stale autocomplete entry was clicked.

The fix is purely a dataflow change: promote `entries` and `skill_lookup`
to instance attributes (`_skill_entries`, `_skill_lookup`), split the
collector-driven rebuild into a helper (`_refresh_skill_catalog_state`),
and add a public `refresh_skill_group()` method that re-runs the helper
and is safe to call at any point after the initial registration.

The gateway's `_handle_reload_skills_command` then iterates
`self.adapters` and calls `refresh_skill_group()` on any adapter that
exposes it (currently only Discord). Both sync and async implementations
are supported; adapters that don't override the method (Telegram's
BotCommand menu, Slack subcommand map, etc.) are silently skipped — the
in-process `reload_skills()` call covers them.

No `tree.sync()` is required because Discord fetches autocomplete
options dynamically on every keystroke — mutating the instance state the
callbacks already read from is sufficient. That sidesteps the per-app
command-bucket rate limit (~5 writes / 20 s) that made the previous
bulk-sync-on-reload approach unusable (#16713 context).

Tests: tests/gateway/test_reload_skills_discord_resync.py — five cases
covering (1) refresh replaces entries, (2) entries stay sorted after
refresh, (3) collector exception leaves cached state intact, (4)
`_refresh_skill_catalog_state` populates the instance attrs, (5)
orchestrator calls `refresh_skill_group()` on sync + async adapters and
skips adapters that don't expose it.
2026-05-02 02:00:11 -07:00
..
__init__.py
…
_plugin_adapter_loader.py test(gateway): isolate plugin adapter imports and guard the anti-pattern 2026-04-30 01:19:34 -07:00
conftest.py test(gateway): isolate plugin adapter imports and guard the anti-pattern 2026-04-30 01:19:34 -07:00
feishu_helpers.py feat(feishu): operator-configurable bot admission and mention policy 2026-04-30 20:30:31 -07:00
restart_test_helpers.py
…
test_7100_transient_failure_transcript.py fix(gateway): persist user message on transient agent failures (#7100) 2026-04-30 04:32:33 -07:00
test_agent_cache.py fix(gateway): refresh cached agents after MCP tool changes 2026-04-29 21:56:47 -07:00
test_allowlist_startup_check.py
…
test_api_server.py fix(api-server): use session-scoped task IDs for tool isolation 2026-04-30 19:59:38 -07:00
test_api_server_bind_guard.py
…
test_api_server_jobs.py
…
test_api_server_multimodal.py
…
test_api_server_normalize.py
…
test_api_server_runs.py fix(api-server): use session-scoped task IDs for tool isolation 2026-04-30 19:59:38 -07:00
test_api_server_toolset.py
…
test_approve_deny_commands.py fix(approval): wake blocked gateway approvals on session cleanup 2026-04-30 19:46:27 -07:00
test_auth_fallback.py
…
test_auto_continue.py
…
test_background_command.py
…
test_background_process_notifications.py
…
test_base_topic_sessions.py
…
test_bluebubbles.py
…
test_busy_session_ack.py feat(busy): add 'steer' as a third display.busy_input_mode option (#16279) 2026-04-26 18:21:29 -07:00
test_busy_session_auth_bypass.py fix(gateway): enforce auth check in busy-session path to prevent unauthorized injection (#17775) 2026-04-30 04:29:15 -07:00
test_cancel_background_drain.py
…
test_channel_directory.py fix(Slack): resolve Slack channels by raw ID and enumerate joined channels 2026-04-26 12:29:02 -07:00
test_clean_shutdown_marker.py
…
test_command_bypass_active_session.py
…
test_complete_path_at_filter.py
…
test_compress_command.py fix(compression): include system prompt + tool schemas in token estimates (#18265) 2026-04-30 23:03:54 -07:00
test_compress_focus.py
…
test_compress_plugin_engine.py
…
test_config.py feat(gateway): private notice delivery and Slack format_message fixes 2026-05-01 13:33:06 -07:00
test_config_cwd_bridge.py feat: add Vercel Sandbox backend 2026-04-29 07:22:33 -07:00
test_debug_command.py
…
test_delivery.py fix(gateway): preserve case-sensitive chat IDs in DeliveryTarget.parse 2026-05-01 14:01:26 -07:00
test_dingtalk.py
…
test_discord_allowed_channels.py
…
test_discord_allowed_mentions.py
…
test_discord_attachment_download.py
…
test_discord_bot_auth_bypass.py
…
test_discord_bot_filter.py
…
test_discord_channel_controls.py
…
test_discord_channel_prompts.py
…
test_discord_channel_skills.py
…
test_discord_connect.py
…
test_discord_document_handling.py
…
test_discord_free_response.py fix(gateway): coerce scalar free_response_channels to str before split 2026-05-01 14:01:26 -07:00
test_discord_imports.py
…
test_discord_media_metadata.py
…
test_discord_model_picker.py
…
test_discord_opus.py
…
test_discord_race_polish.py
…
test_discord_reactions.py
…
test_discord_reply_mode.py
…
test_discord_send.py
…
test_discord_slash_commands.py
…
test_discord_system_messages.py
…
test_discord_thread_persistence.py
…
test_display_config.py fix(gateway): default Slack tool_progress to off 2026-04-26 18:33:35 -07:00
test_dm_topics.py
…
test_document_cache.py
…
test_duplicate_reply_suppression.py fix(gateway): drain pending messages via fresh task, not recursion (#17758) 2026-04-30 03:27:08 -07:00
test_email.py chore(salvage): strip duplicated/merge-corrupted blocks from PR #17664 2026-04-29 21:56:51 -07:00
test_ephemeral_reply.py feat(gateway): auto-delete slash-command system notices after TTL (#18266) 2026-04-30 23:05:48 -07:00
test_extract_local_files.py
…
test_fallback_eviction.py
…
test_fast_command.py fix(gateway): guard against None request_overrides in _build_api_kwargs 2026-04-28 06:57:23 -07:00
test_feishu.py feat(feishu): operator-configurable bot admission and mention policy 2026-04-30 20:30:31 -07:00
test_feishu_approval_buttons.py
…
test_feishu_bot_admission.py feat(feishu): operator-configurable bot admission and mention policy 2026-04-30 20:30:31 -07:00
test_feishu_bot_auth_bypass.py feat(feishu): operator-configurable bot admission and mention policy 2026-04-30 20:30:31 -07:00
test_feishu_comment.py
…
test_feishu_comment_rules.py
…
test_feishu_onboard.py
…
test_fresh_reset_skill_injection.py fix(gateway): re-inject topic-bound skill after /new or /reset 2026-04-30 20:29:19 -07:00
test_gateway_inactivity_timeout.py
…
test_gateway_shutdown.py fix(gateway,cron): close ephemeral agents + reap stale aux clients (salvage #13979) (#16598) 2026-04-27 07:41:42 -07:00
test_home_target_env_var.py fix(gateway): honor MATRIX_HOME_ROOM in onboarding 2026-04-30 23:13:34 -07:00
test_homeassistant.py
…
test_hooks.py
…
test_insights_unicode_flags.py
…
test_internal_event_bypass_pairing.py
…
test_interrupt_key_match.py
…
test_irc_adapter.py test(gateway): isolate plugin adapter imports and guard the anti-pattern 2026-04-30 01:19:34 -07:00
test_keep_typing_timeout.py fix(gateway): keep typing indicator alive across slow send_typing calls (#16763) 2026-04-27 19:09:32 -07:00
test_matrix.py fix(ci): stabilize main test suite regressions (#17660) 2026-04-29 23:18:55 -07:00
test_matrix_exec_approval.py test(matrix): set user_id in approval-reaction test to bypass defensive self-drop 2026-04-27 21:22:44 -07:00
test_matrix_mention.py test(matrix): adapt outbound-mention notice test to current _send_simple_message API 2026-04-27 21:22:44 -07:00
test_matrix_voice.py
…
test_mattermost.py
…
test_media_download_retry.py fix(slack): harden attachment handling 2026-04-26 18:20:17 -07:00
test_media_extraction.py
…
test_message_deduplicator.py Fix MessageDeduplicator max_size enforcement 2026-04-26 18:51:51 -07:00
test_mirror.py fix(gateway): avoid cross-user mirror writes in per-user group sessions 2026-04-26 18:31:24 -07:00
test_model_command_custom_providers.py
…
test_model_switch_persistence.py
…
test_native_image_buffer_isolation.py fix(gateway): isolate pending native image paths by session 2026-04-30 20:26:35 -07:00
test_notice_delivery.py feat(gateway): private notice delivery and Slack format_message fixes 2026-05-01 13:33:06 -07:00
test_pairing.py
…
test_pending_drain_no_recursion.py test(gateway): pin cleanup invariants for #17758 in-band drain hand-off 2026-04-30 05:00:25 -07:00
test_pending_drain_race.py
…
test_pending_event_none.py
…
test_pii_redaction.py
…
test_platform_base.py feat(gateway): centralize audio routing + FLAC support + Telegram doc fallback (#17833) 2026-04-30 01:32:31 -07:00
test_platform_connected_checkers.py feat(irc): add interactive setup 2026-04-29 21:56:51 -07:00
test_platform_reconnect.py fix(gateway): isolate platform connect failures with per-platform timeout 2026-04-29 05:00:37 -07:00
test_platform_registry.py feat(irc): add interactive setup 2026-04-29 21:56:51 -07:00
test_plugin_platform_interface.py feat(irc): add interactive setup 2026-04-29 21:56:51 -07:00
test_pre_gateway_dispatch.py
…
test_proxy_mode.py
…
test_qqbot.py
…
test_queue_consumption.py fix(gateway): /queue is now a true FIFO — each invocation gets its own turn (#16175) 2026-04-26 11:55:09 -07:00
test_reasoning_command.py fix: coerce show_reasoning and guard_agent_created config bools 2026-04-30 20:40:46 -07:00
test_reload_skills_command.py refactor(reload-skills): queue note for next turn, drop cache invalidation + agent tool 2026-04-29 21:07:47 -07:00
test_reload_skills_discord_resync.py fix(discord): `/reload-skills` now refreshes the `/skill` autocomplete live (#18754) 2026-05-02 02:00:11 -07:00
test_reply_to_injection.py
…
test_restart_drain.py feat(busy): add 'steer' as a third display.busy_input_mode option (#16279) 2026-04-26 18:21:29 -07:00
test_restart_notification.py fix(gateway): write restart markers atomically and fix Windows lock collisions 2026-04-30 19:58:16 -07:00
test_restart_redelivery_dedup.py
…
test_restart_resume_pending.py fix(gateway): write restart markers atomically and fix Windows lock collisions 2026-04-30 19:58:16 -07:00
test_resume_command.py feat(memory): notify providers on mid-process session_id rotation (#17409) 2026-04-29 04:57:22 -07:00
test_retry_replacement.py
…
test_retry_response.py
…
test_run_progress_interrupt.py
…
test_run_progress_topics.py fix(ci): recover 38 failing tests on main (#17642) 2026-04-29 20:05:32 -07:00
test_runner_fatal_adapter.py
…
test_runner_startup_failures.py
…
test_running_agent_session_toggles.py refactor: drop persist_session plumbing + fix broken btw mid-turn bypass (#16075) 2026-04-26 07:15:23 -07:00
test_runtime_footer.py feat(gateway): opt-in runtime-metadata footer on final replies (#17026) 2026-04-28 06:50:04 -07:00
test_safe_adapter_disconnect.py
…
test_send_image_file.py
…
test_send_multiple_images.py feat(gateway): native send_multiple_images for Telegram, Discord, Slack, Mattermost, Email 2026-04-30 04:28:08 -07:00
test_send_retry.py
…
test_session.py fix(state): JSON-encode multimodal message content for sqlite 2026-04-30 20:25:52 -07:00
test_session_boundary_hooks.py
…
test_session_boundary_security_state.py fix(gateway): preserve assistant metadata when branching sessions 2026-04-30 20:40:28 -07:00
test_session_dm_thread_seeding.py
…
test_session_env.py
…
test_session_hygiene.py feat(gateway): make hygiene hard message limit configurable (#17000) 2026-04-28 05:43:12 -07:00
test_session_info.py
…
test_session_list_allowed_sources.py fix(sessions): /save lands under $HERMES_HOME, widen browse+TUI picker, force-refresh ollama-cloud on setup (#16296) 2026-04-26 18:49:48 -07:00
test_session_model_override_routing.py
…
test_session_model_reset.py fix(gateway): clear stale pending model note on session reset 2026-04-26 19:01:50 -07:00
test_session_race_guard.py fix(gateway): preserve document type when merging queued events 2026-04-30 20:37:27 -07:00
test_session_reset_notify.py
…
test_session_split_brain_11016.py
…
test_session_state_cleanup.py
…
test_session_store_prune.py
…
test_setup_feishu.py
…
test_shared_group_sender_prefix.py
…
test_shutdown_cache_cleanup.py fix(gateway): clean up cached agents on shutdown (#11205) 2026-04-26 12:51:53 -07:00
test_shutdown_memory_provider_messages.py fix(gateway): pass session messages to shutdown_memory_provider (#15165) 2026-04-27 06:41:16 -07:00
test_signal.py fix(signal): skip contentless envelopes (profile key updates, empty messages) 2026-04-30 19:42:59 -07:00
test_signal_format.py feat(gateway/signal): native formatting, reply quotes, and reactions 2026-04-29 04:38:17 -07:00
test_signal_rate_limit.py feat(gateway/signal): add support for multiple images sending 2026-04-30 04:28:08 -07:00
test_slack.py fix(gateway): clear slack assistant thread status 2026-05-01 14:01:26 -07:00
test_slack_approval_buttons.py fix(slack): preserve thread-parent context when cron/bot posted the parent 2026-04-26 12:35:16 -07:00
test_slack_channel_skills.py feat(gateway/slack): support channel_skill_bindings 2026-04-26 18:25:41 -07:00
test_slack_mention.py fix(gateway): coerce scalar free_response_channels to str before split 2026-05-01 14:01:26 -07:00
test_sms.py
…
test_sse_agent_cancel.py
…
test_ssl_certs.py
…
test_stale_code_self_check.py fix(gateway): auto-restart when source files change out from under us (#17648) (#18409) 2026-05-01 09:50:08 -07:00
test_status.py fix(gateway): write restart markers atomically and fix Windows lock collisions 2026-04-30 19:58:16 -07:00
test_status_command.py fix(gateway): snapshot callback generation after agent binds it, not before 2026-04-30 20:41:18 -07:00
test_steer_command.py
…
test_step_callback_compat.py
…
test_sticker_cache.py
…
test_stream_consumer.py fix(gateway): linearize tool-progress bubbles with content messages (#17280) 2026-04-28 22:17:33 -07:00
test_stream_consumer_fresh_final.py feat(telegram): send fresh finals for stale preview streams (port openclaw#72038) (#16261) 2026-04-26 17:26:37 -07:00
test_stt_config.py
…
test_stuck_loop.py
…
test_teams.py test(gateway): isolate plugin adapter imports and guard the anti-pattern 2026-04-30 01:19:34 -07:00
test_telegram_approval_buttons.py fix(telegram): enforce gateway auth for inline approval callbacks 2026-04-30 19:59:31 -07:00
test_telegram_caption_merge.py
…
test_telegram_conflict.py
…
test_telegram_documents.py feat(gateway): centralize audio routing + FLAC support + Telegram doc fallback (#17833) 2026-04-30 01:32:31 -07:00
test_telegram_format.py feat(telegram): render markdown tables as row groups 2026-04-28 05:37:50 -07:00
test_telegram_group_gating.py fix(telegram): support group user allowlist 2026-04-29 21:07:55 -07:00
test_telegram_mention_boundaries.py
…
test_telegram_network.py
…
test_telegram_network_reconnect.py fix(telegram): probe polling liveness after reconnect to detect wedged Updater 2026-05-02 01:55:04 -07:00
test_telegram_photo_interrupts.py
…
test_telegram_reactions.py
…
test_telegram_reply_mode.py
…
test_telegram_text_batching.py
…
test_telegram_thread_fallback.py
…
test_telegram_webhook_secret.py
…
test_text_batching.py
…
test_title_command.py
…
test_transcript_offset.py
…
test_tts_media_routing.py feat(gateway): centralize audio routing + FLAC support + Telegram doc fallback (#17833) 2026-04-30 01:32:31 -07:00
test_unauthorized_dm_behavior.py fix(telegram): preserve pre-#17686 chat-ID-in-_USERS configs + doc split 2026-04-29 21:07:55 -07:00
test_unavailable_skill_hint.py fix(gateway): match disabled/optional skills by frontmatter slug, not dir name (#18753) 2026-05-02 02:00:09 -07:00
test_unknown_command.py
…
test_update_command.py fix(gateway): preserve thread routing for /update progress and prompts 2026-04-30 20:19:23 -07:00
test_update_streaming.py fix(gateway): preserve thread routing for /update progress and prompts 2026-04-30 20:19:23 -07:00
test_usage_command.py
…
test_verbose_command.py fix(gateway): coerce tool_progress_command as a real boolean 2026-04-30 20:40:46 -07:00
test_vision_memory_leak.py fix(memory): narrow scrub surface to known wrapper boundaries 2026-04-27 12:37:33 -07:00
test_voice_command.py
…
test_voice_mode_platform_isolation.py
…
test_weak_credential_guard.py
…
test_webhook_adapter.py
…
test_webhook_deliver_only.py
…
test_webhook_dynamic_routes.py
…
test_webhook_integration.py
…
test_webhook_signature_rate_limit.py
…
test_wecom.py
…
test_wecom_callback.py
…
test_weixin.py test(weixin): cover _is_stale_session_ret helper (#17228) 2026-04-29 05:44:44 -07:00
test_whatsapp_connect.py
…
test_whatsapp_formatting.py
…
test_whatsapp_group_gating.py
…
test_whatsapp_reply_prefix.py
…
test_ws_auth_retry.py
…
test_yolo_command.py
…