Allow running bare claude unwrapped alongside ug claude (opt out of OS-managed settings)

オープン
#1,282 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
45/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
活発
技術スタック
python
領域
backend, cli

調査の方向性

Start with src/ucode/agents/claude.py and src/ucode/managed_files.py, then read “Claude Subscription Relay” in docs/os-managed-settings-design.md to understand the local-only path and managed-settings behavior. Trace how ug claude reconciles settings and how ug status reports them; define and test the opt-out, repeated launches, and a documented non-destructive cleanup path for existing managed settings.

索引モデルが issue の本文から書いたものです。

説明

Problem

After running ug claude once from an interactive terminal, a bare claude
invocation is permanently routed through the Databricks AI Gateway. There is
currently no supported way to keep the two separate, i.e.:

• ug claude -> Databricks AI Gateway (Unity Gateway models)
• claude -> the user's own native configuration (e.g. personal subscription)

Current behavior

Every interactive ug claude launch calls write_tool_config(), which writes
the gateway overlay (ANTHROPIC_BASE_URL, ANTHROPIC_CUSTOM_HEADERS,
apiKeyHelper, ANTHROPIC_DEFAULT_*_MODEL, ...) to two places
(src/ucode/agents/claude.py):

  1. ~/.claude/ucode-settings.json (passed explicitly via claude --settings ...)
  2. /etc/claude-code/managed-settings.json (Linux) — the OS-managed,
    machine-wide, highest-precedence scope

The managed file is what captures bare claude: it reads the managed scope
without any flags (managed > --settings > user), and _reconcile_managed_settings
is explicit that this is intentional ("so a bare claude uses the gateway").

Why this can't be worked around today

• claude --setting-sources only accepts user,project,local; the managed
scope always applies and cannot be excluded via CLI flags.
• Interactive ug claude re-reconciles the managed file on every launch
(recreates it when absent, overwrites drifted values), so manually deleting
it only lasts until the next run.
• managed_writes_allowed() keys off stdin.isatty() only
(src/ucode/managed_files.py) — there is no flag or env var to stay local-only.
• ug revert restores everything and clears state, so it is not usable as a
toggle between the two modes.

Use case

Developers who use both their own Claude subscription and the Databricks
gateway (e.g. personal vs. work contexts, or comparing native vs. gateway
behavior) currently have to choose one: after the first ug claude run, the
native claude experience is gone machine-wide until a full revert.

(Related: subscription-relay mode is already intentionally local-only for the
same class of reason — a persisted gateway address would break bare claude.
See "Claude Subscription Relay" in docs/os-managed-settings-design.md.)

Proposal

Add a supported local-only opt-out so ug claude uses only the
--settings injection (~/.claude/ucode-settings.json) and never touches the
OS-managed file. For example, one of:

• ug claude --local-only / ug configure --no-managed-settings, or
• UCODE_NO_MANAGED_SETTINGS=1 env var

Suggested semantics:

• When opted out, skip _reconcile_managed_settings (same path as the
non-interactive local fallback) instead of writing the managed file.
• If the managed file already contains ug-owned gateway values, either warn
that bare claude is still captured (with a remediation hint), or offer to
clean just the ug-owned keys — without a full ug revert/state wipe
(e.g. ug revert --managed-only or per-agent revert).
• ug status already reports managed state (current, compatible (local settings), ...), so the opted-out state stays observable.

Acceptance criteria

• [ ] With the opt-out set, ug claude launches through the gateway while
bare claude keeps working against the user's native configuration.
• [ ] Repeated opted-out launches never create or modify the OS-managed file.
• [ ] A user who previously ran without the opt-out has a documented,
non-destructive path back to a clean managed file.

Environment

• ug --version: 0.2.0+53.g3076da9
• OS: Ubuntu
• Claude Code version (claude --version): 2.1.310 (Claude Code)

主要言語
Python
スター
122
フォーク
101
平均マージ
1日 18時間
マージ済み PR(30日)
228

環境構築

  • Dockerfile・Docker Compose ファイルなし
  • プルリクエストのテンプレートあり
  • コントリビューションガイドなし

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

databricks/unity-gateway のほかの issue

databricks/unity-gateway の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。