Skip to content

claude: allow disabling web_search MCP via web_search_model: false#198

Open
stuagano wants to merge 1 commit into
databricks:mainfrom
stuagano:fix/web-search-model-disable-sentinel
Open

claude: allow disabling web_search MCP via web_search_model: false#198
stuagano wants to merge 1 commit into
databricks:mainfrom
stuagano:fix/web-search-model-disable-sentinel

Conversation

@stuagano

@stuagano stuagano commented Jul 9, 2026

Copy link
Copy Markdown

Summary

_resolve_web_search_model picks the model backing the web_search MCP server by preferring an explicit web_search_model override, otherwise falling back to codex_models[0] (the first endpoint auto-discovered as Responses-API-shaped). That discovery only confirms an endpoint speaks the openai/v1/responses wire protocol — it doesn't confirm the endpoint has real OpenAI backing to execute server-side tools like web_search.

A self-hosted model served through Databricks' Open Responses API wrapper (e.g. a gpt-oss-120b custom serving endpoint) matches that wire-protocol filter but has no such backing. When it's the only discovered endpoint in a workspace, ucode silently wires it up as the web_search MCP's backing model, and every search call 400s with No OpenAI Response API backing. There was previously no way to opt out short of manually running claude mcp remove web_search -s user after every ucode configure (which re-registers it on the next run).

  • _resolve_web_search_model now treats web_search_model: False as an explicit opt-out, short-circuiting before the codex_models fallback (existing string-override and no-override behavior is unchanged).
  • write_tool_config now calls _unregister_web_search_mcp() when no model resolves, so a stale registration (from a prior run, or from just having set web_search_model: false) is actually cleaned up instead of only ever being added to.

Test plan

  • uv run pytest tests/test_agent_claude.py -q — 69 passed
  • uv run pytest -q (excluding e2e, which need a live workspace) — 863 passed
  • uv run ruff check . — clean
  • Added regression tests: test_explicit_false_disables_regardless_of_codex_models, test_explicit_false_beats_string_codex_model, test_explicit_false_unregisters_instead_of_registering; updated test_skips_registration_without_codex_model for the new unregister-on-no-model behavior.

This pull request and its description were written by Isaac.

…false

codex_models discovery only confirms an endpoint speaks the Responses API
wire protocol, not that it has real OpenAI backing for server-side tools.
A self-hosted model served through Databricks' Open Responses API wrapper
(e.g. gpt-oss) matches the wire-protocol filter but has no such backing,
so web_search calls to it 400 with "No OpenAI Response API backing." When
that's the only discovered endpoint, there was previously no way to opt
out short of manually removing the MCP registration after every
`ucode configure` run.

- `_resolve_web_search_model` treats `web_search_model: False` as an
  explicit opt-out, short-circuiting before the codex_models fallback.
- `write_tool_config` now unregisters any stale web_search MCP entry when
  no model resolves, instead of only ever adding one.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants