fix(fold-xai): use Chat Completions for xAI tool calls - #10
Merged
Conversation
xAI's Responses API (/v1/responses) has incomplete support for streaming tool calls, causing the stream to hang when Grok tries to call tools. Switch fold-xai from @effect/ai-openai (Responses API) to @effect/ai-openai-compat (Chat Completions API), matching the approach fold-opencode already uses for grok models. Also bumps the default model to grok-4.6. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> HumanLayer-Session: https://app.dev.codelayer.gg/sessions/01a01c8a-7828-7f4b-b361-efcd6a9501f1
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> HumanLayer-Session: https://app.dev.codelayer.gg/sessions/01a01c8a-7828-7f4b-b361-efcd6a9501f1
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.
Summary
fold-xaifrom@effect/ai-openai(Responses API) to@effect/ai-openai-compat(Chat Completions API)/v1/responsesendpoint has incomplete streaming support for tool calls — the stream hangs when Grok tries to call tools, leaving the session stuck with no assistant responsefold-opencodealready handles this by routing grok models through Chat Completions; this applies the same fix to the direct xAI OAuth providergrok-4.5togrok-4.6(released Aug 12)Test plan
bun vitest runinpackages/fold-xai— 3/3 tests passbun --bun run typecheck --filter @humanlayer/fold-xai— clean🤖 Generated with Claude Code