fix(moa): resolve context window from the aggregator, not the 256K default - #53780
Merged
Conversation
…fault A MoA session's model is the preset name (e.g. 'opus-gpt') and its base_url is the virtual local endpoint, so get_model_context_length() missed every probe and fell through to the 256K fallback — even when the aggregator is a 1M-context model. The acting model in MoA IS the aggregator, so resolve the context window from the aggregator slot's real provider+model. - model_metadata.get_model_context_length: when provider=='moa', resolve the preset's aggregator slot through resolve_runtime_provider and recurse with the aggregator's real provider/model/base_url. Explicit model.context_length still wins (checked first); falls through to the generic default if resolution fails. Tests: opus-gpt preset now reports 1M (the aggregator window), config override still honored.
Collaborator
Competing fix cluster for the MoA context-window display bug (#53637): this PR resolves the aggregator via |
pai-scaffolde
pushed a commit
to pai-scaffolde/hermes-agent
that referenced
this pull request
Jun 28, 2026
…fault (NousResearch#53780) A MoA session's model is the preset name (e.g. 'opus-gpt') and its base_url is the virtual local endpoint, so get_model_context_length() missed every probe and fell through to the 256K fallback — even when the aggregator is a 1M-context model. The acting model in MoA IS the aggregator, so resolve the context window from the aggregator slot's real provider+model. - model_metadata.get_model_context_length: when provider=='moa', resolve the preset's aggregator slot through resolve_runtime_provider and recurse with the aggregator's real provider/model/base_url. Explicit model.context_length still wins (checked first); falls through to the generic default if resolution fails. Tests: opus-gpt preset now reports 1M (the aggregator window), config override still honored.
19 tasks
1 task
waefrebeorn
pushed a commit
to waefrebeorn/slermes
that referenced
this pull request
Jul 2, 2026
…fault (NousResearch#53780) A MoA session's model is the preset name (e.g. 'opus-gpt') and its base_url is the virtual local endpoint, so get_model_context_length() missed every probe and fell through to the 256K fallback — even when the aggregator is a 1M-context model. The acting model in MoA IS the aggregator, so resolve the context window from the aggregator slot's real provider+model. - model_metadata.get_model_context_length: when provider=='moa', resolve the preset's aggregator slot through resolve_runtime_provider and recurse with the aggregator's real provider/model/base_url. Explicit model.context_length still wins (checked first); falls through to the generic default if resolution fails. Tests: opus-gpt preset now reports 1M (the aggregator window), config override still honored.
3 tasks
habarmc1223-sudo
pushed a commit
to habarmc1223-sudo/hermes-agent-fluxmem
that referenced
this pull request
Jul 8, 2026
…fault (NousResearch#53780) A MoA session's model is the preset name (e.g. 'opus-gpt') and its base_url is the virtual local endpoint, so get_model_context_length() missed every probe and fell through to the 256K fallback — even when the aggregator is a 1M-context model. The acting model in MoA IS the aggregator, so resolve the context window from the aggregator slot's real provider+model. - model_metadata.get_model_context_length: when provider=='moa', resolve the preset's aggregator slot through resolve_runtime_provider and recurse with the aggregator's real provider/model/base_url. Explicit model.context_length still wins (checked first); falls through to the generic default if resolution fails. Tests: opus-gpt preset now reports 1M (the aggregator window), config override still honored.
santhreal
pushed a commit
to santhreal/hermes-agent
that referenced
this pull request
Jul 13, 2026
…fault (NousResearch#53780) A MoA session's model is the preset name (e.g. 'opus-gpt') and its base_url is the virtual local endpoint, so get_model_context_length() missed every probe and fell through to the 256K fallback — even when the aggregator is a 1M-context model. The acting model in MoA IS the aggregator, so resolve the context window from the aggregator slot's real provider+model. - model_metadata.get_model_context_length: when provider=='moa', resolve the preset's aggregator slot through resolve_runtime_provider and recurse with the aggregator's real provider/model/base_url. Explicit model.context_length still wins (checked first); falls through to the generic default if resolution fails. Tests: opus-gpt preset now reports 1M (the aggregator window), config override still honored.
Gravezzz
pushed a commit
to Gravezzz/hermes-agent
that referenced
this pull request
Jul 21, 2026
…fault (NousResearch#53780) A MoA session's model is the preset name (e.g. 'opus-gpt') and its base_url is the virtual local endpoint, so get_model_context_length() missed every probe and fell through to the 256K fallback — even when the aggregator is a 1M-context model. The acting model in MoA IS the aggregator, so resolve the context window from the aggregator slot's real provider+model. - model_metadata.get_model_context_length: when provider=='moa', resolve the preset's aggregator slot through resolve_runtime_provider and recurse with the aggregator's real provider/model/base_url. Explicit model.context_length still wins (checked first); falls through to the generic default if resolution fails. Tests: opus-gpt preset now reports 1M (the aggregator window), config override still honored.
leewenjie
pushed a commit
to leewenjie/hermes-agent
that referenced
this pull request
Aug 7, 2026
…fault (NousResearch#53780) A MoA session's model is the preset name (e.g. 'opus-gpt') and its base_url is the virtual local endpoint, so get_model_context_length() missed every probe and fell through to the 256K fallback — even when the aggregator is a 1M-context model. The acting model in MoA IS the aggregator, so resolve the context window from the aggregator slot's real provider+model. - model_metadata.get_model_context_length: when provider=='moa', resolve the preset's aggregator slot through resolve_runtime_provider and recurse with the aggregator's real provider/model/base_url. Explicit model.context_length still wins (checked first); falls through to the generic default if resolution fails. Tests: opus-gpt preset now reports 1M (the aggregator window), config override still honored.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A Mixture of Agents session now reports the aggregator's real context window instead of a flat 256K. The acting model in a MoA run IS the aggregator, so its context window should bound the session.
Root cause: with
provider=moa, the agent'smodelis a preset name (e.g.opus-gpt) andbase_urlis the virtual local endpoint (http://127.0.0.1/v1).get_model_context_length()therefore missed every cache/probe/catalog lookup and fell through to the 256K default fallback — even when the aggregator is a 1M-context model.Changes
agent/model_metadata.py: inget_model_context_length, whenprovider == "moa", resolve the preset's aggregator slot throughresolve_runtime_providerand recurse with the aggregator's real provider/model/base_url. Explicitmodel.context_lengthis still checked first (override wins); any resolution failure falls through to the existing generic default.tests/agent/test_model_metadata.py: aggregator-derived resolution + config-override-still-wins.Validation
opus-gpt(aggregator = openrouter:claude-opus-4.8)model.context_length: 500000tests/agent/test_model_metadata.py→ 107/107 pass.Infographic