Skip to content

fix(gateway): honor /model + channel_overrides in /new and /status banner - #62827

Closed
dickyudhandika wants to merge 1 commit into
NousResearch:mainfrom
dickyudhandika:fix/format-session-info-overrides
Closed

fix(gateway): honor /model + channel_overrides in /new and /status banner#62827
dickyudhandika wants to merge 1 commit into
NousResearch:mainfrom
dickyudhandika:fix/format-session-info-overrides

Conversation

@dickyudhandika

Copy link
Copy Markdown

What does this PR do?

_format_session_info was reading model.default directly, so the /new auto-reset notice and /status banner advertised the global default even when the thread was pinned via channel_overrides or had a /model session override. The next agent turn ran on the override model, but the banner showed a different one — misleading at best, wrong at worst.

Fix: _format_session_info accepts an optional source and runs the same priority chain as _resolve_session_agent_runtime (/model session override → channel_overrides → global default). _reset_notice_session_info passes its source through. The no-source path is preserved for CLI introspection where no channel context exists.

Related Issue

Reported by a user running a Telegram thread pinned via channel_overrides to a custom provider model. The /new notice kept advertising the global default while the next turn ran on the pinned model. The bug was in the gateway, not the provider config; the per-thread override just made it visible. Any thread using channel_overrides or a /model session override was affected.

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)

Changes Made

  • gateway/run.py_format_session_info(source=None) now applies the priority chain (/modelchannel_overrides → global) when source is provided. _reset_notice_session_info is updated to pass its source through. Multiplex-profile gating in the reset path is preserved.
  • tests/gateway/test_format_session_info_overrides.py — 4 new tests covering: no source (CLI introspection path), channel override applies, no override thread falls back to global, /model session override wins over channel override.

How to Test

  1. Apply the patch, run venv/bin/python -m pytest tests/gateway/test_format_session_info_overrides.py -v → 4 passed
  2. Run the broader session-info + model-override regression suite: venv/bin/python -m pytest tests/gateway/test_session_info.py tests/gateway/test_session_model_override_persistence.py tests/gateway/test_session_model_override_credential_pool.py tests/gateway/test_session_model_override_routing.py tests/gateway/test_session_model_reset.py tests/gateway/test_session_reset_notify.py tests/gateway/test_format_session_info_overrides.py -q → 50 passed
  3. Manual: pin a Telegram thread via channel_overrides, send /new, confirm the banner reports the pinned model rather than the global default

Checklist

Code

  • I've read the Contributing Guide
  • My commit messages follow Conventional Commits
  • I searched for existing PRs to make sure this isn't a duplicate
  • My PR contains only changes related to this fix
  • I've run the affected tests and all pass
  • I've added tests for my changes
  • I've tested on my platform: macOS 26.4.1 (Apple Silicon)

Documentation & Housekeeping

  • I've updated relevant documentation — N/A, docstring in _format_session_info was updated inline
  • I've considered cross-platform impact (Windows, macOS) — N/A, gateway logic is platform-agnostic

…nner

_format_session_info was reading model.default directly, so the /new
auto-reset notice and /status banner advertised the global default even
when the thread was pinned via channel_overrides or had a /model session
override. The next agent turn ran on the override model, but the banner
showed a different one — misleading at best, wrong at worst.

Apply the same resolution chain as _resolve_session_agent_runtime:
/model session override > channel_overrides > global default. Pass
source through from _reset_notice_session_info (the only production
caller from the reset path). The no-source path is preserved for CLI
introspection where no channel context exists.

Reported by a user running a Telegram thread pinned via
channel_overrides to a custom provider model. The bug was in the
gateway, not the provider config; the per-thread override just made
it visible. Any thread using channel_overrides or a /model session
override was affected.
@teknium1

Copy link
Copy Markdown
Contributor

Thanks for isolating the reset-banner mismatch. The current reset path does reproduce the global-model display issue, but this patch needs a broader shared-resolution pass before it matches its stated /new + /status behavior.

Problems

  • /status is implemented independently in gateway/slash_commands.py:550-604; it does not call _format_session_info. Its fallback remains global config at gateway/slash_commands.py:565-594, so this diff cannot fix /status for a fresh overridden channel.
  • The new formatter branch selects only a model. Runtime resolution also derives provider settings for channel overrides in gateway/run.py:3824-3835 and applies the full session override at gateway/run.py:3837-3840; banner provider/context/endpoint can remain inconsistent.
  • /new clears session model overrides before producing its banner (gateway/slash_commands.py:200-215,252-258), so the added direct formatter test for a /model override does not exercise that production path.

Suggested changes

  • Share the effective display/runtime resolver and cover real /new and /status handlers, including a fresh channel override and a session /model status case.

Automated hermes-sweeper review.

@alt-glitch alt-glitch added type/bug Something isn't working comp/gateway Gateway runner, session dispatch, delivery P2 Medium — degraded but workaround exists sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages labels Jul 11, 2026
@teknium1 teknium1 added 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 Jul 11, 2026
@dickyudhandika dickyudhandika closed this by deleting the head repository Jul 29, 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-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