Skip to content

fix(xai): forward image_gen.model kwarg to _resolve_model in generate() - #10

Open
hashbender wants to merge 1 commit into
mainfrom
mirror/pr-55893
Open

fix(xai): forward image_gen.model kwarg to _resolve_model in generate()#10
hashbender wants to merge 1 commit into
mainfrom
mirror/pr-55893

Conversation

@hashbender

Copy link
Copy Markdown
Owner

Summary

  • XAIImageGenProvider.generate() accepts **kwargs but calls _resolve_model() with no arguments, silently discarding any model the caller passes.
  • tools/image_generation_tool.py puts kwargs["model"] = configured_model (from image_gen.model in config.yaml) into every provider.generate() call. For the xAI provider, this meant a user selecting grok-imagine-image-quality via hermes tools always got the default grok-imagine-image with no error or log.
  • Mirrors the fix applied to the OpenRouter provider in PR fix(image-gen): honor image_gen.model for Nous/OpenRouter provider NousResearch/hermes-agent#55672, which already threads kwargs.get("model") into its own resolver.

Fix

Add an optional caller_model parameter to _resolve_model() at the highest priority (above XAI_IMAGE_MODEL env and config), and pass kwargs.get("model") from generate(). An unrecognised model name falls through to the existing priority chain unchanged.

Test plan

  • test_caller_model_overrides_env — caller model wins over XAI_IMAGE_MODEL env
  • test_unknown_caller_model_falls_back_to_env — invalid name falls through safely
  • test_model_kwarg_forwarded_to_generate — end-to-end: generate(model="grok-imagine-image-quality") uses the quality model in the POST payload and result

pytest tests/plugins/image_gen/test_xai_provider.py → 32 passed, 0 failed


Mirror-of: NousResearch#55893
NousResearch#55893

@tenki-reviewer

tenki-reviewer Bot commented Jun 30, 2026

Copy link
Copy Markdown

Review Complete
No issues found!

Risk: 🟠 High (72/100) — no findings · 57 LOC across 2 files


New xAI image generation provider plugin adds a missing 401/OAuth token refresh retry gap found against the sister xAI web search provider pattern; other findings fall below confidence threshold.

Files Reviewed (2 files)
plugins/image_gen/xai/__init__.py
tests/plugins/image_gen/test_xai_provider.py

hashbender pushed a commit that referenced this pull request Jul 27, 2026
…e_check_xsrf pitfalls

Add two pitfalls discovered when running the skill against a fresh
Jupyter server:

- Pitfall #9: When the websocket reply channel hangs on every execute
  even though the kernel actually ran (REST shows execution_state=idle
  and execution_count increments), force zmq transport with
  --transport zmq. The zmq transport uses jupyter_client directly and
  sidesteps the broken websocket layer.

- Pitfall #10: A fresh ServerApp rejects POST /api/sessions with
  "_xsrf argument missing from POST" unless you start it with
  --ServerApp.disable_check_xsrf=True. Needed for REST-only flows
  where no browser/cookie is establishing the XSRF token.
hashbender pushed a commit that referenced this pull request Aug 11, 2026
…lves

A session title had no notion of who set it, so two bugs followed. An
auto-generated title could clobber a name the user typed, and every
compression rotation renumbered the conversation it forked - one piece of
work reaching 'Smallville Map Architecture Plan #10' in the sidebar.

Titles now carry a source (derived < llm < user) enforced by one
compare-and-swap, so an automatic write can only ever replace a title of
strictly lower authority. Compression carries the name across unchanged.
Legacy NULL rows rank as user, so auto-titling only fills genuinely
empty titles on existing data.
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.

1 participant