Skip to content

Add relayed auth MPS support for Claude Max/Enterprise - #246

Merged
asujithan merged 4 commits into
mainfrom
asujithan/claude-max-enterprise
Jul 28, 2026
Merged

Add relayed auth MPS support for Claude Max/Enterprise#246
asujithan merged 4 commits into
mainfrom
asujithan/claude-max-enterprise

Conversation

@asujithan

@asujithan asujithan commented Jul 27, 2026

Copy link
Copy Markdown
Collaborator

Changes

  • Relayed refresh proxy (gateway_proxy.py, new) — a loopback proxy that injects a freshly-minted X-Databricks-AI-Gateway-Token on every request while the subscription OAuth stays in Authorization, and streams responses back verbatim. Token is refreshed off the request path.
  • Relayed launch path (claude.py, agents/init.py, databricks.py) — auto-detects a credential-less Anthropic MPS (relayed), routes the launch through the proxy, omits apiKeyHelper (so it can't outrank the subscription OAuth), and skips launch-time validation (the proxy/login only exist at launch).
  • —setting-sources fix — relayed launches pass —setting-sources project,local, excluding the user scope so a stale ~/.claude/settings.json apiKeyHelper can't merge in and shadow the subscription OAuth. Non-relayed launches are unchanged.
  • Method-agnostic proxy dispatch — the proxy forwards any HTTP method (routes any do_ to _handle) instead of a hardcoded subset, so unsupported methods get the gateway's real response instead of a fabricated local 501.
  • —workspace launch flag — ucode claude|codex --provider --workspace runs without a prior ucode configure: it targets (and auto-configures + authenticates) the given workspace, reusing the existing auto-configure/auth path.

Test Plan

All via uv run:

  • pytest tests/test_gateway_proxy.py — proxy token cache, swap-header injection, streaming, method-agnostic dispatch — pass
  • pytest tests/test_agent_claude.py — relayed overlay (no apiKeyHelper), —setting-sources argv, launch wiring — pass
  • pytest tests/test_agents_init.py — relayed provider resolution + config threading —pass
  • pytest tests/test_databricks.py — relayed detection — pass
  • pytest tests/test_cli.py — —workspace sets the current workspace (normalized); absent flag leaves it unchanged — pass
  • Combined touched suites: 421 passed. Full suite: 938 passed, 36 skipped (the one failure, test_e2e_user_agent, is a pre-existing environmental e2e test unrelated to this branch).
  • ruff check, ruff format --check, ty check — clean.

@asujithan
asujithan force-pushed the asujithan/claude-max-enterprise branch from 2e6f65d to 55cd67c Compare July 27, 2026 02:51
@asujithan
asujithan requested a review from AarushiShah-db July 27, 2026 03:31
@asujithan
asujithan merged commit 54bdc27 into main Jul 28, 2026
2 checks passed
@asujithan
asujithan deleted the asujithan/claude-max-enterprise branch July 28, 2026 01:54
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