Show the known context window for `claude-code:` models and the last context of cold-opened saved sessions in the `clai2` web UI
Merged
MP
1mo ago+69+69+01234567890123456789-11-11-01234567890123456789
Fixes #11589
Why we make these changes
#11317 seeded the status before the first turn, but two cases still show ? in the clai2 web UI header and the terminal status row:
- A plugin model such as
claude-code:claude-sonnet-5-5reads0 / ?.infer_model_profiledoesn't know the plugin's prefix. The Claude Code plugin already declaresModelProvider(settings_from='anthropic'), soshow_modelnow maps the model through the existingSessionPlugins.settings_model(claude-code[@PROFILE]:NAME→anthropic:NAME) before looking up the profile. - A saved session opened cold reads
? / ?until a new turn runs.show_modelnow seedscontext_tokensfrom the last retainedModelResponse, using the samecontext_tokens(...) or Nonethe end-of-turn code uses. An empty conversation still reads0. A history without a response stays?.
New public surface
None. The ModelProvider.settings_from docstring and PLUGINS.md now say it also supplies the known context window.
User-visible behavior
| Before | After | |
|---|---|---|
New session on claude-code:claude-sonnet-4-5 | 0 / ? | 0 / 200k |
| Cold-opened saved session whose last response used 84k | ? / 1m | 84k / 1m |
Verification
test_a_plugin_model_shows_the_window_of_its_settings_from_providerandtest_a_resumed_conversation_shows_its_last_responses_contextintests/clai2/test_status.py. Both failed before the fix (['0/?', '0/?']and['?/1m', '0/1m']) and pass after it.tests/clai2/test_status.py,test_plugin_model_providers.pyandtest_web_parts.pypass.ruffandpyrightare clean on the touched files.
What changes for existing users
Only what the status shows before the first turn changes: plugin models with settings_from show a known window, and resumed conversations show their last measured context.
Checklist
- No breaking changes in accordance with the version policy.
- Any permitted compatibility impact has a label, warning, migration and release note, and an exact API-check waiver if the gate reports it.
- PR title is fit for the release changelog.