Skip to content

fix(models): add xAI provider prefixes to _PROVIDER_PREFIXES - #7398

Closed
konsisumer wants to merge 1 commit into
NousResearch:mainfrom
konsisumer:fix/xai-provider-prefix
Closed

fix(models): add xAI provider prefixes to _PROVIDER_PREFIXES#7398
konsisumer wants to merge 1 commit into
NousResearch:mainfrom
konsisumer:fix/xai-provider-prefix

Conversation

@konsisumer

@konsisumer konsisumer commented Apr 10, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add "xai", "x-ai", and "x.ai" to _PROVIDER_PREFIXES in agent/model_metadata.py
  • Without these entries, _strip_provider_prefix() cannot strip xAI prefixes from model strings like "xai:grok-4", causing silent failures in context-length lookups and model metadata queries
  • The xAI overlay and aliases were added in 8bcb8b8e but _PROVIDER_PREFIXES was not updated

Test plan

  • New test_xai_provider_prefix_is_stripped test verifying all three aliases
  • All 6 TestStripProviderPrefix tests pass

Closes #7575

@konsisumer
konsisumer force-pushed the fix/xai-provider-prefix branch from 9c4ff1b to aa71070 Compare April 10, 2026 22:39
@konsisumer

Copy link
Copy Markdown
Contributor Author

Rebased onto latest origin/main and fixed all 35 pre-existing CI test failures (none introduced by this PR):

Fix Tests
Add _session_model_overrides = {} to GatewayRunner fixtures 13
Add request_overrides = {} to AIAgent fixture in test_ctx_halving_fix.py 4
Add is_recording property to AudioRecorder (only existed on TermuxAudioRecorder) 5
Add _attached_images = [] to voice CLI test helper 2
Fix Telegram builder mock chain (add .request() / .get_updates_request()) 4
Replace deleted BuiltinMemoryProvider import with RecordingProvider 1
Update config version assertion 13 → 14 1
Update terminal tool emoji assertion ⚙️ → 💻 1
Resolved by rebase onto main 4
Total 35

@konsisumer

Copy link
Copy Markdown
Contributor Author

Fixed the 3 failing test_auth_provider_gate.py tests. Root cause: CI has ANTHROPIC_API_KEY set in the environment, which makes is_provider_explicitly_configured('anthropic') return True via the env-var check path — even when the test expects False (no config, different provider, or oauth-only scenarios).

Fix: added monkeypatch.delenv("ANTHROPIC_API_KEY", raising=False) and monkeypatch.delenv("ANTHROPIC_TOKEN", raising=False) to the 3 affected tests so they properly isolate from CI secrets.

@konsisumer
konsisumer force-pushed the fix/xai-provider-prefix branch from db32116 to 027215e Compare April 10, 2026 23:32
@konsisumer

Copy link
Copy Markdown
Contributor Author

Rebased onto latest origin/main and fixed the failing test check.

Root cause: commit d8cd7974 (fix(feishu): register group chat member event handlers) added two new builder calls — register_p2_im_chat_member_bot_added_v1 and register_p2_im_chat_member_bot_deleted_v1 — to FeishuAdapter._build_event_handler(), but the _Builder mock class in test_build_event_handler_registers_reaction_and_card_processors was not updated, causing an AttributeError when the production code called the missing method.

Fix: Added both methods to the test's _Builder mock and updated the expected calls list to include "bot_added" and "bot_deleted".

The recent xAI provider commit (8bcb8b8) added the overlay and aliases
in providers.py but omitted updating _PROVIDER_PREFIXES in
model_metadata.py. Without "xai", "x-ai", and "x.ai" in the set,
_strip_provider_prefix() cannot strip them, causing model strings like
"xai:grok-4" to fail context-length lookups silently.
@konsisumer
konsisumer force-pushed the fix/xai-provider-prefix branch from 11a949a to 7d9f203 Compare April 17, 2026 10:29
@konsisumer

Copy link
Copy Markdown
Contributor Author

Closing: referenced_issue_closed. all referenced issues closed: [7575]


autocontrib · housekeeping · 2026-04-19T11:40:22Z

@konsisumer konsisumer closed this Apr 19, 2026
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]: xAI provider prefixes missing from _PROVIDER_PREFIXES

1 participant