#8707: fix(web_search): honor configured provider at execution timeFix/web search provider
channel: telegram
agents
stale
Cluster:
Web Search Provider Enhancements
## Summary
- Resolve `web_search` provider and enablement at execution time so config changes are honored
- Add regression test covering dynamic disable behavior
- Align Telegram token-override account inference with the same token source used by `resolveTelegramAccount`
## Testing
- `pnpm exec vitest src/agents/tools/web-tools.enabled-defaults.test.ts`
<!-- greptile_comment -->
<h2>Greptile Overview</h2>
<h3>Greptile Summary</h3>
This PR updates the `web_search` tool so it resolves the configured provider at execution time (rather than at tool creation), ensuring late-bound config updates take effect. It also adds a regression test covering dynamic provider changes, plus tweaks to Telegram monitoring to infer `accountId` from a token override and corresponding tests.
Overall the changes are small and consistent with existing patterns (config resolution helpers, vitest mocks). The main remaining edge is that only the provider (and Telegram account inference) is made dynamic, while some related decisions (e.g., tool enablement) are still evaluated at creation time, which may surprise callers who expect fully dynamic behavior.
<h3>Confidence Score: 4/5</h3>
- This PR is largely safe to merge and should fix the reported provider-resolution issue with low functional risk.
- Changes are localized and covered by new regression tests; noted issues are mostly about consistency/edge-case behavior (dynamic config vs creation-time decisions, token matching nuances) rather than likely runtime failures.
- src/agents/tools/web-search.ts and src/telegram/monitor.ts
<!-- greptile_other_comments_section -->
<sub>(4/5) You can add custom instructions or style guidelines for the agent [here](https://app.greptile.com/review/github)!</sub>
<!-- /greptile_comment -->
Most Similar PRs
#8715: fix(web-search): safer provider resolution & Perplexity auto-detection
by abhijeet117 · 2026-02-04
83.6%
#17632: feat(web-search): add per-call provider override
by cog-bernthiddema · 2026-02-16
82.6%
#13370: Tools: rewrite Grok parser, add Tavily provider, multi-provider con...
by a-anand-91119 · 2026-02-10
78.1%
#7738: feat(web-search): add provider fallback and Serper support
by garnetlyx · 2026-02-03
76.5%
#6743: feat(web-search): add Tavily search provider support
by 3927o · 2026-02-02
76.4%
#13386: feat(web-search): add Nimble Web Search API provider
by ilchemla · 2026-02-10
75.8%
#11444: Add extensible search providers for web_search
by dhc02 · 2026-02-07
75.4%
#13075: [Feature]: Add Gemini (Google Search grounding) as web_search provider
by akoscz · 2026-02-10
74.3%
#13814: feat(web-search): add ZAI Search (zsearch) provider
by strelov1 · 2026-02-11
74.1%
#14744: fix(context): key MODEL_CACHE by provider/modelId to prevent collis...
by lailoo · 2026-02-12
74.1%