fix: bridge HOME_CHANNEL keys from config.yaml to env on Gateway restart#17227
Closed
cooker-code wants to merge 1 commit into
Closed
fix: bridge HOME_CHANNEL keys from config.yaml to env on Gateway restart#17227cooker-code wants to merge 1 commit into
cooker-code wants to merge 1 commit into
Conversation
When /sethome writes *_HOME_CHANNEL and *_HOME_CHANNEL_NAME keys to config.yaml, they were not loaded back into os.environ on Gateway restart. This caused _apply_env_overrides() to miss them, effectively losing the home channel setting. Now load_gateway_config() iterates top-level config keys and bridges any *_HOME_CHANNEL / *_HOME_CHANNEL_NAME entries into os.environ (if not already set), ensuring persistence across restarts.
Collaborator
Contributor
|
Thanks for the contribution! This fix is superseded by #16900 (merged 2026-04-28, shipped in v2026.4.30), which addresses the same root cause more comprehensively. This is an automated hermes-sweeper review. @alt-glitch also flagged this in the comments. Evidence:
The |
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.
Problem
When a user runs
/sethomein a platform (e.g. WeCom), the command writes the home channel info as top-level keys likeWECOM_HOME_CHANNELandWECOM_HOME_CHANNEL_NAMEintoconfig.yaml.However, when the Gateway restarts,
load_gateway_config()does not bridge these top-level*_HOME_CHANNEL/*_HOME_CHANNEL_NAMEkeys back intoos.environ. As a result,_apply_env_overrides()cannot pick them up, and the home channel setting is effectively lost after restart — the user has to run/sethomeagain every time.Fix
In
load_gateway_config(), after loadingconfig.yaml, iterate all top-level keys and bridge any ending with_HOME_CHANNELor_HOME_CHANNEL_NAMEintoos.environ(only if the env var is not already set). This ensures_apply_env_overrides()can pick them up.Changes
gateway/config.py: Added 6-line loop to bridge*_HOME_CHANNEL/*_HOME_CHANNEL_NAMEkeys from YAML config to environment variablesTesting
/sethome—config.yamlgetsWECOM_HOME_CHANNELandWECOM_HOME_CHANNEL_NAME_apply_env_overrides()picks up the values as expected