fix(web-search): fix grok web search returning empty content#13956
Closed
seraphg wants to merge 1 commit intoopenclaw:mainfrom
Closed
fix(web-search): fix grok web search returning empty content#13956seraphg wants to merge 1 commit intoopenclaw:mainfrom
seraphg wants to merge 1 commit intoopenclaw:mainfrom
Conversation
The xAI Responses API returns multiple output items: - output[0]: web_search_call (tool use, no text content) - output[1]: message (contains the actual response text) extractGrokContent was reading output[0] which is the web_search_call item with no text, causing all grok web searches to return 'No response'. Fix: find the 'message' type output item instead of assuming output[0]. Keep fallbacks for non-search responses and legacy output_text field.
092836c to
76f37f8
Compare
|
related: #13648 |
TWFBusiness
added a commit
to TWFBusiness/openclaw-tw
that referenced
this pull request
Feb 11, 2026
- openclaw#14019: prevent cron jobs from skipping execution (nextRunAtMs regression) - openclaw#13931: drain active agent turns before gateway restart - openclaw#14023: filter skills watcher file types to prevent FD exhaustion - openclaw#13983: use requested agentId for isolated cron job auth resolution - openclaw#13956: fix Grok web search returning empty content (xAI Responses API) - openclaw#14018: auto-remind AI to check workspace context files on session reset - openclaw#13960: preserve structured config validation errors in UI - openclaw#13951: improve provider error logging in gateway logs - openclaw#14021: optional memory flush before manual /compact command Co-Authored-By: Claude Opus 4.6 <[email protected]>
bfc1ccb to
f92900f
Compare
Member
|
Closing as duplicate of #13327. If this is incorrect, please contact us. |
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.
Problem
Grok web search via
tools.web.search.provider: grokalways returned 'No response'.Root Cause
The xAI
/v1/responsesAPI returns multiple output items when web search is used:output[0]:web_search_call(tool invocation, no text)output[1]:message(actual response with text)extractGrokContent()was hardcoded to readoutput[0].content[0].text, which is the web search tool call — it has no text content.Fix
Find the
messagetype output item via.find()instead of assuming index 0. Added fallbacks for non-search responses and the legacyoutput_textfield.Testing
Verified with live xAI API — search queries now return full content with citations.
Greptile Overview
Greptile Summary
This change updates Grok (xAI
/v1/responses) web-search parsing to pull the assistant text from theoutput[]item withtype === "message", instead of assumingoutput[0]contains text. It also keeps a fallback to the first output item for non-search responses and preserves support for the legacyoutput_textfield.Overall, the change is localized to
extractGrokContent()insrc/agents/tools/web-search.tsand aligns with the described xAI response shape when web search is enabled (tool call item followed by message item).Confidence Score: 5/5
(2/5) Greptile learns from your feedback when you react with thumbs up/down!