Skip to content

fix(cron): align matrix home env var with /sethome conventio - #18154

Closed
selika wants to merge 1 commit into
NousResearch:mainfrom
selika:fix/matrix-home-env-var-name
Closed

fix(cron): align matrix home env var with /sethome conventio#18154
selika wants to merge 1 commit into
NousResearch:mainfrom
selika:fix/matrix-home-env-var-name

Conversation

@selika

@selika selika commented May 1, 2026

Copy link
Copy Markdown

The cron delivery scheduler reads MATRIX_HOME_ROOM for the matrix home channel, but the /sethome command handler in gateway/run.py writes {platform.upper()}_HOME_CHANNEL — i.e. MATRIX_HOME_CHANNEL. All other 14 platforms in _HOME_TARGET_ENV_VARS use the unified _HOME_CHANNEL suffix; only Matrix is the outlier on _HOME_ROOM.

Effect: a Matrix cron job with deliver: "origin" and origin: null falls through to the home-channel fallback which checks MATRIX_HOME_ROOM — but that env var is never set by /sethome, so the fallback returns nothing and delivery is silently dropped.

This patch:

  1. Renames the matrix entry in _HOME_TARGET_ENV_VARS to MATRIX_HOME_CHANNEL, matching what /sethome writes and aligning with the other platforms.
  2. Adds MATRIX_HOME_CHANNEL → MATRIX_HOME_ROOM to _LEGACY_HOME_TARGET_ENV_VARS so any existing deployments that manually set MATRIX_HOME_ROOM continue to work via the legacy fallback path.

What does this PR do?

Related Issue

Fixes #

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)
  • 🔒 Security fix
  • 📝 Documentation update
  • ✅ Tests (adding or improving test coverage)
  • ♻️ Refactor (no behavior change)
  • 🎯 New skill (bundled or hub)

Changes Made

How to Test

Checklist

Code

  • I've read the Contributing Guide
  • My commit messages follow Conventional Commits (fix(scope):, feat(scope):, etc.)
  • I searched for existing PRs to make sure this isn't a duplicate
  • My PR contains only changes related to this fix/feature (no unrelated commits)
  • I've run pytest tests/ -q and all tests pass
  • I've added tests for my changes (required for bug fixes, strongly encouraged for features)
  • I've tested on my platform:

Documentation & Housekeeping

  • I've updated relevant documentation (README, docs/, docstrings) — or N/A
  • I've updated cli-config.yaml.example if I added/changed config keys — or N/A
  • I've updated CONTRIBUTING.md or AGENTS.md if I changed architecture or workflows — or N/A
  • I've considered cross-platform impact (Windows, macOS) per the compatibility guide — or N/A
  • I've updated tool descriptions/schemas if I changed tool behavior — or N/A

For New Skills

  • This skill is broadly useful to most users (if bundled) — see Contributing Guide
  • SKILL.md follows the standard format (frontmatter, trigger conditions, steps, pitfalls)
  • No external dependencies that aren't already available (prefer stdlib, curl, existing Hermes tools)
  • I've tested the skill end-to-end: hermes --toolsets skills -q "Use the X skill to do Y"

Screenshots / Logs

The cron delivery scheduler reads `MATRIX_HOME_ROOM` for the matrix home
channel, but the `/sethome` command handler in `gateway/run.py` writes
`{platform.upper()}_HOME_CHANNEL` — i.e. `MATRIX_HOME_CHANNEL`. All
other 14 platforms in `_HOME_TARGET_ENV_VARS` use the unified
`_HOME_CHANNEL` suffix; only Matrix is the outlier on `_HOME_ROOM`.

Effect: a Matrix cron job with `deliver: "origin"` and `origin: null`
falls through to the home-channel fallback which checks
`MATRIX_HOME_ROOM` — but that env var is never set by `/sethome`, so
the fallback returns nothing and delivery is silently dropped.

This patch:

1. Renames the matrix entry in `_HOME_TARGET_ENV_VARS` to
   `MATRIX_HOME_CHANNEL`, matching what `/sethome` writes and aligning
   with the other platforms.
2. Adds `MATRIX_HOME_CHANNEL → MATRIX_HOME_ROOM` to
   `_LEGACY_HOME_TARGET_ENV_VARS` so any existing deployments that
   manually set `MATRIX_HOME_ROOM` continue to work via the legacy
   fallback path.
@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/cron Cron scheduler and job management platform/matrix Matrix adapter (E2EE) labels May 1, 2026
@teknium1

teknium1 commented May 1, 2026

Copy link
Copy Markdown
Contributor

Thanks for the diagnosis @selika — your bug analysis was correct (Matrix /sethome was writing to an env var nothing read on startup), but the fix was at the wrong side. Aligning the cron reader to match the broken /sethome write would have broken the downstream contract: gateway/config.py:1177 reads MATRIX_HOME_ROOM, the setup wizard writes MATRIX_HOME_ROOM, tests/gateway/test_matrix.py fixtures use MATRIX_HOME_ROOM, and the env-vars documentation lists MATRIX_HOME_ROOM. The correct fix was to make /sethome honor those conventions.

Fixed at the write site via PR #18272 (salvaged from @mikeyobrien's earlier #12698), which also covers email's EMAIL_HOME_ADDRESS — same bug class on the other outlier platform. Credit to you for catching the user-visible symptom and to @mikeyobrien for the write-side fix.

#18272

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/cron Cron scheduler and job management P2 Medium — degraded but workaround exists 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