fix(gateway): /sethome on Matrix and Email now persists across restarts - #18272
Merged
Conversation
This was referenced May 1, 2026
1 task
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.
Summary
/sethomeon Matrix and Email now persists across gateway restarts.Root cause:
_handle_set_home_commandhardcoded{PLATFORM}_HOME_CHANNELas the env-var name, but two platforms don't follow that convention — Matrix readsMATRIX_HOME_ROOM(gateway/config.py:1177) and Email readsEMAIL_HOME_ADDRESS(gateway/config.py:1210). On those platforms,/sethomewrote 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 bycron.scheduler._HOME_TARGET_ENV_VARS(single source of truth), with{PLATFORM}_HOME_CHANNELfallback for unknown platforms. Wired into both/sethomeand 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
/sethomeon Matrix writesMATRIX_HOME_CHANNEL(dead)MATRIX_HOME_ROOM(read by loader)/sethomeon Email writesEMAIL_HOME_CHANNEL(dead)EMAIL_HOME_ADDRESS(read by loader)/sethomeon Telegram/Discord/etc.*_HOME_CHANNEL*_HOME_CHANNEL(unchanged)E2E verified: real
save_env_value()write +.envinspection +gateway/config.pyloader path. Targeted pytest: 6/6 new cases pass, 247/247 matrix + cron cases still pass (3 pre-existingTestSilentDeliveryfailures 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