fix(providers): honor target_model on the custom-provider resolve path - #93094
Closed
liuhao1024 wants to merge 1 commit into
Closed
liuhao1024 wants to merge 1 commit into
liuhao1024 wants to merge 1 commit into
Conversation
resolve_runtime_provider()'s named-custom branch never consulted target_model: _resolve_named_custom_runtime() fills the runtime's "model" from the provider-level custom_providers.<name>.model default (both the pool and non-pool paths), and the branch returned it as-is. Every other branch already applies "target_model or model_cfg default" precedence, so a caller's explicit per-task model — e.g. auxiliary.background_review's model: — silently lost to the provider default, and downstream (_resolve_review_runtime) marked the fork routed=True and replayed a digest while actually running the parent's model. Apply the same precedence at the custom branch return: when target_model is set it overrides the runtime's model. No target_model keeps today's behavior exactly. Fixes NousResearch#93092
Contributor
Contributor
Author
|
The
|
This was referenced Aug 23, 2026
Collaborator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Makes
resolve_runtime_provider()honor a caller's explicittarget_modelon the named-custom-provider path, closing a precedence gap against every other branch in the same function.Today the custom branch (
_resolve_named_custom_runtime) fills the returned runtime'smodelkey from the provider-levelcustom_providers.<name>.modeldefault — on both the credential-pool and non-pool paths — andresolve_runtime_provider()returns it as-is, never consultingtarget_model. Every other branch already appliestarget_model or model_cfg.get("default")precedence (generic explicit path, Nous, opencode, Azure Foundry), so the custom branch is the one place where a per-call model silently loses to the provider default.Concrete impact (#93092): an
auxiliary.background_reviewtask configured withprovider: custom:<name>+model: <X>resolves to the provider's default model instead ofX._resolve_review_runtime()then marks the forkrouted=Trueand replays a compact digest instead of full history — so the review runs on the parent's model with digest quality loss, paying the routed-path cost for zero benefit, with no warning anywhere.The fix applies the same precedence at the custom branch return: when
target_modelis set, it overrides the runtime'smodel. Atarget_modelofNonekeeps today's behavior exactly.Related Issue
Fixes #93092
Type of Change
Changes Made
hermes_cli/runtime_provider.py— inresolve_runtime_provider()'s named-custom branch, setcustom_runtime["model"] = target_modelbefore returning whentarget_modelis provided, mirroring thetarget_model or defaultprecedence used by the other branches. Single point covers all of_resolve_named_custom_runtime()'s internal return paths (bare-custom direct alias, credential pool, plain custom entry).tests/hermes_cli/test_runtime_provider_resolution.py— three regression tests: target_model outranks the provider default; the provider default stands when no target_model is passed; target_model lands in the runtime even when the provider declares no top-level model.How to Test
pytest tests/hermes_cli/test_runtime_provider_resolution.py -q— should pass (64 passed), including the three new tests.test_target_model_outranks_custom_provider_default_model: provider entry withmodel: hermes, resolved withtarget_model="Curador"→rt["model"] == "Curador". Observed result: on unpatched main this fails (rt["model"] == "hermes"); with this PR it passes.test_custom_provider_default_model_stands_without_target_model: same provider entry, no target_model →rt["model"] == "hermes"(today's behavior preserved; passes on main too by design).test_target_model_sets_model_when_provider_has_no_default: provider entry without a top-level model, resolved withtarget_model="Curador"→rt["model"] == "Curador". Observed result: on unpatched main the key is absent; with this PR it carries the caller's intent.Checklist