Allow running bare claude unwrapped alongside ug claude (opt out of OS-managed settings)
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
调研方向
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):
- ~/.claude/ucode-settings.json (passed explicitly via claude --settings ...)
- /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 小时
- 30 天内合并 PR
- 228
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 没有贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
databricks/unity-gateway 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 73/100
databricks/unity-gateway#1622 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
databricks/unity-gateway#1042 · 3 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
databricks/unity-gateway#1021 · 1 个 reaction ·
维护者通常 1 天内回复
-
feat(codex): support amazon_bedrock Model Provider Services that expose OpenAI-compatible models未关闭
难度 2/5 1-3 小时 新手友好度 78/100
databricks/unity-gateway#454 ·
维护者通常 1 天内回复
-
ucode opencode ignores the user's own OpenCode config可能已有人在做 @larsmoan 于 79 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 74/100
databricks/unity-gateway#391 ·
维护者通常 1 天内回复
查看 databricks/unity-gateway 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
AI bug
难度 2/5 1-3 小时 新手友好度 68/100
AUTO-MAS-Project/AUTO-MAS#1960 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 82/100
btclib-org/btclib-wallet#872 ·
维护者通常 1 天内回复
-
[Bug]: Scheduled returns scan all accepted minion keys causing extreme load可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭bug needs-triage
难度 2/5 1-3 小时 新手友好度 76/100
saltstack/salt#70789 · 1 条评论 ·
维护者通常 3 天内回复
-
难度 2/5 1-3 小时 新手友好度 87/100
btclib-org/btclib#3093 ·
维护者通常 1 天内回复