fix(xai): forward image_gen.model kwarg to _resolve_model in generate() - #55893
fix(xai): forward image_gen.model kwarg to _resolve_model in generate()#55893srojk34 wants to merge 1 commit into
Conversation
generate() accepted **kwargs but called _resolve_model() with no arguments, silently discarding any model the caller supplied. tools/image_generation_tool.py passes kwargs["model"] = configured_model sourced from image_gen.model in config.yaml into provider.generate(). For the xAI provider this meant a user selecting grok-imagine-image-quality via hermes tools always got the default grok-imagine-image instead, with no error or log. Mirrors the fix PR NousResearch#55672 applied to the openrouter provider, which already threads kwargs.get("model") into its resolver. Add caller_model parameter to _resolve_model() at the highest priority (before env override), and pass kwargs.get("model") from generate(). An unrecognised model name falls through to the existing priority chain.
|
Thanks for the focused fix. The premise remains valid on current main: Suggested changes
Automated hermes-sweeper review. |
GottZ
left a comment
There was a problem hiding this comment.
This was generated by AI during triage.
Summary
Two open PRs address the same xAI model-selection bug: both forward the dispatcher-provided model kwarg into _resolve_model() so the configured top-level image_gen.model is no longer silently dropped. #55893 directly fixes the reported propagation failure and tests the generation payload, while #55927 also adds a redundant direct top-level config fallback but does not test its changed generation path.
Related pull requests
- #55893
related— (+54/-3) — preferred fix: forwardskwargs.get("model")at highest precedence and verifies thatgenerate(model=...)sends and reports the selected xAI model; before merge, the contributor-requested dispatcher-levelHERMES_HOMEregression test should be added to cover the full config propagation path. - #55927
duplicate— (+65/-3) — duplicate of #55893: implements the same forwarding fix and additionally reads top-levelimage_gen.modelinside the provider, but its tests stop at_resolve_model()and do not verify the changedgenerate()call or outbound payload. Despite the keep_open review on #55927, the complete diff shows that earlier #55893 covers the same root-cause fix with stronger generation-path coverage, and the review itself identifies #55893 as having the missing test shape.
Duplicates
#55893 and #55927 implement essentially the same xAI model-kwarg forwarding change; #55927 is the later duplicate of #55893.
Suggested consolidation
Merge #55893 after adding the requested dispatcher-level regression test — it is the earlier, narrower fix and already verifies the outbound xAI payload; close #55927 as a duplicate, since its additional provider-side top-level config read is unnecessary for the documented dispatcher path and does not compensate for its missing generation-path test.
Complex graph
flowchart LR
classDef open fill:#dbeafe,stroke:#1d4ed8,color:#1e3a8a
classDef merged fill:#dcfce7,stroke:#15803d,color:#14532d
classDef closed fill:#e5e7eb,stroke:#6b7280,color:#1f2937
classDef unverified fill:#f3f4f6,stroke:#9ca3af,color:#374151
classDef best stroke-width:3px,stroke:#b45309
classDef target stroke-width:3px,stroke:#4338ca
subgraph Dup55893 ["PRs duplicating each other"]
P55893["PR #55893 (open)"]
P55927["PR #55927 (open)"]
end
class P55893 open
class P55927 open
class P55893 target
click P55893 "https://github.com/NousResearch/hermes-agent/pull/55893"
click P55927 "https://github.com/NousResearch/hermes-agent/pull/55927"
Graph: solid arrow = fixes / best fix, dashed arrow = partial or unverified (see edge label); boxed group = PRs duplicating each other; amber border = best fix; indigo border = target; gray node = closed or no verify verdict yet (state tag in the node label).
Cross-PR triage: Reviewed 2 pull requests and 0 issues in this complex. Each diff was read against this issue; Assessment working set: 9 kB of PR diffs, 5 kB of issue/PR text, 3 kB of discussion (3 comments), 1 verify verdict. verdicts reflect diff content, not PR titles. Part of an automated triage batch.
|
Campaign #80424 collision class — XAI-IMAGE-MODEL This PR is part of a collision class adjudicated under the Grok/xAI campaign rebaseline (2026-08-14). The canonical disposition is recorded on #80424.
Implementation of this class is blocked until Wave 0 (T00-T04) completes classification and the canonical collision/supersession table is agreed. |
|
Thanks @srojk34 — your fix is now on On top of your change we rebased the resolver onto the new live xAI model catalog (validation now happens against live + static models, so the kwarg works for newly released models like Closing since the work has landed. Appreciated! |
…t model; xAI edits honor dispatched model - plugins/image_gen/openrouter: list_models() now queries the endpoint's /models catalog filtered to output_modalities containing "image" (per-backend 5-min cache, 10s timeout, static 2-model chain as offline fallback; openrouter/auto* router pseudo-models excluded). Every image model OpenRouter serves — including future releases — is selectable in `hermes tools` with no code change. Applies to Nous Portal too via the shared provider class. - plugins/image_gen/xai: forward the dispatched model kwarg into _resolve_edit_model() so an explicitly selected edit-capable model is honored on /images/edits (extends the salvaged NousResearch#55893 fix to the edit path; text-only models still fall back to quality). - Tests: OpenRouter live-catalog filtering/exclusions/order, offline fallback, cache single-fetch; xAI edit-kwarg forwarding incl. the text-only-hijack negative case. Live-verified against openrouter.ai: 9 image-output models returned and rendered, matching the public models?output_modalities=image listing.
…t model; xAI edits honor dispatched model - plugins/image_gen/openrouter: list_models() now queries the endpoint's /models catalog filtered to output_modalities containing "image" (per-backend 5-min cache, 10s timeout, static 2-model chain as offline fallback; openrouter/auto* router pseudo-models excluded). Every image model OpenRouter serves — including future releases — is selectable in `hermes tools` with no code change. Applies to Nous Portal too via the shared provider class. - plugins/image_gen/xai: forward the dispatched model kwarg into _resolve_edit_model() so an explicitly selected edit-capable model is honored on /images/edits (extends the salvaged NousResearch#55893 fix to the edit path; text-only models still fall back to quality). - Tests: OpenRouter live-catalog filtering/exclusions/order, offline fallback, cache single-fetch; xAI edit-kwarg forwarding incl. the text-only-hijack negative case. Live-verified against openrouter.ai: 9 image-output models returned and rendered, matching the public models?output_modalities=image listing.
Summary
XAIImageGenProvider.generate()accepts**kwargsbut calls_resolve_model()with no arguments, silently discarding anymodelthe caller passes.tools/image_generation_tool.pyputskwargs["model"] = configured_model(fromimage_gen.modelinconfig.yaml) into everyprovider.generate()call. For the xAI provider, this meant a user selectinggrok-imagine-image-qualityviahermes toolsalways got the defaultgrok-imagine-imagewith no error or log.kwargs.get("model")into its own resolver.Fix
Add an optional
caller_modelparameter to_resolve_model()at the highest priority (aboveXAI_IMAGE_MODELenv and config), and passkwargs.get("model")fromgenerate(). An unrecognised model name falls through to the existing priority chain unchanged.Test plan
test_caller_model_overrides_env— caller model wins overXAI_IMAGE_MODELenvtest_unknown_caller_model_falls_back_to_env— invalid name falls through safelytest_model_kwarg_forwarded_to_generate— end-to-end:generate(model="grok-imagine-image-quality")uses the quality model in the POST payload and resultpytest tests/plugins/image_gen/test_xai_provider.py→ 32 passed, 0 failed