fix: Grok web_search extracts output_text blocks at top level#20508
Merged
Takhoffman merged 2 commits intoopenclaw:mainfrom Feb 20, 2026
Merged
fix: Grok web_search extracts output_text blocks at top level#20508Takhoffman merged 2 commits intoopenclaw:mainfrom
Takhoffman merged 2 commits intoopenclaw:mainfrom
Conversation
Some xAI Responses API responses place output_text blocks directly in the output array without a message wrapper. The parser only looked for output_text inside message.content blocks, missing these top-level entries entirely. Add a fallback path that checks for output_text blocks at the top level of the output array, extracting text and url_citation annotations.
0babd11 to
29eb6ed
Compare
Contributor
|
PR #20508 - fix: Grok web_search extracts output_text blocks at top level (#20508) Merged via squash.
Thanks @echoVic! |
This was referenced Feb 20, 2026
vignesh07
pushed a commit
to pahdo/openclaw
that referenced
this pull request
Feb 20, 2026
…aw#20508) thanks @echoVic Verified: - pnpm build - pnpm check - pnpm test:macmini Co-authored-by: echoVic <[email protected]> Co-authored-by: Tak Hoffman <[email protected]>
anisoptera
pushed a commit
to anisoptera/openclaw
that referenced
this pull request
Feb 20, 2026
…aw#20508) thanks @echoVic Verified: - pnpm build - pnpm check - pnpm test:macmini Co-authored-by: echoVic <[email protected]> Co-authored-by: Tak Hoffman <[email protected]>
rodrigogs
pushed a commit
to rodrigogs/openclaw
that referenced
this pull request
Feb 20, 2026
…aw#20508) thanks @echoVic Verified: - pnpm build - pnpm check - pnpm test:macmini Co-authored-by: echoVic <[email protected]> Co-authored-by: Tak Hoffman <[email protected]>
Hansen1018
added a commit
to Hansen1018/openclaw
that referenced
this pull request
Feb 21, 2026
…aw#20508) thanks @echoVic Verified: - pnpm build - pnpm check - pnpm test:macmini Co-authored-by: echoVic <[email protected]> Co-authored-by: Tak Hoffman <[email protected]>
vincentkoc
pushed a commit
that referenced
this pull request
Feb 21, 2026
… thanks @echoVic Verified: - pnpm build - pnpm check - pnpm test:macmini Co-authored-by: echoVic <[email protected]> Co-authored-by: Tak Hoffman <[email protected]>
vincentkoc
pushed a commit
that referenced
this pull request
Feb 21, 2026
… thanks @echoVic Verified: - pnpm build - pnpm check - pnpm test:macmini Co-authored-by: echoVic <[email protected]> Co-authored-by: Tak Hoffman <[email protected]>
mmyyfirstb
pushed a commit
to mmyyfirstb/openclaw
that referenced
this pull request
Feb 21, 2026
…aw#20508) thanks @echoVic Verified: - pnpm build - pnpm check - pnpm test:macmini Co-authored-by: echoVic <[email protected]> Co-authored-by: Tak Hoffman <[email protected]>
obviyus
pushed a commit
to guirguispierre/openclaw
that referenced
this pull request
Feb 22, 2026
…aw#20508) thanks @echoVic Verified: - pnpm build - pnpm check - pnpm test:macmini Co-authored-by: echoVic <[email protected]> Co-authored-by: Tak Hoffman <[email protected]>
6 tasks
hughdidit
pushed a commit
to hughdidit/DAISy-Agency
that referenced
this pull request
Mar 1, 2026
…aw#20508) thanks @echoVic Verified: - pnpm build - pnpm check - pnpm test:macmini Co-authored-by: echoVic <[email protected]> Co-authored-by: Tak Hoffman <[email protected]> (cherry picked from commit 2144850) # Conflicts: # CHANGELOG.md # src/agents/tools/web-search.e2e.test.ts # src/agents/tools/web-search.ts
hughdidit
pushed a commit
to hughdidit/DAISy-Agency
that referenced
this pull request
Mar 3, 2026
…aw#20508) thanks @echoVic Verified: - pnpm build - pnpm check - pnpm test:macmini Co-authored-by: echoVic <[email protected]> Co-authored-by: Tak Hoffman <[email protected]> (cherry picked from commit 2144850) # Conflicts: # CHANGELOG.md # src/agents/tools/web-search.e2e.test.ts # src/agents/tools/web-search.ts
zooqueen
pushed a commit
to hanzoai/bot
that referenced
this pull request
Mar 6, 2026
…aw#20508) thanks @echoVic Verified: - pnpm build - pnpm check - pnpm test:macmini Co-authored-by: echoVic <[email protected]> Co-authored-by: Tak Hoffman <[email protected]>
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.
Some xAI Responses API responses place output_text blocks directly in the output array without a message wrapper. The parser only looked for output_text inside message.content blocks, missing these top-level entries entirely.
This adds a fallback path that checks for output_text blocks at the top level of the output array, extracting text and url_citation annotations.
Includes test coverage for the new code path.
Greptile Summary
This PR fixes a parsing bug in the Grok web search tool where xAI API responses with top-level
output_textblocks (not wrapped in a message) were being ignored. The fix adds a fallback path inextractGrokContentthat checks foroutput_textblocks directly in theoutputarray and extracts both text content andurl_citationannotations.textandannotationsfields to theGrokSearchResponsetype definition to handle top-level output blocksextractGrokContentfunction (lines 163-179 in web-search.ts) that processes unwrappedoutput_textblocksoutput_textfieldConfidence Score: 5/5
Last reviewed commit: 0babd11