Skip to content

fix(compression): pass custom_providers to feasibility check context lookup#19553

Closed
luyao618 wants to merge 1 commit into
NousResearch:mainfrom
luyao618:fix/compression-feasibility-custom-provider-context-length
Closed

fix(compression): pass custom_providers to feasibility check context lookup#19553
luyao618 wants to merge 1 commit into
NousResearch:mainfrom
luyao618:fix/compression-feasibility-custom-provider-context-length

Conversation

@luyao618

@luyao618 luyao618 commented May 4, 2026

Copy link
Copy Markdown
Contributor

Summary

The compression feasibility check in _check_compression_model_feasibility() calls get_model_context_length() without passing custom_providers, so per-model context_length overrides from custom_providers config are ignored. The check falls back to the auxiliary compression model's detected context window (e.g. 256K) instead of the user's configured override (e.g. 1M), causing spurious warnings and auto-lowered compression thresholds.

Root Cause

get_model_context_length() supports a custom_providers parameter (added in #15779) that checks per-model context_length overrides before probing endpoints. However, the feasibility check at run_agent.py:2657 was not passing this parameter.

The _custom_providers list was resolved during __init__ but only used for the main model's context length resolution, not stored on self for the feasibility check to access.

Fix

  1. Store _custom_providers on self alongside _config_context_length (line 1949).
  2. Pass custom_providers=getattr(self, '_custom_providers', None) to get_model_context_length() in _check_compression_model_feasibility().
  3. Update existing test assertions to include the new parameter.

Testing

  • All 243 compression-related tests pass (pytest -k compress).
  • Updated test_compression_feasibility.py assertions to verify the new parameter is forwarded.

Scope

  • run_agent.py: 2 lines added
  • tests/run_agent/test_compression_feasibility.py: 3 assertion updates

Closes #19539

@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/agent Core agent loop, run_agent.py, prompt builder labels May 4, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Related to #8721, #14152, #17460 — same root cause (custom_providers not passed to compression feasibility check). Closes #19539.

@alt-glitch

Copy link
Copy Markdown
Collaborator

Related to #8721, #14152, #17460

…lookup

The compression feasibility check calls get_model_context_length() without
passing custom_providers, so per-model context_length overrides from
custom_providers config are ignored. The check falls back to the auxiliary
model's detected context (e.g. 256K) instead of the user's override
(e.g. 1M), causing spurious warnings and auto-lowered thresholds.

Fix: store _custom_providers on self during __init__ and forward it to
get_model_context_length() in _check_compression_model_feasibility().

Closes NousResearch#19539
@luyao618

Copy link
Copy Markdown
Contributor Author

Closing: this PR has merge conflicts and the codebase has moved on. Will re-submit if the fix is still needed.

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

Labels

comp/agent Core agent loop, run_agent.py, prompt builder P2 Medium — degraded but workaround exists type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Compression feasibility check ignores custom provider context_length for auxiliary compression

2 participants