Skip to content

fix(plugins): preserve declared thinkingLevels on plugin providers - #796

Merged
vastsa merged 3 commits into
vastsa:mainfrom
ZxlDragonDoctor:fix/plugin-provider-thinking-levels
Sep 21, 2026
Merged

vastsa merged 3 commits into
vastsa:mainfrom
ZxlDragonDoctor:fix/plugin-provider-thinking-levels

Conversation

@ZxlDragonDoctor

Copy link
Copy Markdown
Contributor

Problem

Plugin-declared providers (contributes.providers) reach the model picker with an empty thinking-level menu even when the manifest declares thinkingLevels / defaultThinkingLevel. The same models added by hand in Settings keep their levels.

Root cause in crates/host-core/src/plugins/providers.rs declared_providers(): ModelBinding is built with thinking_levels: Vec::new() and default_thinking_level: None — the manifest fields are never read. packages/plugin-sdk/src/index.ts also omitted the fields from PluginProviderModelContrib.

Solution

  • Read thinkingLevels / defaultThinkingLevel through normalize_thinking_levels (same helper the runtime already uses).
  • Drop a default that names a level the model does not offer.
  • Document both fields on PluginProviderModelContrib.
  • Purely additive: manifests without the fields keep today's empty binding.

Addresses the reporter analysis and attached patch on #777 (no separate maintainer design note on the issue).

Testing

  • Offline contract tests on this host (cargo test blocked: MSVC link.exe not installed):
    • Command: py -3.13 offline_test_plugin_thinking_levels.py (work tree)
    • Result: offline_plugin_thinking_levels: 5 passed
    • Cases: declared levels round-trip; canonicalisation/dedupe; default outside list dropped; malformed list ignored; patch surfaces present in providers.rs / SDK / tests.
  • In-tree Rust unit tests for CI: cargo test -p host-core plugins::providers
    • declared_thinking_levels_survive_into_the_row
    • declared_thinking_levels_are_normalized
    • a_default_outside_the_declared_list_is_dropped
    • a_malformed_thinking_levels_field_is_ignored

Agent dimension

tool-retrieval (plugin-declared provider/model catalog reaches the model picker)

Core value

Plugin-contributed models keep their declared reasoning levels instead of a silently empty menu.

Issue alignment

Fixes #777

@vastsa
vastsa merged commit 991b1b1 into vastsa:main Sep 21, 2026
3 checks passed
@vastsa

vastsa commented Sep 21, 2026

Copy link
Copy Markdown
Owner

Verified and merged. The reported bug was real: before this change, declared_providers() discarded plugin manifest thinking-level fields by constructing every ModelBinding with an empty thinking_levels and no default.

PR #796 preserves thinkingLevels / defaultThinkingLevel, normalizes canonical values, rejects an explicit default outside the declared set, and adds Rust coverage plus SDK types. I added only the landing blockers on top of the contributor commit: formatter output and a non-rewriting merge of the latest main.

Landed as merge commit 991b1b132. Base check, Rust format/lint/test, and JS build/typecheck/lint/test all passed. A separate post-merge documentation follow-up records the manifest contract and E2E expectation.

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] When using a plugin to connect to the AI model service, the inference level cannot be adjusted.

2 participants