Skip to content

[Bug]: 2026.5.2 agent web_search can bypass configured Brave and route to Gemini/stale provider metadata #76960

Description

@Kevin-Li-jgrc

Bug type

Regression (worked before, now fails)

Beta release blocker

No

Summary

In OpenClaw 2026.5.2, agent web_search can fail to use the configured Brave provider even when:

  • tools.web.search.provider is set to brave
  • the Brave plugin/package is installed
  • direct runtime/provider resolution can call Brave successfully

In the observed failure, the first-class agent web_search tool did not use Brave and instead attempted a stale/different provider path, returning a Gemini credential error:

provider "gemini" returned missing_gemini_api_key

This is related to but not identical to #76626. #76626 covers the web_search is disabled or no provider is available split between CLI/provider registry and agent registry, and is now closed. The case here is a selected-provider mismatch/stale runtime metadata problem: configured Brave was bypassed and agent web_search attempted Gemini.

Steps to reproduce

Observed on a macOS OpenClaw install after upgrading to 2026.5.2 and repairing externalized plugins:

  1. Configure Brave search:
{
  "tools": {
    "web": {
      "search": {
        "provider": "brave"
      }
    }
  },
  "plugins": {
    "entries": {
      "brave": {
        "enabled": true,
        "config": {
          "webSearch": {
            "apiKey": "<redacted>"
          }
        }
      }
    }
  }
}
  1. Install/enable @openclaw/[email protected].
  2. In an agent turn, call first-class web_search.
  3. Instead of using Brave, the tool fails through Gemini:
provider "gemini" returned missing_gemini_api_key
  1. Direct runtime-level OpenClaw web search resolution using the same config can resolve and call Brave successfully.
  2. A later fresh agent turn after reinstalling all external plugins together and doing a real Gateway restart resolves correctly as Brave again.

Expected behavior

When tools.web.search.provider = "brave", the agent web_search tool should always use Brave unless Brave is unavailable and a documented fallback path is selected.

It should not silently route to Gemini or reuse stale runtime web-search metadata from a previous turn/session.

Actual behavior

Agent web_search bypassed configured Brave and attempted Gemini, producing:

provider "gemini" returned missing_gemini_api_key

This made web_search unusable even though Brave itself was configured and direct/runtime-level Brave resolution worked.

OpenClaw version

2026.5.2 (8b2a6e5)

Operating system

macOS Darwin 25.3.0 arm64

Install method

Homebrew/global npm OpenClaw install; upgrade via openclaw update

Model

Observed in an agent session using openai-codex/gpt-5.5

Provider / routing chain

Configured web search provider: brave

Unexpected attempted provider: gemini

Logs, screenshots, and evidence

Observed failure:

[tools] web_search failed: provider "gemini" returned missing_gemini_api_key

Observed direct/runtime provider resolution after checking config:

providerConfigured=brave
selectedProvider=brave
selectedProviderKeySource=config
runWebSearch returned provider=brave / result.provider=brave

Current first-class web_search later recovered after a real restart and external-plugin repair:

web_search metadata: provider=brave

Impact and severity

High for users relying on agent/cron web_search. The configured provider can be Brave, but the actual agent tool path can become unusable due to stale or incorrect provider selection.

Additional information

Related issues:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions