claude: merge a caller's --settings instead of clobbering ucode's#189
Merged
Conversation
`ucode claude` prepends its own `--settings <ucode-file>` to every launch. Claude Code honors only ONE --settings flag, so a caller that also passes --settings (e.g. an integration injecting hooks) has exactly one of the two silently dropped — either ucode's gateway config or the caller's hooks. This broke omnigent's managed Claude sessions: its transcript/permission hooks were dropped and the web UI rendered empty. Compose instead of clobber: when a caller supplies --settings, deep-merge it with ucode's (ucode's gateway keys win; hooks from both are unioned) and hand Claude a single merged --settings (inline JSON). The merge is per-launch and is never written back to the shared ucode settings file, so concurrent launches cannot accumulate one another's hooks. No caller --settings → unchanged (pass ucode's settings file directly). Co-authored-by: Isaac
lilly-luo
reviewed
Jul 8, 2026
lilly-luo
previously approved these changes
Jul 8, 2026
Per review on #189: a caller --settings value that ucode could not parse was silently swallowed (returned None) and then passed through as a second --settings flag. Claude Code honors only one --settings, so that collision silently dropped either the caller's settings or ucode's gateway config (breaking auth). Raise an actionable RuntimeError instead — malformed inline JSON, a malformed/unreadable settings file, a nonexistent file path, or non-object JSON — surfaced by the CLI as a clean error. Removes the pass-through branch, which never helped (the colliding flag always loses). Co-authored-by: Isaac
lilly-luo
approved these changes
Jul 8, 2026
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.
What
ucode claudeprepends its own--settings <ucode-file>to every launch. Claude Code honors only one--settingsflag, so a caller that also passes--settings '{…}'(e.g. an integration injecting hooks) has exactly one of the two silently dropped — either ucode's gateway config or the caller's settings. This broke omnigent's managed Claude sessions: its transcript/permission hooks were dropped and the web UI rendered empty.Change
When the caller supplies
--settings, compose instead of clobber: deep-merge the caller's settings with ucode's — ucode's gateway keys (apiKeyHelper,env) win, andhooksfrom both sides are unioned — then hand Claude a single merged--settings(inline JSON). The merge is per-launch and is never written back to the shareducode-settings.json, so concurrent launches can't accumulate one another's hooks. No caller--settings→ unchanged (ucode's settings file is passed directly).This is the general "ucode should compose with any prior
claudecommand out of the box" fix — it helps every caller ofucode claude --settings, not just omnigent.Test plan
uv run pytest— green.TestBuildClaudeArgvcovers: merge into a single--settings, the--settings=form, ucode-wins-on-conflict, file-path value, and unparseable pass-through.uv run ruff check .+ruff format --checkclean.Related
Split out of #184 (which now carries only the codex
--profile-on-app-serverfix). Same underlying principle: ucode's injected flags must compose with the caller's command — merged where a flag would clobber (--settings, here), conditional where a subcommand rejects it (--profile, in #184).This pull request and its description were written by Isaac.