Repository navigation
Conversation
`ug claude --provider <relayed MPS> --workspace <url>` on a fresh state (including right after `ug revert`) auto-configured Claude for the default gateway path first. In an interactive terminal that wrote apiKeyHelper, env.ANTHROPIC_BASE_URL and env.ANTHROPIC_CUSTOM_HEADERS into the OS-managed settings file, and the same launch then refused to start the subscription relay because of those keys. `ug revert` cleared both the file and the state, so the next launch repeated the cycle. Pass the launch's --provider into the first-run auto-configure so a relayed service is configured as relayed from the start and never writes the conflicting managed keys. Co-authored-by: Isaac <no-reply@databricks.com>
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
ug claude --provider <relayed MPS> --workspace <url>fails on a fresh state, and keeps failing afterug revert:When the workspace or tool isn't in state yet,
_launch_toolruns_auto_configure_toolbefore it looks at--provider. Auto-configure set Claude up for the default gateway path. In an interactive terminal, that wrote the gateway auth keys into the OS-managed settings file. The same launch then configured the relayed provider, and the relay guard in_reconcile_managed_settingsrejected the keys ug had just written.ug revertclears both the file and the state, so the next launch did the same thing again.The only way out was to configure non-interactively first (
ug configure --agents claude --workspace <url> < /dev/null, which skips the managed write) and then runug claude --provider <mps>.Fix
Pass the launch's
--providerthrough_auto_configure_toolintoconfigure_single_tool._configure_onealready resolves a relayed service and configures it as relayed, which never writes the managed file. With this change, the first-run setup matches the launch that follows it. The existing error message's advice ("runucode revertfirst") now works too.Not covered: a relayed provider that comes from a managed coding-agent config, with no
--provider, on a first run. That config is only fetched after auto-configure. Handling it would mean having the relay path strip managed keys that ug itself wrote, instead of failing on them. That's a larger change to the sudo write path, so it's left for a follow-up.Testing
test_first_run_configures_through_launch_providerandtest_auto_configure_forwards_providerintests/test_cli.py, andtest_explicit_relayed_provider_configures_relayedintests/test_agents_init.py. All three fail without the source change.provider=None.uv run pytest: 3577 passed. The 7 failures (smart-routing PTY andtest_e2e_user_agent) and the Windows smart-routing file's pytest crash reproduce the same way on cleanmainon my Linux box.ruff check,ruff format --check,ty check src/: clean.This pull request and its description were written by Isaac.