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-11

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-5 reads 0 / ?. infer_model_profile doesn't know the plugin's prefix. The Claude Code plugin already declares ModelProvider(settings_from='anthropic'), so show_model now maps the model through the existing SessionPlugins.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_model now seeds context_tokens from the last retained ModelResponse, using the same context_tokens(...) or None the end-of-turn code uses. An empty conversation still reads 0. 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

BeforeAfter
New session on claude-code:claude-sonnet-4-50 / ?0 / 200k
Cold-opened saved session whose last response used 84k? / 1m84k / 1m

Verification

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.