Skip to content

fix: accept BRAVE_SEARCH_API_KEY for Brave web search - #19182

Closed
Plutarch01 wants to merge 4 commits into
openclaw:mainfrom
Plutarch01:fix/brave-search-key-alias
Closed

Plutarch01 wants to merge 4 commits into
openclaw:mainfrom
Plutarch01:fix/brave-search-key-alias

Conversation

@Plutarch01

@Plutarch01 Plutarch01 commented Feb 17, 2026 •

Copy link
Copy Markdown

Summary

  • accept BRAVE_SEARCH_API_KEY as an env-var alias when resolving Brave web search API credentials
  • keep existing precedence intact: explicit config apiKey first, then BRAVE_API_KEY, then alias
  • improves compatibility when running OpenClaw behind environments configured with OpenWebUI naming

Testing

  • verified the change is isolated to resolveSearchApiKey in src/agents/tools/web-search.ts
  • sanity-checked branch diff includes only this single file change

Greptile Summary

Added support for BRAVE_SEARCH_API_KEY environment variable as an alias for Brave web search API credentials, maintaining existing precedence order (config apiKey → BRAVE_API_KEY → BRAVE_SEARCH_API_KEY).

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The change is minimal, well-scoped, and maintains backward compatibility. It simply adds an additional fallback environment variable without modifying existing logic or precedence. The implementation correctly follows the existing pattern for environment variable resolution.
  • No files require special attention

Last reviewed commit: 830c650

(3/5) Reply to the agent's comments like "Can you suggest a fix for this @greptileai?" or ask follow-up questions!

BookTranslator User added 4 commits January 30, 2026 14:08
- Update repository from github.com/clawdbot/clawdbot to github.com/openclaw/openclaw
- Build new Docker image openclaw:local
- Migrate config from ~/.clawdbot/ to ~/.openclaw/
- Update environment variables CLAWDBOT_* to OPENCLAW_*
- Remove deprecated browser.controlUrl config
- Configure gateway authentication token
- Add comprehensive migration documentation

The Control UI now requires token authentication:
- Token configured in ~/.openclaw/openclaw.json
- Access via http://localhost:18789
- Enter token on Overview page to connect

Verified working with Playwright MCP - all services operational.
Add comprehensive security hardening documentation for Docker deployments:
- SECURITY_HARDENING.md: Full security guide with configuration examples
- HARDENING_COMPLETE.md: Post-hardening summary and verification steps
- docker-compose.hardened.yml: Example hardened Docker Compose configuration

Includes:
- Nested sandboxing configuration for tool isolation
- Session isolation (per-channel-peer DM scope)
- Read-only volume mounts for Documents/Downloads
- Container security hardening (no-new-privileges, read-only root, tmpfs)
- Resource limits (CPU/memory constraints)

These files serve as templates and documentation for users running
OpenClaw in Docker who want to improve their security posture.
@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui scripts Repository scripts docker Docker and sandbox tooling agents Agent runtime and tooling size: XL labels Feb 17, 2026

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

28 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

@greptile-apps

greptile-apps Bot commented Feb 17, 2026

Copy link
Copy Markdown
Contributor
Additional Comments (1)

src/agents/tools/web-search.ts
Consider mentioning BRAVE_SEARCH_API_KEY in the error message since it's now a supported alias

    message: `web_search needs a Brave Search API key. Run \`${formatCliCommand("openclaw configure --section web")}\` to store it, or set BRAVE_API_KEY or BRAVE_SEARCH_API_KEY in the Gateway environment.`,

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Prompt To Fix With AI
This is a comment left during a code review.
Path: src/agents/tools/web-search.ts
Line: 137:137

Comment:
Consider mentioning `BRAVE_SEARCH_API_KEY` in the error message since it's now a supported alias

```suggestion
    message: `web_search needs a Brave Search API key. Run \`${formatCliCommand("openclaw configure --section web")}\` to store it, or set BRAVE_API_KEY or BRAVE_SEARCH_API_KEY in the Gateway environment.`,
```

<sub>Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!</sub>

How can I resolve this? If you propose a fix, please make it concise.

@Plutarch01

Copy link
Copy Markdown
Author

Superseded by a clean rebased PR: #19186 (same fix plus reviewer suggestion for error text). Closing this one to keep review focused.

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

Labels

agents Agent runtime and tooling app: web-ui App: web-ui docker Docker and sandbox tooling scripts Repository scripts size: XL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant