Skip to content

fix(gateway): fall back to self.config for home-channel prompt - #59348

Open
Mason-zy wants to merge 1 commit into
NousResearch:mainfrom
Mason-zy:fix/home-channel-prompt-fallback
Open

fix(gateway): fall back to self.config for home-channel prompt#59348
Mason-zy wants to merge 1 commit into
NousResearch:mainfrom
Mason-zy:fix/home-channel-prompt-fallback

Conversation

@Mason-zy

@Mason-zy Mason-zy commented Jul 6, 2026

Copy link
Copy Markdown

Problem

The "📬 No home channel is set..." prompt keeps refiring on every new session even after the user has run /sethome. Tracked in #10581.

Root cause

The prompt check in gateway/run.py only reads the env var:

if not os.getenv(env_key):
    # shows "No home channel is set..." prompt

But _handle_set_home_command persists the home channel to .env + self.config, not to os.environ. The .env value only enters os.environ after a gateway restart, so within a running process os.getenv() never sees it — and the prompt refires on every fresh session (not history).

/sethome already updates self.config.platforms[platform].home_channel in-memory immediately, but the prompt check ignores it.

Fix

Also consult self.config before deciding to show the prompt:

_home_set = bool(os.getenv(env_key))
if not _home_set:
    pcfg = self.config.platforms.get(source.platform)
    if pcfg and getattr(pcfg, "home_channel", None):
        _home_set = True
if not _home_set:
    # show the prompt

Now the prompt respects whichever source /sethome actually wrote to, and stops refiring once a home channel is set — without requiring a restart.

Closes #10581.

@alt-glitch alt-glitch added type/bug Something isn't working comp/gateway Gateway runner, session dispatch, delivery sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages P2 Medium — degraded but workaround exists labels Jul 6, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

This was generated by AI during triage.

Related: this fixes #10581, which already has a saturated cluster of competing OPEN fixes at the same code site (_handle_message_with_agent home-channel prompt): #24282 (self.config.get_home_channel() fallback), #10632 (earliest, load_config() fallback), and #10722/#12391. All use the same env-check -> config-fallback mechanism. Flagging for a maintainer to pick one canonical fix rather than merging multiple.

@tonydwb tonydwb left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review Summary

Verdict: Approved

Changes

Fixes a regression in the "no home channel" prompt re-firing on every new session. Previously, /sethome persisted to .env + self.config, but os.getenv() missed the .env value until a restart. Now falls back to self.config.platforms[source.platform].home_channel when the env var is not set.

Quality

  • Targeted fix: only changes the specific conditional that caused the regression
  • Clean fallback chain: env var first, then config lookup, then the "no home" path
  • No security or correctness concerns

Suggestions

  • None

Reviewed by Hermes Agent

@tonydwb tonydwb left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

COMMENT: fix(gateway): fall back to self.config for home-channel prompt

Small gateway fix (14 additions, 1 deletion). No security concerns.


Reviewed by Hermes Agent

johnson7788 pushed a commit to johnson7788/MultiUserClaw that referenced this pull request Jul 6, 2026
Backport of NousResearch/hermes-agent#59348 (upstream issue #10581).

The 'No home channel is set' prompt only checked os.getenv(), but
/sethome persists to .env + self.config (os.environ only sees .env
after restart). Within a running process the prompt refired on every
new session. Add self.config fallback so it respects what /sethome
actually wrote.
@teknium1

Copy link
Copy Markdown
Contributor

Thanks for the focused fix. The premise remains valid on current main: gateway/run.py:11643-11660 checks only os.getenv(env_key), while /sethome writes the in-memory PlatformConfig.home_channel at gateway/slash_commands.py:2464-2476.

Problems

  • The PR has no regression coverage for the changed notice predicate. tests/gateway/test_restart_notification.py:182-210 proves /sethome updates GatewayConfig, but does not execute the first-message onboarding path or assert that _deliver_platform_notice is suppressed.

Suggested changes

  • Add a focused async test with the env var unset and runner.config.platforms[Platform.TELEGRAM].home_channel populated; exercise gateway/run.py:11641-11660 and assert no home-channel notice is delivered. Retain a counterpart case with neither source set.

This is an automated hermes-sweeper review.

@teknium1 teknium1 added the sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform label Jul 15, 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 sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform 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.

[Bug]: Home-channel auto-prompt only checks env var, never falls back to yaml config

4 participants