Skip to content

fix(gateway): /sethome on Matrix and Email now persists across restarts - #18272

Merged
teknium1 merged 2 commits into
mainfrom
hermes/hermes-963e60ae
May 1, 2026
Merged

fix(gateway): /sethome on Matrix and Email now persists across restarts#18272
teknium1 merged 2 commits into
mainfrom
hermes/hermes-963e60ae

Conversation

@teknium1

@teknium1 teknium1 commented May 1, 2026

Copy link
Copy Markdown
Contributor

Summary

/sethome on Matrix and Email now persists across gateway restarts.

Root cause: _handle_set_home_command hardcoded {PLATFORM}_HOME_CHANNEL as the env-var name, but two platforms don't follow that convention — Matrix reads MATRIX_HOME_ROOM (gateway/config.py:1177) and Email reads EMAIL_HOME_ADDRESS (gateway/config.py:1210). On those platforms, /sethome wrote to an env var nothing read on startup, so users had to re-run it every new session.

Changes

  • gateway/run.py: add _home_target_env_var() helper backed by cron.scheduler._HOME_TARGET_ENV_VARS (single source of truth), with {PLATFORM}_HOME_CHANNEL fallback for unknown platforms. Wired into both /sethome and the first-run onboarding "no home channel" warning so they agree on the env-var name.
  • tests/gateway/test_home_target_env_var.py: regression coverage for Matrix (HOME_ROOM), Email (HOME_ADDRESS), Telegram/Discord (HOME_CHANNEL convention), unknown-platform fallback, case-insensitive lookup.
  • scripts/release.py: add @mikeyobrien to AUTHOR_MAP.

Validation

Before After
/sethome on Matrix writes MATRIX_HOME_CHANNEL (dead) MATRIX_HOME_ROOM (read by loader)
/sethome on Email writes EMAIL_HOME_CHANNEL (dead) EMAIL_HOME_ADDRESS (read by loader)
/sethome on Telegram/Discord/etc. *_HOME_CHANNEL *_HOME_CHANNEL (unchanged)
Persists across restart no on Matrix/Email yes

E2E verified: real save_env_value() write + .env inspection + gateway/config.py loader path. Targeted pytest: 6/6 new cases pass, 247/247 matrix + cron cases still pass (3 pre-existing TestSilentDelivery failures on clean main are unrelated).

Salvaged from #12698 by @mikeyobrien — widened the contributor's regression test to also cover email and the convention platforms. Original PR touched the pre-#16900 YAML write path; this version is rebased onto the current save_env_value() path.

Closes the contributor's issue and supersedes #18154 (which patched the cron reader to align with the bug instead of fixing the bug at the write site).

Co-authored-by: Mikey O'Brien m@mobrienv.dev

@teknium1
teknium1 merged commit 77dd6d5 into main May 1, 2026
10 of 11 checks passed
@teknium1
teknium1 deleted the hermes/hermes-963e60ae branch May 1, 2026 06:13
@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/gateway Gateway runner, session dispatch, delivery platform/matrix Matrix adapter (E2EE) platform/email Email (IMAP/SMTP) adapter labels May 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/gateway Gateway runner, session dispatch, delivery P2 Medium — degraded but workaround exists platform/email Email (IMAP/SMTP) adapter platform/matrix Matrix adapter (E2EE) type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants