fix(feishu): respect explicit enabled: false when env vars are present (#47804) - #47807
fix(feishu): respect explicit enabled: false when env vars are present (#47804)#47807liuhao1024 wants to merge 2 commits into
Conversation
When a user's config.yaml explicitly sets feishu.enabled: false, the _apply_env_overrides() function was unconditionally forcing enabled=True when FEISHU_APP_ID/FEISHU_APP_SECRET env vars existed. This ignored the user's explicit config, causing sub-profiles to attempt Feishu connections and trigger app_id conflicts. Use the existing _enable_from_env() helper (already used by Telegram) which checks the _enabled_explicit flag before enabling. Slack uses the same pattern via its own enabled_was_explicit check. 4 regression tests added.
|
Duplicate of #31468 — same bug and same fix: Feishu |
|
@alt-glitch This is not a duplicate of #31468. The two PRs fix the same symptom but use different approaches:
Both can coexist: #31468 adds a kill-switch env var, #47807 ensures config.yaml is respected. If only one lands, #47807 is the more minimal fix (zero new config surface). |
|
Thanks for the focused fix. The premise is confirmed on current main: Problems
Suggested changes
This is an automated hermes-sweeper review. |
What does this PR do?
Fixes Feishu platform env var override ignoring explicit
enabled: falsein config.yaml. WhenFEISHU_APP_IDandFEISHU_APP_SECRETenv vars are present,_apply_env_overrides()unconditionally forcedenabled = True, overriding the user's explicit config. This caused sub-profiles to attempt Feishu connections and trigger app_id conflicts in multi-profile deployments.Related Issue
Fixes #47804
Type of Change
Changes Made
gateway/config.py: Replace manualPlatformConfig()+enabled = Truewith_enable_from_env(Platform.FEISHU)which checks_enabled_explicitflag before enabling (same pattern used by Telegram)tests/gateway/test_config.py: AddTestFeishuEnvOverrideRespectsExplicitEnabledwith 4 regression tests covering: explicit disabled stays disabled, no explicit enables, env var population, and existing config without enabled keyHow to Test
FEISHU_APP_IDandFEISHU_APP_SECRETenv varsplatforms.feishu.enabled: falseenabled: falsefrom config — Feishu should be enabled via env varspytest tests/gateway/test_config.py::TestFeishuEnvOverrideRespectsExplicitEnabled -vChecklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/ -qand all tests passDocumentation & Housekeeping
docs/, docstrings) — or N/Acli-config.yaml.exampleif I added/changed config keys — or N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows — or N/ACode Intelligence
gateway/config.py::_apply_env_overrides()(Feishu section, lines 1761-1785)_enable_from_env()helper already used by Telegram (line 1365); Slack uses equivalentenabled_was_explicitcheck (line 1500)