Fix stale Claude model discovery setting - #445
Open
lilly-luo wants to merge 5 commits into
Open
Conversation
lilly-luo
force-pushed
the
lilly-luo_data/stack/fix-claude-model-discovery-state
branch
from
September 2, 2026 02:23
30400ea to
ce72b71
Compare
lilly-luo
force-pushed
the
lilly-luo_data/stack/fix-claude-model-discovery-state
branch
from
September 2, 2026 02:27
ce72b71 to
3f2c822
Compare
lilly-luo
marked this pull request as ready for review
September 2, 2026 02:30
# Conflicts: # tests/test_agent_claude.py
…model-discovery-state' into stack/fix-claude-model-discovery-state
lilly-luo
commented
Sep 2, 2026
Comment on lines
-400
to
-407
| # Native /model discovery: picker lists every gateway Messages-API endpoint, | ||
| # not just the family aliases. Skipped under a provider (its routing header | ||
| # would send a discovered gateway id to a provider that can't resolve it). | ||
| discovery_enabled = ( | ||
| os.environ.get(GATEWAY_MODEL_DISCOVERY_ENV_VAR) == "1" or smart_routing_v2.enabled() | ||
| ) | ||
| if discovery_enabled and not provider: | ||
| env["CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY"] = "1" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
problem: if i ran
--enable-model-discoveryor--enable-smart-routingat any point, then CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY env var gets set to 1.However, it does not get pruned later if i run
ucode claudewithout --enable-model-discovery. as such, once you enable model discovery, it's basically enabled forever.this PR
1/ prunes CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY if --enable-model-discovery or --enable-smart-routing is not set
2/ avoids setting the env var in settings.json if the flags are passed
test:
ucode claude --enable-model-discoverystill worksucode claude --enable-model-discoverystill works but when i close, the settings.json does not leave behind CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY=1ucode claude --enable-smart-routingstill worksucode claude --enable-smart-routingstill works but when i close, the settings.json does not leave behind CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY=1