Skip to content

fix(feishu): honor explicit gateway disable - #31468

Open
joelshu1 wants to merge 1 commit into
NousResearch:mainfrom
joelshu1:fix/feishu-explicit-disable
Open

fix(feishu): honor explicit gateway disable#31468
joelshu1 wants to merge 1 commit into
NousResearch:mainfrom
joelshu1:fix/feishu-explicit-disable

Conversation

@joelshu1

Copy link
Copy Markdown

Summary

This PR makes Feishu/Lark gateway startup respect an explicit disable even when Feishu credentials are present in the environment.

Concretely, it:

  • Keeps the existing default behavior where FEISHU_APP_ID and FEISHU_APP_SECRET auto-configure and enable the Feishu gateway when no disable is requested.
  • Adds support for FEISHU_GATEWAY_ENABLED=false style values (false, 0, off, no) to keep the gateway listener disabled while still loading Feishu credentials into the platform config metadata.
  • Preserves feishu.enabled: false from config.yaml instead of flipping the platform back on during env override processing.
  • Adds regression coverage for the default auto-enable path, env-level disable, explicit enabled config, and explicit disabled config.

Motivation

Some deployments need Feishu/Lark credentials available to Hermes for API/tool usage, but do not want a given gateway process to open the Feishu websocket. This is especially important in multi-profile or service-managed setups where only one process should own the Feishu gateway connection.

Before this change, the env override path could re-enable Feishu whenever FEISHU_APP_ID and FEISHU_APP_SECRET existed, even if the operator had explicitly disabled Feishu gateway startup. The result was surprising gateway startup behavior and possible duplicate Feishu websocket ownership.

This keeps credentials and gateway listener enablement separate: credentials can exist, while the gateway remains disabled when explicitly requested.

Tests

python -m py_compile gateway/config.py tests/gateway/test_config.py
python -m pytest -o addopts='' tests/gateway/test_config.py -q

@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists platform/feishu Feishu / Lark adapter area/config Config system, migrations, profiles labels May 24, 2026
@joelshu1

Copy link
Copy Markdown
Author

FYI good usecase for this is when we need all the access to feishu/lark tooling (messaging, docks, base etc) but dont need to actually use a gateway there! Common situation for us.

@teknium1 teknium1 left a comment

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.

Thanks for isolating the Feishu credential/listener coupling; the underlying defect is still present on current main at gateway/config.py:1871-1876.

Problems

  • The proposed branch only enables a newly absent platform. If platforms.feishu already exists without an explicit enabled key—for example, the documented extra tuning block at website/docs/user-guide/messaging/feishu.md:478-484—its PlatformConfig defaults to disabled and the PR leaves it disabled despite valid credentials.
  • Current main already has the required precedence primitive: _enable_from_env() at gateway/config.py:1453-1468 enables implicit configs but retains _enabled_explicit disables. PR #47807's linked alternative uses that helper and includes this missing regression case.

Suggested changes

  • Salvage the Feishu block through _enable_from_env(Platform.FEISHU) and add the existing-config-without-enabled regression test.
  • Use platforms.feishu.enabled: false for the listener opt-out unless a separate environment override is deliberately adopted and documented.

Automated hermes-sweeper review.

Comment thread gateway/config.py
if Platform.FEISHU not in config.platforms:
config.platforms[Platform.FEISHU] = PlatformConfig()
config.platforms[Platform.FEISHU].enabled = True
config.platforms[Platform.FEISHU] = PlatformConfig(enabled=feishu_gateway_enabled)

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.

When Feishu already exists in config but has no explicit enabled key, this branch leaves its default enabled=False unchanged despite credentials. Use the current _enable_from_env(Platform.FEISHU) helper so implicit configs auto-enable while _enabled_explicit disables remain respected.

@teknium1 teknium1 added sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform labels Jul 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/config Config system, migrations, profiles P2 Medium — degraded but workaround exists platform/feishu Feishu / Lark adapter sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants