[AIGTWY-4573] Apply managed models and headers to Claude's config - #597
Open
david-siqi-liu wants to merge 6 commits into
Open
david-siqi-liu wants to merge 6 commits into
david-siqi-liu wants to merge 6 commits into
Conversation
david-siqi-liu
added this pull request to stack #598
September 13, 2026 18:20
david-siqi-liu
force-pushed
the
david/AIGTWY-4573-model-picker
branch
from
September 13, 2026 23:29
c4e3c93 to
480b654
Compare
This was referenced Sep 13, 2026
david-siqi-liu
force-pushed
the
david/AIGTWY-4573-model-picker
branch
from
September 14, 2026 17:51
480b654 to
055db11
Compare
david-siqi-liu
force-pushed
the
david/AIGTWY-4573-model-picker
branch
from
September 14, 2026 18:46
055db11 to
6edfdf9
Compare
david-siqi-liu
force-pushed
the
david/AIGTWY-4573-model-picker
branch
from
September 14, 2026 19:15
6edfdf9 to
23d8bd8
Compare
david-siqi-liu
force-pushed
the
david/AIGTWY-4573-model-picker
branch
from
September 14, 2026 19:55
23d8bd8 to
73056a3
Compare
david-siqi-liu
force-pushed
the
david/AIGTWY-4573-model-picker
branch
from
September 14, 2026 20:59
73056a3 to
f563c47
Compare
david-siqi-liu
force-pushed
the
david/AIGTWY-4573-model-picker
branch
from
September 14, 2026 21:16
f563c47 to
07773dd
Compare
david-siqi-liu
force-pushed
the
david/AIGTWY-4573-model-picker
branch
from
September 14, 2026 22:44
07773dd to
0a11b4e
Compare
david-siqi-liu
force-pushed
the
david/AIGTWY-4573-model-picker
branch
from
September 14, 2026 23:27
0a11b4e to
6e7a30d
Compare
david-siqi-liu
force-pushed
the
david/AIGTWY-4573-model-picker
branch
from
September 14, 2026 23:36
6e7a30d to
98447bc
Compare
david-siqi-liu
force-pushed
the
david/AIGTWY-4573-model-picker
branch
from
September 15, 2026 01:05
98447bc to
6b8bb9d
Compare
david-siqi-liu
force-pushed
the
david/AIGTWY-4573-model-picker
branch
from
September 15, 2026 01:20
6b8bb9d to
329ebdd
Compare
lilly-luo
reviewed
Sep 15, 2026
Comment on lines
+483
to
+486
| elif model_service_location and not provider and not relayed: | ||
| env["CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY"] = "1" | ||
| keys.append(["env", "CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY"]) | ||
|
|
Collaborator
There was a problem hiding this comment.
we should sync w @andy-xu-db and make sure that model_service_location gets set + propagated correctly in discovery header
lilly-luo
reviewed
Sep 15, 2026
| owned_paths: list[list[str]], | ||
| relayed: bool, | ||
| ) -> None: | ||
| ) -> bool: |
Collaborator
There was a problem hiding this comment.
nit it's a bit unclear what the bool means from the method name _reconcile_managed_settings. maybe make it a dataclass
@dataclass
class ManagedSettingsReconciliationResult
written: bool
david-siqi-liu
force-pushed
the
david/AIGTWY-4573-model-picker
branch
from
September 15, 2026 13:42
329ebdd to
040523f
Compare
david-siqi-liu
force-pushed
the
david/AIGTWY-4573-model-picker
branch
from
September 15, 2026 16:35
040523f to
75bc51a
Compare
This was referenced Sep 15, 2026
Resolve the managed config's Claude inputs into Claude Code's own config shape: the model allow-list or discovery location into the `/model` picker, and the custom http_headers into Claude's outbound requests. Scoped to Claude; Codex and Gemini per-agent model/header handling is deferred to a follow-up so this stays a small, single-agent change. - managed_resolve: add managed_static_models, managed_model_service_location, and managed_custom_headers; extend managed_state_overrides to layer claude_static_models, the model_service_location, and claude_custom_headers into state for Claude. - claude: a static list becomes availableModels + enforceAvailableModels + a modelPicker (exactly the named ids); a discovery location turns on gateway discovery instead. Ownership markers prune only ug-owned picker keys on a static-to-discovery transition, and clear only when the OS-managed file was written. Managed http_headers append to ANTHROPIC_CUSTOM_HEADERS, with ug's fixed headers winning on conflict; values that would break the newline-delimited header format are dropped. - databricks: shared extra_custom_headers helper drops reserved (ug-owned) and delimiter-unsafe headers so ug's headers always win. - README: document the Claude picker and the ucode-settings.json managed file. Co-authored-by: Isaac <no-reply@databricks.com>
david-siqi-liu
force-pushed
the
david/AIGTWY-4573-model-picker
branch
from
September 15, 2026 20:12
75bc51a to
93de22e
Compare
When a managed CodingAgentConfig enables tracing for an agent, ucode writes the
OpenTelemetry env plus a refreshing `otelHeadersHelper` into Claude Code's managed
settings so spans export to the AI Gateway OTLP ingest endpoint
(`/ai-gateway/otel/v1/traces`).
- managed_config: normalize per-agent `AgentConfig.tracing_config.enabled` →
`otel_tracing_enabled` (tri-state), with the deprecated workspace-level
`CodingAgentConfig.tracing` kept only as a back-compat fallback.
- managed_resolve: `managed_otel_tracing_enabled(managed, tool)` — per-agent wins,
deprecated global falls back; `OTEL_TRACING_TOOLS` (claude only today) gates a
per-agent `{tool}_otel_tracing` state override, the extension point for other agents.
- claude: render_overlay writes the trace env (`CLAUDE_CODE_ENABLE_TELEMETRY`, the
`CLAUDE_CODE_ENHANCED_TELEMETRY_BETA` span gate, `OTEL_TRACES_EXPORTER=otlp`,
`http/protobuf`, the full `/v1/traces` endpoint via `build_otel_traces_endpoint`,
debounce) plus `otelHeadersHelper`. No static `OTEL_..._HEADERS`. Disable prunes them.
- cli/databricks: `ucode otel-headers` prints the OTLP header map as JSON, minting the
same Databricks token as `auth-token`.
Co-authored-by: Isaac <no-reply@databricks.com>
Set CLAUDE_CODE_PROPAGATE_TRACEPARENT=1 alongside the OTLP trace-export env so Claude emits a W3C traceparent on its gateway-bound requests (custom ANTHROPIC_BASE_URL). This lets the AI Gateway link its server-side span to Claude's client-side span. Recorded as a managed key so a later disable prunes it. Co-authored-by: Isaac <no-reply@databricks.com>
Extend the OTel tracing rail (stacked on the Claude PR) to Codex: add `codex` to `OTEL_TRACING_TOOLS`, so a managed per-agent `tracing_config.enabled` for the codex agent sets `codex_otel_tracing` in state. At launch, `codex.py` mints a fresh Databricks bearer and injects the `[otel.trace_exporter.otlp-http]` block (endpoint + http/protobuf + Authorization) as `-c` config overrides — the endpoint is the AI Gateway ingest path, minted per launch and never persisted. Codex has no OTLP headers-helper (unlike Claude's otelHeadersHelper), so the bearer is pinned statically per launch and goes stale after ~1h; a refreshing local proxy is the intended follow-up. Inference and OTel auth are independent in Codex (model_providers.auth vs otel.headers) and both use the same workspace bearer. Co-authored-by: Isaac <no-reply@databricks.com>
…tion A managed `models.unity_catalog_location` now scopes the agent's gateway model discovery to that schema, like `--parent`, by emitting the Databricks-Model- Service-Parent-Schema header. Previously the location only set CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY for Claude (unscoped, so the location's models never appeared) and did nothing for Codex. - claude.py: render_overlay emits the parent-schema header from model_service_location (covers `ug configure` and launch), not just the discovery-enable env. - cli.py: launch derives parent_schema from the managed location so Codex (which has no model_service_location) gets the same scope header. Co-authored-by: Isaac <no-reply@databricks.com>
david-siqi-liu
force-pushed
the
david/AIGTWY-4573-model-picker
branch
from
September 15, 2026 20:50
f7451c6 to
9427467
Compare
…ches The MPS model pin (first catalog target via `-c model=`) also fired for a parent-schema (unity_catalog_location) launch, so the `-c model=` override outranked the user's `/model` selection and reverted it every time. Scope the pin to the MPS/provider case; a unity_catalog_location launch lets the user pick any discovered model. 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.
Resolve the managed config's Claude inputs into Claude Code's own config shape: the model allow-list or discovery location into the
/modelpicker, and the customhttp_headersinto Claude's outbound requests. Scoped to Claude; Codex and Gemini per-agent model/header handling is a follow-up so this stays a small, single-agent change.Changes:
managed_static_models,managed_model_service_location, andmanaged_custom_headers; extendmanaged_state_overridesto layerclaude_static_models, the model_service_location, andclaude_custom_headersinto state for Claude.availableModels+enforceAvailableModels+ amodelPicker(exactly the named ids); a discovery location turns on gateway discovery instead. Ownership markers prune only ug-owned picker keys on a static-to-discovery transition, and clear only when the OS-managed file was written. Managedhttp_headersappend toANTHROPIC_CUSTOM_HEADERS, ug's fixed headers winning on conflict; values that would break the newline-delimited format are dropped.extra_custom_headershelper drops reserved (ug-owned) and delimiter-unsafe headers so ug's headers always win.This pull request and its description were written by Isaac.