← Back to PRs

#16416: feat(web-search): include Brave structured faq/discussions/infobox results

by ciberponk open 2026-02-14 18:42 View on GitHub →
agents size: S
## Summary - feat(web-search): include Brave structured faq/discussions/infobox results - Split from our `v2026.2.13` patch train as a single-purpose change for easier review. ## Why - Keep the diff focused and low-risk so it can be merged or reverted independently. ## Scope - Branch: `feat/brave-structured-results-lite-en` - Files changed: 2 - Key files: - `src/agents/tools/web-search.ts` - `src/agents/tools/web-tools.enabled-defaults.e2e.test.ts` ## Test Plan - Suggested local command: - `./node_modules/.bin/vitest run src/agents/tools/web-tools.enabled-defaults.e2e.test.ts` - Validation status: - [ ] CI checks pass - [ ] Maintainer re-ran local tests ## Risk & Rollback - Risk: low to medium; impact limited to touched module(s). - Rollback: revert this PR commit(s) cleanly. ## Co-authorship - Co-authored by @ciberponk and Codex (GPT-5). <!-- greptile_comment --> <h3>Greptile Summary</h3> This PR enriches Brave Search results by extracting and forwarding three additional structured data types from the Brave API response: **discussions** (forum threads with top comments), **FAQ** entries, and **infobox** panels. All external text content is properly wrapped via `wrapWebContent` for security, while URLs are passed through unwrapped — consistent with the existing web result handling pattern. - Extends `BraveSearchResponse` type with `discussions`, `faq`, and `infobox` fields - Adds formatting/filtering logic that mirrors the existing web results pattern: map, wrap content, filter empty entries, conditionally spread into payload - New structured fields are only included when non-empty, keeping the payload backward-compatible - Adds a well-structured e2e test covering all three new result types with security wrapping assertions - No issues found; the implementation is clean, follows existing conventions, and handles edge cases (empty/missing data) correctly <h3>Confidence Score: 5/5</h3> - This PR is safe to merge — it is purely additive, follows existing security and coding patterns, and includes test coverage. - The changes are well-scoped: a type extension, additive data formatting that reuses the established `wrapWebContent` security wrapper, conditional payload inclusion that preserves backward compatibility, and a thorough e2e test. No existing behavior is modified, no new dependencies are introduced, and all external content is properly wrapped. The code follows the existing patterns in the file closely. - No files require special attention. <sub>Last reviewed commit: cffd911</sub> <!-- greptile_other_comments_section --> <!-- /greptile_comment -->

Most Similar PRs