Repository navigation
fix(xai): preserve all response text blocks and citations - #118477
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed August 3, 2026, 1:23 AM ET / 05:23 UTC. ClawSweeper reviewWhat this changesThe PR changes the bundled xAI plugin’s shared Responses parser to concatenate ordered text blocks and retain unique URL citations, with regression coverage at the shared parser and code-execution HTTP boundary. Merge readiness⛔ Blocked until stronger real behavior proof is added - 3 items remain This PR remains necessary: current main stops at the first non-empty xAI Priority: P1 Review scores
Verification
How this fits togetherThe bundled xAI plugin sends web-search, X-search, and code-execution requests to xAI’s Responses API. Each tool passes the returned JSON through one shared parser before handing text and citations to OpenClaw’s tool result. flowchart LR
A[xAI Responses API] --> B[Response JSON]
B --> C[Shared xAI response parser]
C --> D[Complete text and citations]
D --> E[Web search tool]
D --> F[X search tool]
D --> G[Code execution tool]
Before merge
Agent review detailsSecurityNone. PR surfaceSource -1, Tests +97. Total +96 across 3 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep the shared-parser repair, then attach redacted evidence from a real xAI response containing multiple output-text blocks that visibly shows the full reconstructed text and ordered citation result after the fix. Do we have a high-confidence way to reproduce the issue? Yes, from source: a response whose first Is this the best way to solve the issue? Yes: repairing the shared xAI Responses parser is the narrowest maintainable solution because all three affected tools consume that owner, and the branch avoids parallel per-tool parsing logic. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against d2c78e189b12. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
History |
|
Merged via squash.
|
What Problem This Solves
xAI web search, X search, and code execution silently discarded later response text blocks or citations when provider output contained multiple message segments.
Why This Change Was Made
The shared xAI Responses owner collects every ordered text block and citation using the same
texts.join("")contract implemented by the official OpenAI SDK.User Impact
Search and code-execution tools preserve complete answers and source references instead of returning truncated content.
Real Authenticated Provider Proof
The exact committed owner was exercised through the actual authenticated xAI X-search tool on an isolated Testbox: one real
grok-4.3request, nonempty real provider response, real citations present, no billing skip; existing live test passed 1/1. Testbox: https://github.com/openclaw/openclaw/actions/runs/30785523517.Actual HTTP Multi-Block Proof
The public
createCodeExecutionTool.executeowner consumes a real HTTPResponsewhose provider-shaped body contains one code-interpreter call, two separate message objects, three distinct text blocks, and overlapping citation annotations:A second shared-owner HTTP fixture interleaves a web-search call, nested blocks, a top-level output-text item, and a later message:
The live provider—not its client—chooses how many output-text blocks any one request emits; no xAI client option can force multiple blocks. Repeating paid stochastic provider requests would not strengthen the deterministic real-HTTP owner proof. One authenticated real-provider invocation proves production connectivity and citations; the deterministic actual HTTP fixtures prove the exact multi-block invariant and all three sibling tools.
Regression Evidence
[email protected]ResponsesParser.tsiterates all message/output_text blocks and concatenates them.