fix(deploy): map grok/xai models to the xai provider for credential matching#236
Conversation
…atching deriveModelProvider special-cased anthropic/openai/google/openrouter but had no grok/xai case, so a grok persona's `model: "grok-build"` fell through to the generic `split(/[/:]/)` and resolved to the literal provider key "grok-build". The credential `relay cloud connect xai` stores is keyed `harness: "grok"` (modelProvider "xai"), so "grok-build" matched neither target. The OAuth probe reported "credentials are not connected" even when xai was connected, re-prompted for a browser reconnect that polled for a "grok-build" row that never appears, and the deploy looped (or fell to the plan path and 403'd on workspaces without relay-managed grok). Map grok/xai/x-ai models to provider "xai" and alias "xai" -> "grok" (mirroring anthropic->claude, openai->codex), so the connected harness="grok" entry is recognized and the oauth deploy proceeds. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
Caution Review failedPull request was closed or merged during review No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughAdds XAI provider support to the cloud deployment mode: ChangesXAI/Grok provider alias and connected-probe test
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Problem
Deploying a grok persona to cloud fails to recognize a connected xAI credential. Even after
relay cloud connect xaisucceeds, the deploy reports:…and accepting the default
planthen fails on workspaces without relay-managed grok:Choosing
oauthdoesn't help either — it re-launches a browser connect and polls for a credential row that never matches, so the deploy loops.Root cause
deriveModelProviderspecial-casesanthropic/openai/google/openroutervia token matching, but has no grok/xai case. A grok persona declaresmodel: "grok-build", which falls through to the genericmodel.split(/[/:]/)and resolves to the literal provider key"grok-build".The credential
relay cloud connect xaistores is keyedharness: "grok"(modelProvider"xai"):{ "harness": "grok", "modelProvider": "xai", "authType": "provider_oauth", "status": "connected", "isActive": true }"grok-build"matches neither"grok"nor"xai", sohasConnectedHarnessreturns false → the probe says "not connected" → re-prompt / loop.Fix
Mirror the existing provider/alias pattern (anthropic→claude, openai→codex, openrouter→opencode):
deriveModelProvider: mapgrok/xai/x-aimodels → provider"xai"harnessAliasForModelProvider: alias"xai"→"grok"So
deriveModelProvider("grok-build")→"xai", the match targets become{"xai", "grok"}, and the connectedharness: "grok"entry is recognized. The oauth deploy then proceeds without a browser reconnect or the plan-path 403.Grok remains harness-only for
ctx.llm(same as codex/opencode subscriptions) — the persona runs through the grok harness viaharness.run, so noctx.llmcredential selection is stamped, which is expected.Test
Adds a regression test: a grok persona (
model: "grok-build") with a credential connected underharness: "grok"resolves silently and deploys, with no browser reconnect. Verified it fails without the fix (grok OAuth credentials are not connected) and passes with it.🤖 Generated with Claude Code