-
-
Notifications
You must be signed in to change notification settings - Fork 39.9k
Closed as not planned
Closed as not planned
Copy link
Description
Bug
The new Grok web_search provider (added in #12419) returns "No response" for all queries. The API call succeeds (200 OK, takes 13-28s as Grok searches), but the response parsing fails silently.
Root Cause
In runGrokSearch(), the response is parsed as:
const content = data.output_text ?? "No response";However, the xAI /v1/responses API does not return output_text at the top level. Instead, the text is nested inside the output array:
{
"output": [
{
"type": "message",
"content": [
{
"type": "output_text",
"text": "The actual response text..."
}
]
}
]
}Since data.output_text is undefined, it always falls through to "No response".
Fix
Extract text from data.output[].content[].text when output_text is not present at the top level:
let content = data.output_text;
if (!content && Array.isArray(data.output)) {
for (const item of data.output) {
if (item.type === "message" && Array.isArray(item.content)) {
for (const part of item.content) {
if (part.type === "output_text" && part.text) {
content = part.text;
break;
}
}
}
if (content) break;
}
}Verified
Applied this patch locally to the bundled JS and confirmed Grok web_search returns full AI-synthesized answers with inline citations.
Environment
- OpenClaw: 2026.2.9
- Model: grok-4-1-fast-reasoning
- Config:
tools.web.search.provider: "grok"
Ref: PR #12419
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels