Skip to content

Require Claude Code 2.1.248 and remove gateway auth workaround - #413

Open
andy-xu-db wants to merge 7 commits into
mainfrom
fix/claude-code-2-1-248
Open

Require Claude Code 2.1.248 and remove gateway auth workaround#413
andy-xu-db wants to merge 7 commits into
mainfrom
fix/claude-code-2-1-248

Conversation

@andy-xu-db

@andy-xu-db andy-xu-db commented Aug 28, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • require Claude Code 2.1.248+, where gateway model discovery works with apiKeyHelper as the only credential
  • stop setting ANTHROPIC_AUTH_TOKEN and stop creating a refresh cache for native gateway model discovery
  • keep the model-alias proxy and preserve the existing relayed-subscription token refresh path

Testing

  • uv run pytest tests/test_agent_claude.py tests/test_anthropic_model_discovery_proxy.py tests/test_gateway_proxy.py -q (167 passed)
  • uv run pytest tests/test_lint.py -q (3 passed)
  • uv run ruff check .
  • GitHub CI: unit/lint and workspace e2e jobs passed

Live end-to-end verification

Verified on eng-ml-inference-staging with Claude Code 2.1.251:

  • ucode claude --enable-model-discovery --skip-preflight launched through the PR model-alias proxy
  • the Claude child used a loopback ANTHROPIC_BASE_URL and had no ANTHROPIC_AUTH_TOKEN
  • /model displayed gateway models (system.ai.claude-sonnet-4-6[1m], system.ai.claude-haiku-4-5, plus 13 more), proving /v1/models authenticated via apiKeyHelper
  • a non-interactive inference returned the exact marker UCODE_PR_413_OK with exit code 0

Local full-suite note: the locally installed Claude Code 2.1.251 returned a canned response in TestClaudeUserAgent::test_user_agent_arrives_at_gateway without contacting its localhost capture server; the same test passed in GitHub CI.

@andy-xu-db
andy-xu-db requested a review from lilly-luo August 28, 2026 21:32
@andy-xu-db
andy-xu-db enabled auto-merge (squash) August 28, 2026 21:32
Comment thread src/ucode/agents/claude.py Outdated
Comment on lines +1210 to +1211
if not smart_routing:
os.environ["OAUTH_TOKEN"] = get_databricks_token(workspace, state.get("profile"))

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do you need this? should be orthogonal to smart routing right?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah you're right this can be removed

@lilly-luo

Copy link
Copy Markdown
Collaborator

the model discovery proxy is now completely separate from the relayed auth proxy now right? model discovery is responsible for patching the model name where as relayed auth swaps headers. in that case, i think it makes sense to fully decouple them.

@andy-xu-db

andy-xu-db commented Aug 29, 2026

Copy link
Copy Markdown
Collaborator Author

the model discovery proxy is now completely separate from the relayed auth proxy now right? model discovery is responsible for patching the model name where as relayed auth swaps headers. in that case, i think it makes sense to fully decouple them.

makes sense, i updated it so model discovery and relayed auth use separate proxies now

…-248

# Conflicts:
#	src/ucode/anthropic_model_discovery_proxy.py
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