Skip to content

fix(feishu): persist /sethome home channel to .env and load on startup#16870

Closed
ztexydt-cqh wants to merge 1 commit into
NousResearch:mainfrom
ztexydt-cqh:ai-fix/16806
Closed

fix(feishu): persist /sethome home channel to .env and load on startup#16870
ztexydt-cqh wants to merge 1 commit into
NousResearch:mainfrom
ztexydt-cqh:ai-fix/16806

Conversation

@ztexydt-cqh

Copy link
Copy Markdown
Contributor

Problem

Feishu /sethome appeared to succeed but the home channel was never persisted. After every gateway restart, users were prompted to run /sethome again.

Root Cause

  1. _handle_set_home_command in gateway/run.py wrote to config.yaml as a top-level key, but load_gateway_config() does not consume top-level {PLATFORM}_HOME_CHANNEL keys.
  2. gateway/config.py lacked a yaml→env mapping for Feishu, so even if the YAML had the value, it was never injected into os.environ.

Solution

  • Write the home channel to .env via save_env_value() (the same helper used by the setup wizard), which atomically updates the file and the current process environment.
  • Add Feishu yaml→env mapping in gateway/config.py for backward compatibility.
  • Add FEISHU_HOME_CHANNEL and FEISHU_HOME_CHANNEL_NAME to _EXTRA_ENV_KEYS so they are treated as managed env vars.

Files Changed

  • gateway/run.py
  • gateway/config.py
  • hermes_cli/config.py

Fixes #16806

closes NousResearch#16806)

The /sethome handler was writing the home channel to config.yaml as a
top-level key, which load_gateway_config() never reads. This meant Feishu
users had to run /sethome after every gateway restart.

Changes:
- gateway/run.py: use save_env_value() to write to .env instead of yaml
- gateway/config.py: add Feishu yaml→env mapping for home_channel
- hermes_cli/config.py: add FEISHU_HOME_CHANNEL to managed env keys
@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/gateway Gateway runner, session dispatch, delivery comp/cli CLI entry point, hermes_cli/, setup wizard platform/feishu Feishu / Lark adapter labels Apr 28, 2026
@teknium1

Copy link
Copy Markdown
Contributor

Merged via #16900 — your fix landed on current main with your authorship preserved (commit 1d5e25f). Thank you!

The gateway/run.py change was the right call. Widened the scope during salvage:

  • Dropped the Feishu-only config.yaml → env mapping since no other platform offers that path — would've been inconsistent UX.
  • Added missing *_HOME_CHANNEL* entries in _EXTRA_ENV_KEYS for all platforms (SIGNAL, SLACK, SMS, DINGTALK, BLUEBUBBLES, WECOM, YUANBAO + *_NAME variants for DISCORD/TELEGRAM/MATTERMOST) so managed-env coverage is complete.

Your one-line fix in _handle_set_home_command actually repaired /sethome for every platform, not just Feishu — it's platform-generic because the handler builds the env key from platform_name.upper(). Nice catch. #16900

@teknium1 teknium1 closed this Apr 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/cli CLI entry point, hermes_cli/, setup wizard comp/gateway Gateway runner, session dispatch, delivery P2 Medium — degraded but workaround exists platform/feishu Feishu / Lark adapter type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feishu /sethome silently fails: home channel not persisted, prompts every startup

3 participants