Skip to content

fix(compression): reuse active model context for feasibility checks - #8441

Open
inside-ziwu wants to merge 1 commit into
NousResearch:mainfrom
inside-ziwu:fix/compression-reuse-active-model-context
Open

fix(compression): reuse active model context for feasibility checks#8441
inside-ziwu wants to merge 1 commit into
NousResearch:mainfrom
inside-ziwu:fix/compression-reuse-active-model-context

Conversation

@inside-ziwu

@inside-ziwu inside-ziwu commented Apr 12, 2026

Copy link
Copy Markdown

Summary

  • reuse the active model context when checking compression feasibility
  • avoid feasibility decisions based on stale or mismatched context-length assumptions
  • add regression coverage for the active-model path

Testing

  • /root/.hermes/hermes-agent/venv/bin/python -m pytest tests/run_agent/test_compression_feasibility.py -q
  • /root/.hermes/hermes-agent/venv/bin/python -m py_compile run_agent.py tests/run_agent/test_compression_feasibility.py

@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint labels Apr 28, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Related to #8786 — both address context-length override propagation to compression paths. #8786 is broader (covers switch_model, fallback paths too).

@teknium1

Copy link
Copy Markdown
Contributor

Thanks for identifying a real context-resolution mismatch. The premise still holds on current main: agent/context_compressor.py:1071-1075 initializes the active compressor with config_context_length, while the feasibility resolver independently calls get_model_context_length() in agent/conversation_compression.py:236-246 without reusing that active value.

Problems

  • The changed run_agent.py body is no longer the live implementation. run_agent.py:1165-1168 now forwards to agent/conversation_compression.py, following extraction commit 5311d9959e19477aac8aa7deca46c1ee0b8e7000.
  • Preserve the existing auxiliary-specific override when salvaging. agent/conversation_compression.py:240 passes _aux_compression_context_length_config, and agent/model_metadata.py:2051-2053 makes a positive explicit override highest priority. A same-runtime shortcut must not supersede it.

Suggested changes

  • Port the narrow same-runtime fallback to agent/conversation_compression.py and retain the auxiliary override as the first choice.
  • Update the regression coverage for both active-context reuse and auxiliary-override precedence.

This is an automated hermes-sweeper review.

@teknium1 teknium1 added sweeper:risk-session-state Sweeper risk: may lose/corrupt/mis-associate session or context state 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 area/compression Context compression and continuation sessions labels Jul 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/compression Context compression and continuation sessions comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint 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-session-state Sweeper risk: may lose/corrupt/mis-associate session or context state type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants