Repository navigation
Blank shell Anthropic credentials in Claude settings - #1287
Merged
Merged
Conversation
…ell credentials can't outrank apiKeyHelper Claude Code ranks both shell variables above apiKeyHelper and the subscription login, so a LiteLLM-style key was sent to the gateway (401). A settings env value beats the shell's, so ug writes both as empty strings. ucode-settings.json always has them (relayed included); the managed file gets them from ug configure only, like the header mod, so a second writer that drops them is not fought on every launch. Co-authored-by: Isaac <no-reply@databricks.com>
billiam-wang
marked this pull request as ready for review
October 26, 2026 23:05
Collaborator
Author
|
/ug-review |
…igure flag, doctor info, tighter tests Co-authored-by: Isaac <no-reply@databricks.com>
rohita5l
reviewed
Oct 27, 2026
Add native_claude/test_credentials.py: the CI-pinned Claude runs one turn against a fake API with shell ANTHROPIC_API_KEY/ANTHROPIC_AUTH_TOKEN set. With ug's blanks it sends the apiKeyHelper token, or on the relayed path its OAuth token, with no empty header; control cases show the shell wins without them. Run it in the Claude mod CI job, and share the binary fixture through a conftest. The doctor note now says Claude launched via ug ignores the variable and names DATABRICKS_BEARER and `ug configure --use-pat` for using your own token. Co-authored-by: Isaac <no-reply@databricks.com>
billiam-wang
requested review from
AarushiShah-db and
lilly-luo
as code owners
October 27, 2026 13:50
rohita5l
approved these changes
Oct 27, 2026
billiam-wang
enabled auto-merge
October 28, 2026 02:16
billiam-wang
disabled auto-merge
October 28, 2026 02:16
billiam-wang
enabled auto-merge
October 28, 2026 03:04
billiam-wang
added a commit
that referenced
this pull request
Oct 28, 2026
Resolve against #1287, which renamed the header-mod flag to `_explicit_configure` and added a UG_HEADERS launch trigger: keep this branch's rule that only `ug configure` adds the mod, under the new name, and rename the flag in this branch's header-mod test. Co-authored-by: Isaac <no-reply@databricks.com>
billiam-wang
added a commit
that referenced
this pull request
Oct 28, 2026
Resolve against #1287: keep this branch's shared `claude_managed_env` fixture and carry over #1287's rename of the header-mod flag to `_explicit_configure`. #1287's new credential-blank tests imported the old module-level helper, so they now use the fixture. 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.
Worktree: ug-blank-shell-anthropic-credentials | Branch: blank-shell-anthropic-credentials
What did you change, and why?
A shell
ANTHROPIC_AUTH_TOKEN/ANTHROPIC_API_KEY(e.g. from LiteLLM) outranksapiKeyHelper, so Claude sent it to the AI Gateway and failed with a 401 (ES-2297582). ug now writes both as""next toANTHROPIC_BASE_URL: always inucode-settings.json, and inmanaged-settings.jsonfromug configure. The user's shell is untouched. Like the header mod, a plain launch never re-adds them to the managed file, so a second writer that drops them isn't fought with sudo (CUJ 8). Supersedes the drop-in approach in #1185.How do you know it works?
11 new unit tests. Live, with fake keys in the shell:
ug claudeand bareclaudeboth answered. With the managed blanks removed, a launch made no sudo write and still worked. Control: bareclaudewithout the blanks reproduced the exact 401.This pull request and its description were written by Isaac.