GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat(core): add brave web search by nazerim · Pull Request #58334 · anomalyco/opencode

Conversation

@nazerim

@nazerim nazerim commented Oct 23, 2026 •
edited by opencode-agent Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Issue for this PR

Closes #58328

Type of change

  • New feature
  • Bug fix
  • Refactor / code improvement
  • Documentation

What does this PR do?

Adds Brave Search as a built-in web search provider. This re-lands #48222 by @jonathansampson, which was closed by the automated PR cleanup (age, fewer than 2 reactions) before a maintainer saw it; #58328 asked for a resubmission, so here it is, adapted to current dev.

Brave Search authenticates with the X-Subscription-Token header against GET https://api.search.brave.com/res/v1/web/search, and every request needs a key. The provider therefore registers only once a key exists — BRAVE_API_KEY, BRAVE_SEARCH_API_KEY, or a key on the Brave Search integration — and re-registers on credential.updated / credential.switched. Putting an unconfigured provider into the "random" rotation would wedge a session, because a non-429 failure is neither cooled down nor retried against another provider. The key is re-resolved per request so a key removed after registration cannot be reused.

Mapping notes: snippets are requested with text_decorations=false (they otherwise arrive wrapped in <strong> markup) and extra_snippets=true (the API docs state no default). page_age is a zoneless-but-UTC timestamp, so a Z is appended before parsing; the human-readable age sibling is deliberately ignored since it never appears without page_age.

Three adaptations relative to #48222, because dev moved underneath it:

  • effect/unstable/http imports became effect/http.
  • The rate-limit test case table now also covers TinyFish, which landed after the original PR.
  • No tool-renderer.tsx change: the provider-label if-chain was refactored into a name map whose capitalize fallback already renders "brave" as "Brave".

How did you verify your code works?

  • bun test test/plugin/websearch.test.ts (packages/core): 17 pass, including 5 new Brave cases — result mapping plus request params/headers, key-gated registration with credential-event re-registration, unconfigured Brave excluded from random selection (10 consecutive queries stay on tavily), failure when the key is removed after registration, and page_age parsed as UTC under TZ=America/Chicago.
  • Whole test/plugin directory: 438 pass. tsc -b tsconfig.json tsconfig.tests.json clean; oxlint clean on all changed files.
  • Live check against the real API today: the endpoint returns results whose fields match the response schema, page_age arrives zoneless, and text_decorations=false suppresses the highlight markup. The original PR was also verified live against the API by its author.

Screenshots / recordings

Not a UI change.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Added by the opencode bot (AI-generated).

Related: #54311, #58327

Public API: adds the brave web search provider and integration, read from the BRAVE_API_KEY / BRAVE_SEARCH_API_KEY environment variables (backwards compatible)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

jonathansampson, faheem-nadeem, remusao, lina-kram, kkarikos, saberistic, emsearcy, and antonok-edm reacted with thumbs up emoji
All reactions
  • 👍 8 reactions
@nazerim @jonathansampson
feat(core): add brave web search
bbd44c6
Re-lands anomalyco#48222, which was closed by automated PR cleanup before maintainer
review; anomalyco#58328 requested the resubmission.

Brave Search requires a subscription token on every request, so the provider
registers only once a key exists (BRAVE_API_KEY, BRAVE_SEARCH_API_KEY, or a
key on the Brave Search integration) and re-registers when credentials
change. An unconfigured provider in the random rotation would wedge the
session, since a non-429 failure is neither cooled down nor retried against
another provider. The key is re-resolved per request so a key removed after
registration cannot be reused.

Adapted to current dev: effect/unstable/http imports became effect/http, the
rate-limit test table now also covers TinyFish, and no tool-renderer change
is needed because the provider-name fallback already renders "Brave".

Co-authored-by: Sampson <[email protected]>
@nazerim
nazerim marked this pull request as ready for review October 23, 2026 04:05
@nazerim nazerim mentioned this pull request Oct 23, 2026
feat(core): add brave web search #48222
Closed
3 of 6 tasks
opencode-agent[bot]
opencode-agent Bot reviewed Oct 23, 2026
View reviewed changes

@opencode-agent opencode-agent Bot left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me. I ran opencode serve from this branch: with BRAVE_API_KEY set, GET /api/websearch/provider lists brave ("Brave Search") alongside the existing five, and without the key it is left out. test/plugin/websearch.test.ts (17) and the whole test/plugin directory (438) pass, and tsc -b is clean. I didn't call the live Brave API.

The other built-in providers all work without a key, so Brave is the first that needs one. Keeping it out of the provider list until a key exists, and re-checking on credential events, is a reasonable way to keep an unusable provider out of the random rotation. The brave integration is still always registered, so a key can be added through /connect.

Public API: all additions, backwards compatible. New web search provider ID brave, integration ID brave, and environment variables BRAVE_API_KEY / BRAVE_SEARCH_API_KEY. Nothing existing changes.

One thing worth adding: the providers table in services/www/src/docs/content/websearch.mdx still says "five search providers" and has no Brave row. Brave is also the only provider that needs a key, so it would help to say that it only shows up once BRAVE_API_KEY / BRAVE_SEARCH_API_KEY or a /connect key is set.

Related: #54311, #58327

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@nazerim
docs(www): add Brave to the websearch providers table
f870161
Brave is the only built-in provider that requires a key, so the table row
alone would overstate availability: note that it registers only once
BRAVE_API_KEY / BRAVE_SEARCH_API_KEY or a /connect key exists.
@nazerim

nazerim commented Oct 23, 2026

Copy link
Copy Markdown
Author

The docs gap from the review is addressed in f870161: the providers table in websearch.mdx gains a Brave row (six providers now), plus a sentence noting Brave is the only provider that requires a key and therefore only appears in the provider list and random rotation once BRAVE_API_KEY / BRAVE_SEARCH_API_KEY or a /connect key exists. Kept as a separate docs(www) commit so the code change stays one commit.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

This was referenced Oct 23, 2026
websearch: custom providers cannot signal rate limits — excluded from provider failover #58327
Open
websearch: re-land Brave as a built-in provider — PR #48222 was stale-bot-closed, never reviewed #58328
Closed
opencode-agent[bot]
opencode-agent Bot reviewed Oct 23, 2026
View reviewed changes

@opencode-agent opencode-agent Bot left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The docs gap from my last review is fixed: websearch.mdx now lists Brave with BRAVE_API_KEY / BRAVE_SEARCH_API_KEY and says it only appears once a key is configured. That matches what I saw from the running server. The code is unchanged since my last review, so the earlier results still hold. The new commit doesn't touch the public API. No new concerns.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@opencode-agent opencode-agent Bot mentioned this pull request Oct 23, 2026
[FEATURE]: add a SearXNG web search provider #58406
Closed
This was referenced Nov 5, 2026
[FEATURE]: add You.com as a built-in web search provider #61906
Closed
[FEATURE]: Add Nimble as a built-in web search provider #62220
Closed
@mihaiplesa

mihaiplesa commented Nov 24, 2026

Copy link
Copy Markdown

Anything left here? Would love to see it in.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@saberistic

saberistic commented Nov 24, 2026

Copy link
Copy Markdown

Hi team 👋 I'm Amir, a Solutions Engineer at Brave Search. We'd love to see this merged, since developers regularly ask us about using Brave in opencode's built-in web search.

If anything needs changing, let us know and we'll turn it around quickly. Happy to help with any Brave Search API questions too. Thanks! 🙏

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@opencode-agent opencode-agent[bot] opencode-agent[bot] left review comments

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

websearch: re-land Brave as a built-in provider — PR #48222 was stale-bot-closed, never reviewed

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@nazerim @mihaiplesa @saberistic
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.