Skip to content

fix(agent): resolve context_length for plugin context engines - #9238

Merged
teknium1 merged 2 commits into
mainfrom
hermes/hermes-49d7526c
Apr 13, 2026
Merged

fix(agent): resolve context_length for plugin context engines#9238
teknium1 merged 2 commits into
mainfrom
hermes/hermes-49d7526c

Conversation

@teknium1

Copy link
Copy Markdown
Collaborator

Summary

Salvage of PR #9218 by @stephenschoettler. Also addresses #9117 by @corazzione (duplicate fix, submitted first).

Plugin context engines (like LCM) were never initialized with context_length during agent startup. The built-in ContextCompressor resolves it in its __init__, but the plugin path just assigned the engine directly — leaving context_length at the ABC default of 0. This caused the CLI status bar to permanently show ctx -- with an empty progress bar.

The fix calls update_model() on the plugin engine immediately after loading, mirroring what switch_model() already does.

Changes

Test plan

python3 -m pytest tests/run_agent/test_plugin_context_engine_init.py tests/run_agent/test_switch_model_context.py tests/run_agent/test_context_pressure.py -o 'addopts=' -q

49 passed.

Fixes #9071
Closes #9218
Closes #9117

stephenschoettler and others added 2 commits April 13, 2026 14:58
Plugin context engines loaded via load_context_engine() were never
given context_length, causing the CLI status bar to show "ctx --"
with an empty progress bar. Call update_model() immediately after
loading the plugin engine, mirroring what switch_model() already does.

Fixes #9071

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Verify that plugin context engines receive update_model() with correct
context_length during AIAgent init — regression test for the ctx -- bug.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: CLI status bar shows ctx -- when LCM context engine is active — context_length never resolved

2 participants