v0.50.0.1 feat(ai): OpenRouter xAI (x-ai/) routes may drive the subagent loop — live abort/retry pin - #5035
Open
danpal35 wants to merge 1 commit into
Open
Conversation
… live abort/retry pin Add `x-ai/` to OPENROUTER_SUBAGENT_FAMILIES so `openrouter:x-ai/*` models (Grok 4.6 etc.) are accepted by classifyCapabilities() and auto-routed through gateway.toolLoop(), the same way anthropic/ and deepseek/ are. The admission ticket for a family is a live abort/retry pin proving the proxied tool-call envelope survives an abort mid-loop and a resume byte-identically. test/e2e/openrouter-xai-subagent-replay.live.test.ts is that pin for xAI: first turn calls the tool once, the job aborts after the observation, the resume finishes with end_turn without re-executing the tool and the persisted assistant content_blocks are identical across the resume. Skip-gated on OPENROUTER_API_KEY like the Anthropic and DeepSeek pins. Also pins the family in the deterministic model-config unit test and updates the recipe docstrings that enumerate the allowed families. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
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
openrouter:x-ai/*models (Grok 4.6 etc.) can now drive the subagent loop.x-ai/joinsanthropic/anddeepseek/inOPENROUTER_SUBAGENT_FAMILIES, soclassifyCapabilities()accepts the model and the handler auto-routes the job throughgateway.toolLoop(). Every other OpenRouter family stays refused, as before.Why
The families registry says a proxied family is admitted only once it has a live abort/retry pin proving its tool-call envelope survives an abort mid-loop and a resume byte-identically. Anthropic and DeepSeek have one; xAI did not, so a brain configured with
openrouter:x-ai/grok-4.6as its subagent model was refused even though the OpenAI-compatible envelope OpenRouter uses for xAI replays cleanly (the gateway keys replay ongbrain_tool_use_id, not the provider id).test/e2e/openrouter-xai-subagent-replay.live.test.tsis that pin, a sibling of the DeepSeek one: first turn calls the tool once, the job aborts after the observation, the resume finishes withend_turnwithout re-executing the tool, and the persisted assistantcontent_blocksare identical across the resume. Skip-gated onOPENROUTER_API_KEY.I have been running Grok 4.6 as the subagent model on a Postgres brain with this one-line change carried as a local patch since 2026-09-01 (dream / autopilot subagent jobs), with no replay problems.
Discrimination test (required for every fix — #3665)
Discrimination test: reverted
src/core/ai/openrouter-families.tsto merge-base, rantest/model-config.serial.test.ts→ 45 pass / 1 fail. Restored → all pass.Discrimination test: reverted
src/core/ai/openrouter-families.tsto merge-base, rantest/e2e/openrouter-xai-subagent-replay.live.test.ts→ 0 pass / 1 fail. Restored → all pass.Tests
GBRAIN_TEST_KEEP_PROVIDER_KEYS=1 OPENROUTER_API_KEY=… bun test test/e2e/openrouter-xai-subagent-replay.live.test.ts→ 1 pass, 7 expect() calls, ~4s against live OpenRouterx-ai/grok-4.6. Run twice, both green.bun test test/model-config.serial.test.ts→ 46 pass (addsisOpenRouterSubagentFamily('openrouter:x-ai/grok-4.6')→ true).bun run typecheckclean.src/core/ai/recipes/openrouter.tsthat enumerate the allowed families updated to include xAI.🤖 Generated with Claude Code