fix(claude): sanitize WebSearch domain filters for routed models - #383
Conversation
Omit empty allowed_domains/blocked_domains and resolve mutual exclusion before Claude Code sees tool_use input, so GPT-routed WebSearch calls stop tripping Anthropic/Claude Code validation (#381).
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughAdds WebSearch domain-filter sanitization to Claude JSON and SSE translation. Empty filters are omitted, conflicting non-empty filters favor ChangesWebSearch translation
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant OpenAIResponsesSSE
participant SSETranslator
participant closeOpenBlock
participant AnthropicStream
OpenAIResponsesSSE->>SSETranslator: function_call and argument delta frames
SSETranslator->>SSETranslator: buffer WebSearch arguments
OpenAIResponsesSSE->>SSETranslator: output_item.done
SSETranslator->>closeOpenBlock: close buffered tool_use
closeOpenBlock->>AnthropicStream: one sanitized input_json_delta
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Ingwannu
left a comment
There was a problem hiding this comment.
Verified against current dev. The reported Claude Code failure is real: routed WebSearch calls may contain empty or mutually exclusive domain filters, and this patch sanitizes both JSON and SSE translation paths without weakening terminal handling. I also reran the focused suite (25/25) and TypeScript typecheck at ed9e4ee; both passed, and required CI is green.
…domains fix(claude): sanitize WebSearch domain filters for routed models
Summary
WebSearch/web_search*tool_use inputs from routed models: omit emptyallowed_domains/blocked_domains, and if both are non-empty keepallowed_domainsonly.input_json_delta).Fixes #381.
Test plan
bun run typecheckbun test tests/claude-outbound.test.ts(25 pass)gpt-5.6-sol) asking for a domain-filtered web search no longer 400s on empty domain arraysSummary by CodeRabbit