fix(tavily): reject blank extract URLs#111333
Conversation
|
Codex review: needs maintainer review before merge. Reviewed July 19, 2026, 10:02 AM ET / 14:02 UTC. Summary PR surface: Source 0, Tests +22. Total +22 across 2 files. Reproducibility: yes. source inspection gives a high-confidence path: call Review metrics: none identified. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Keep validation in Do we have a high-confidence way to reproduce the issue? Yes, source inspection gives a high-confidence path: call Is this the best way to solve the issue? Yes. Normalizing at the dedicated extract-tool boundary is the narrowest maintainable fix because it rejects blank input before cache-key construction and the provider request, without changing Tavily search or shared plugin SDK behavior. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 7ea4e6701ed4. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source 0, Tests +22. Total +22 across 2 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
Review history (1 earlier review cycle)
|
03fad64 to
cfe24e7
Compare
Co-authored-by: chatgpt-codex-connector[bot] <199175422+chatgpt-codex-connector[bot]@users.noreply.github.com>
Co-authored-by: VectorPeak <[email protected]>
cfe24e7 to
b938e94
Compare
|
Merged via squash.
|
* fix(tavily): reject blank extract URLs Co-authored-by: chatgpt-codex-connector[bot] <199175422+chatgpt-codex-connector[bot]@users.noreply.github.com> * fix(tavily): normalize tool string arrays Co-authored-by: VectorPeak <[email protected]> --------- Co-authored-by: chatgpt-codex-connector[bot] <199175422+chatgpt-codex-connector[bot]@users.noreply.github.com> Co-authored-by: Peter Steinberger <[email protected]>
Additional instructions
MUST: Keep Allow edits from maintainers enabled for this PR so maintainers
can help update the branch when needed.
What Problem This Solves
Fixes an issue where users or model-generated tool calls could invoke
tavily_extractwith only whitespace in theurlsarray and bypass OpenClaw's local "requires at least one URL" validation.The extract tool previously used truthiness filtering, so
urls: [""]was rejected locally, buturls: [" "]was treated as one URL and forwarded to Tavily. That pushed an invalid request across the provider boundary instead of returning the same local validation error users already get for an empty URL list.Why This Change Was Made
The extract tool now trims each string URL entry before filtering blank values. This keeps the fix inside Tavily's local
tavily_extractparameter normalization and leaves Tavily search, provider config, HTTP client behavior, cache keys, and response wrapping unchanged.The implementation also preserves useful surrounding whitespace handling: a valid value such as
" https://example.com/article "is normalized to"https://example.com/article"before the Tavily request is built.User Impact
Users get a fast, deterministic OpenClaw validation error when
tavily_extractreceives only blank URL entries, instead of waiting for the Tavily API to reject an invalid URL payload.Valid pasted URLs with accidental leading or trailing whitespace continue to work and are sent to Tavily in normalized form.
Evidence
User-realistic call chain:
Before this change, the same payload survived
urls.filter(Boolean)because a whitespace-only string is truthy, then reachedrunTavilyExtract({ urls: [" "] }).After this change, the focused regression test proves both sides of the behavior:
Real before/after runtime proof, using the actual
createTavilyExtractTool()path, the real Tavily client HTTP path, a redacted fake Tavily key, and a public request-capture endpoint instead of the real Tavily API:That before-run shows both inputs crossed OpenClaw's local tool boundary and reached the provider request path with the original untrimmed values.
The after-run shows the whitespace-only URL now fails locally with the intended
tavily_extractvalidation error and creates no outbound request. The padded valid URL still reaches the real extract HTTP path, but the captured request body contains the normalized URL. The finalmalformed JSON responseis expected because the request-capture endpoint is not the Tavily API; it is used only to prove the outbound request payload without any real credentials.Sibling surfaces checked: this PR only changes the dedicated
tavily_extractURL list normalization.tavily_searchquery/domain filtering, Tavily client request construction, cache keys, response wrapping, provider config, and search provider behavior are unchanged.Validation:
Local limitation: