fix(websearch): remove provider whitelist - enable websearch for all providers by default - #45472
4ebuRushka wants to merge 3 commits into
Conversation
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
|
The following comment was made by an LLM, it may be inaccurate: Potential Related PR Found: #44343 -
However, #45472 (the current PR) is not a duplicate — it's the preferred approach that replaces #44343's strategy. |
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
10a762f to
547fb7b
Compare
The native websearch tool was hidden for every provider except opencode/opencode-go unless undocumented env vars were set (anomalyco#44307). - drop the provider whitelist from the tool registry; inclusion is now controlled by config: websearch.enabled !== false (default on) - add a first-class websearch section to opencode.json (enabled, provider) - backend pin priority: config.websearch.provider > OPENCODE_WEBSEARCH_PROVIDER > legacy OPENCODE_ENABLE_EXA/_PARALLEL > per-session checksum split - log a one-shot deprecation warning when legacy enablement env vars are set
…ority Replace whitelist assertions with the B1-B8 matrix: - default-on for arbitrary providers, opt-out via websearch.enabled=false (config wins over managed-provider status) - backend pins: config.websearch.provider > OPENCODE_WEBSEARCH_PROVIDER > legacy flags > per-session split; 'auto' behaves like no pin; invalid env values are ignored without crashing (review note in anomalyco#44343) - legacy OPENCODE_ENABLE_EXA logs a one-shot deprecation warning
…ig section - tools.mdx: websearch is available to all providers by default; describe the opencode.json websearch section (enabled, provider) and consent via permission.websearch - cli.mdx: mark OPENCODE_ENABLE_EXA/_PARALLEL as deprecated enablement switches that now only pin the backend; document OPENCODE_WEBSEARCH_PROVIDER Rebased onto upstream/dev@c0f09afe.
547fb7b to
98b172e
Compare
|
Automated PR Cleanup Thank you for contributing to opencode. Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions. This PR was closed because it matched the following cleanup criteria:
PRs created within the last month are not affected by this cleanup. If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate. Thanks again for taking the time to contribute. |
Issue for this PR
Closes #44307
Type of change
What does this PR do?
websearchis a client-side tool backed by the public Exa/Parallel MCP endpoints, so its availability should not depend on the identity of the model provider. Today it is hidden for every provider exceptopencode/opencode-gounless undocumented env vars are set.Remove the
webSearchEnabled(providerID, ...)whitelist fromToolRegistry. The tool is now included for every provider unless explicitly disabled via config (websearch.enabled: false); consent stays on the existingpermission.websearchlayer (ask/deny per call), which is untouched.Add a documented config section:
{ "websearch": { "enabled": true, // default true; false hides the tool everywhere "provider": "auto" // "auto" | "exa" | "parallel" } }Backend selection priority becomes:
websearch.provider->OPENCODE_WEBSEARCH_PROVIDER-> legacyOPENCODE_ENABLE_EXA/OPENCODE_ENABLE_PARALLELpins -> per-session checksum split (unchanged).OPENCODE_ENABLE_EXA/_PARALLELno longer gate availability; they keep pin semantics and log a one-shot deprecation warning.Docs: rewrite the websearch section in
tools.mdx; mark the env flags deprecated incli.mdx.Why this instead of #44343: #44343 keeps the hardcoded whitelist, so custom/local providers stay broken out of the box and every new managed provider needs another additive line (#40568, #42378, PR #42630). The whitelist is also not enforcement: the bypass is a client-side env var, and the backends are public keyless endpoints that both vendors offer for free (Parallel explicitly targets OpenCode users). Removing the mechanism removes the bug class, matches
webfetch(already shipped to all providers unfiltered), and matches the V2 core tool, which registerswebsearchunconditionally (packages/core/src/tool/builtins.ts).Compatibility:
websearch.enabled: falseorpermission.websearch: deny.How did you verify your code works?
packages/opencode/test/tool/websearch.test.ts: 18/18 pass — default-on for arbitrary providers without config;websearch.enabled: falsehides the tool (also for managed providers); pin priority config > env > legacy flags; invalidOPENCODE_WEBSEARCH_PROVIDERvalue falls back to the checksum split without crashing; one-shot deprecation warning for legacy flags. Together withtest/tool/registry.test.ts: 33/33 pass.bun test test/tool/inpackages/opencode: ~392 pass across runs (391–393, timing-flakytool.globon slow Windows hosts) / persistent fail onlytool.shell abort > preserves output when aborted, which reproduces on pristine dev on this machine; pre-existing Windows-only issue, unrelated to this change.tsgo --noEmit: 0 errors inpackages/core;packages/opencodehas 1 pre-existing error in the untouchedtest/provider/transform.test.ts(broken by upstream fix(opencode): let config opt out of Anthropic thinking blockBinding #46820 on the new base, unrelated to this change); oxlint on changed files: 0 errors. Rebased ontoupstream/dev@c0f09afe(fromc2eacd72); merge simulation shows 0 conflicts.opencode/*control (config injected inline viaOPENCODE_CONFIG_CONTENT, legacy env vars stripped per process): the tool appears with no env vars configured;enabled: falseremoves it;websearch.provider: "exa"shows"exa"in tool-call metadata and wins overOPENCODE_WEBSEARCH_PROVIDER=parallel; a legacyOPENCODE_ENABLE_EXA=1run logs the deprecation warning.Screenshots / recordings
N/A - no UI changes.
Checklist