Skip to content

fix: surface provider-scoped context length in gateway session info - #15668

Open
guantik-gm wants to merge 4 commits into
NousResearch:mainfrom
guantik-gm:fix/gateway-session-info-context-length
Open

fix: surface provider-scoped context length in gateway session info#15668
guantik-gm wants to merge 4 commits into
NousResearch:mainfrom
guantik-gm:fix/gateway-session-info-context-length

Conversation

@guantik-gm

@guantik-gm guantik-gm commented Apr 25, 2026

Copy link
Copy Markdown

Summary

  • make GatewayRunner._format_session_info() reuse the provider compatibility layer when top-level model.context_length is absent
  • surface per-model context_length from providers: / custom_providers: in the gateway session-info banner
  • add regression coverage for both config shapes in tests/gateway/test_session_info.py

Problem

The gateway /reset / session-info banner only read top-level model.context_length, so configs that stored context under provider-scoped per-model entries (for example providers.<name>.models.<model>.context_length) could incorrectly fall back to the default 128K display even though runtime paths already honored the configured value.

Test Plan

  • python -m pytest tests/gateway/test_session_info.py -q
  • result: 11 passed

Notes

  • preserves existing behavior for top-level model.context_length
  • keeps fallback/default messaging unchanged when no config override is available

@alt-glitch alt-glitch added type/bug Something isn't working P3 Low — cosmetic, nice to have comp/gateway Gateway runner, session dispatch, delivery labels Apr 25, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Related to #10690, #5096, #8240, #14382 — all fix the same gateway session-info banner not reading provider-scoped context_length. Consider consolidating.

@nwang783

Copy link
Copy Markdown

I checked the related PRs called out above (#10690, #5096, #8240, #14382). They do appear to be solving the same user-visible bug family: the gateway session-info banner not surfacing the provider-scoped context_length correctly.

I don't see a reviewer-blocking code issue in this PR from that comment alone, but I do think we should consolidate before merge so we don't land the same fix multiple times with slightly different implementations/tests.

@teknium1

Copy link
Copy Markdown
Contributor

Thanks for collecting fixes across the affected paths. The gateway-session-info portion is already on current main: gateway/run.py:12236-12237 supplies the compatibility-normalized provider entries to get_model_context_length(), whose per-model override path is at agent/model_metadata.py:2083-2096 (landed by 3ccf723bf). The related comments correctly identified this as a consolidation problem.

Problems

  • The provider transport handling and background-review runtime inheritance are also already upstream (362996e26, e3901d5b2).
  • The remaining MCP change uses the old mcp_<server>_<tool> construction. Main now centralizes MCP names in tools/mcp_tool.py:4477-4484 as mcp__<server>__<tool>, so this hunk needs adaptation rather than a direct cherry-pick.

Suggested changes

  • Salvage the independent deterministic MCP length cap at mcp_prefixed_tool_name() and retain the current double-underscore convention; omit the already-landed gateway/runtime/review portions.

This is an automated hermes-sweeper review.

@teknium1 teknium1 added sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:risk-caching Sweeper risk: may break/degrade prompt caching or cache-key stability (invariant) sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform labels Jul 12, 2026
@alt-glitch alt-glitch removed sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:risk-caching Sweeper risk: may break/degrade prompt caching or cache-key stability (invariant) labels Jul 12, 2026
@teknium1 teknium1 added the area/sessions Session lifecycle, resume, persistence, history label Jul 19, 2026
@alt-glitch alt-glitch added comp/cli CLI entry point, hermes_cli/, setup wizard comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint tool/mcp MCP client and OAuth needs-decision Awaiting maintainer decision before any implementation comp/tools Tool registry, model_tools, toolsets and removed comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint comp/cli CLI entry point, hermes_cli/, setup wizard comp/gateway Gateway runner, session dispatch, delivery area/sessions Session lifecycle, resume, persistence, history comp/tools Tool registry, model_tools, toolsets labels Jul 19, 2026
@alt-glitch alt-glitch 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 P2 Medium — degraded but workaround exists platform/telegram Telegram bot adapter P3 Low — cosmetic, nice to have comp/cli CLI entry point, hermes_cli/, setup wizard comp/gateway Gateway runner, session dispatch, delivery area/config Config system, migrations, profiles and removed P3 Low — cosmetic, nice to have sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages platform/telegram Telegram bot adapter P2 Medium — degraded but workaround exists comp/cli CLI entry point, hermes_cli/, setup wizard comp/gateway Gateway runner, session dispatch, delivery area/config Config system, migrations, profiles sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades labels Jul 19, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

This was generated by AI during triage.

Related to #18025 and the older session-info display work, but this live branch also modifies provider transport resolution, background-review inheritance, and MCP tool naming. It is not a duplicate; a split/consolidation decision would make the independent changes reviewable.

@alt-glitch alt-glitch added the sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades label Jul 19, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

This was generated by AI during triage.

Related to open display-only competitor #18025. This branch additionally changes custom-provider transport resolution, background-review credential inheritance, and MCP registry-name handling, so it is mixed-scope competing work rather than a duplicate; please split or consolidate.

@alt-glitch alt-glitch added comp/tools Tool registry, model_tools, toolsets P3 Low — cosmetic, nice to have and removed P2 Medium — degraded but workaround exists comp/tools Tool registry, model_tools, toolsets sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades labels Jul 19, 2026
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/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint comp/cli CLI entry point, hermes_cli/, setup wizard comp/gateway Gateway runner, session dispatch, delivery needs-decision Awaiting maintainer decision before any implementation P3 Low — cosmetic, nice to have 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 tool/mcp MCP client and OAuth type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants