Skip to content

fix(gateway): respect explicit platform disable for Home Assistant in env overrides - #76871

Closed
bwoliveira wants to merge 3 commits into
NousResearch:mainfrom
bwoliveira:fix/homeassistant-explicit-disable
Closed

fix(gateway): respect explicit platform disable for Home Assistant in env overrides#76871
bwoliveira wants to merge 3 commits into
NousResearch:mainfrom
bwoliveira:fix/homeassistant-explicit-disable

Conversation

@bwoliveira

Copy link
Copy Markdown

Summary

Checks on during env override processing when is present in .

Problem

When running Hermes in multiplexed gateway mode (), secondary worker profiles inherit process-level environment variables (including ). Without checking , env override processing force-enables Home Assistant even when is explicitly configured on secondary profiles, resulting in duplicate credential startup errors:
.

This matches the explicit-disable pattern used for other platforms (Telegram, Slack, API Server).

Validation

  • Unit tests run via (passed cleanly).
  • Verified on a multiplexed gateway setup with secondary worker profiles containing .

… env overrides

- Check _enabled_explicit on config.platforms[Platform.HOMEASSISTANT] during env overrides when HASS_TOKEN is present in os.environ.
- Prevents secondary worker profiles with platforms.homeassistant.enabled: false from being force-enabled in multiplexed gateway mode, avoiding duplicate credential startup errors.
@bwoliveira

Copy link
Copy Markdown
Author

Added regression test in verifying that explicit is honored for Home Assistant even when is present in .

@teknium1

teknium1 commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Thanks for isolating the Home Assistant correction into its own focused PR. Current main does unconditionally re-enable Home Assistant when HASS_TOKEN resolves (gateway/config.py:2081-2086), while the shared env-enable helper already preserves explicit disables (gateway/config.py:1820-1835).

Problems

  • The new regression test does not model the stated multiplex path. Its autouse fixture pins multiplex mode off (tests/gateway/test_multiplex_credential_isolation.py:15-19), while a real GatewayRunner enables the fail-closed secret scope (gateway/run.py:5551-5558). With multiplex active, an absent scoped HASS_TOKEN does not fall back to os.environ (agent/secret_scope.py:150-156).

Suggested changes

  • Either describe this as a general env-override precedence fix, or make the test activate multiplex mode and supply HASS_TOKEN from the secondary profile's scoped secrets before asserting enabled: false wins.

Automated hermes-sweeper review.

@bwoliveira

Copy link
Copy Markdown
Author

Updated to explicitly model both ambient environment variables () AND active multiplex mode with scoped secrets ( + ), proving wins in both modes.

@teknium1 teknium1 added sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform labels Aug 2, 2026
@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/gateway Gateway runner, session dispatch, delivery area/config Config system, migrations, profiles duplicate This issue or pull request already exists labels Aug 2, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

This was generated by AI during triage.

Duplicate of #54736. Both patches implement the same Home Assistant explicit-disable predicate in gateway/config.py; #54736 already covers the broader configuration shapes.

@bwoliveira

Copy link
Copy Markdown
Author

Closing this as a duplicate — the same fix is already covered by several open PRs from other contributors:

The auto-decompose half of the original fix (former #76864) is already covered by #57837 (srojk34). Closing mine to reduce queue noise — thanks everyone for the broader coverage.

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

Labels

area/config Config system, migrations, profiles comp/gateway Gateway runner, session dispatch, delivery duplicate This issue or pull request already exists P2 Medium — degraded but workaround exists sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants