t3code icon indicating copy to clipboard operation
t3code copied to clipboard

[Bug]: Claude launch args --settings is silently replaced by T3's own SDK settings

Open jlui17 opened this issue 2 months ago • 2 comments

Filed by Claude (an AI agent) on behalf of @jlui17.

Before submitting

  • [x] I searched existing issues and did not find a duplicate.
  • [x] I included enough detail to reproduce or investigate the problem.

The closest reports are #13934 (--append-system-prompt-file ignored) and #7577 (launch args outranked by the permission mode). Both are the same kind of conflict between a launch arg and an SDK option T3 sets, but neither covers --settings.

Area

apps/server

Steps to reproduce

  1. In Settings → Providers → Claude, set Launch args to --settings '{"skillOverrides":{"<any-skill-name>":"off"}}' (a path to a settings file behaves the same).
  2. Start a new Claude thread.
  3. Ask the agent whether <any-skill-name> is in its skill list.

Expected behavior

The session starts with the user's settings merged with T3's own settings, so the skill is hidden. If T3 can't support --settings in launch args, it should say so instead of dropping the flag.

Actual behavior

The user's --settings never reaches Claude Code, so the skill is still listed. Nothing warns that the flag was dropped.

The cause:

  • ClaudeAdapterV2 passes the launch args through as extraArgs, so --settings lands in extraArgs.settings (ClaudeAdapterV2.ts:803–807).
  • T3 also builds its own SDK settings (model options, auto-compaction, showThinkingSummaries: true) and sets options.settings on the normal path (818–834, 857–870).
  • The Agent SDK (0.3.276) copies extraArgs and then replaces settings with options.settings (sdk.mjs): let Rn={...a??{}};if(this.options.settings)Rn.settings=this.options.settings;

So whenever T3 sets any setting of its own, a user's --settings is overwritten.

A possible fix: when extraArgs.settings is present, read it (inline JSON or a file path) and merge it under T3's settings before passing options.settings, then drop it from extraArgs.

Impact

Minor bug or occasional failure

Version or commit

0.0.46-nightly.20261003.2610 (8ed276c); the same code is on main @ fed41fa.

Environment

Linux (Arch/Omarchy), T3 Code server nightly, Claude Code 2.1.286, Claude Agent SDK 0.3.276, Claude provider.

Workaround

Point the Claude provider's binary path at a small wrapper script that merges the extra settings into the --settings JSON the SDK passes, then runs the real claude. A separate CLAUDE_CONFIG_DIR with its own settings.json also works, but it splits auth and history from the normal config.

jlui17 avatar Oct 03 '26 06:10 jlui17

Reviewed current main b5a226e49c. The launch settings flag still remains in extraArgs while makeClaudeQueryOptions supplies SDK settings. No matching duplicate among 947 open issues; #13934 and #7577 concern different flags.

This is an ordinary bug report, not a reported exploitable vulnerability. A general settings-merge fix also changes effective permissions.allow, permissions.deny, and bypass restrictions; those settings need maintainer review alongside resolveBypassAvailability. Routing to Julius under the triage fix-scope restriction. No implementation changes or real-app reproduction were performed; the issue remains open.

juliusmarminge avatar Oct 22 '26 01:10 juliusmarminge

Related gap that #22864 does not cover: Claude text generation ignores launch arguments completely.

ClaudeTextGeneration (thread titles, branch names, commit messages, PR descriptions) builds its own argv from binaryPath plus its own --settings JSON, and never reads launchArgs: ClaudeTextGeneration.ts#L196-L208. #22864 changes only ClaudeAdapterV2.ts. So after it ships, an instance with --settings '{"env":{"ANTHROPIC_VERTEX_PROJECT_ID":"..."}}' in its launch arguments runs its turns on that project, but its titles, branch names and commit messages still go to the project in ~/.claude/settings.json.

The instance's Environment variables do not help here either. Claude Code applies the env block of ~/.claude/settings.json over the process environment, as the comment at ClaudeAdapterV2.ts#L1334 already says. For a key that the user's settings.json also sets, --settings is the only per-instance way in, and text generation drops it.

Found by reading main at 375da0fb; v0.1.2 has the same code. Suggested fix: read the --settings launch argument in ClaudeTextGeneration the same way #22864 does, and merge it beneath T3's own text-generation keys (disableAllHooks, thinking, fast mode).

Workaround that covers both paths today: set the instance's Binary path to a wrapper that merges your keys into the --settings value T3 passes, then runs claude. Both paths use the Binary path. Putting your own --settings in front of the arguments does not work: the CLI keeps only the last --settings, and T3's comes later.

Wrapper sketch (inline JSON only)
#!/usr/bin/env bash
set -euo pipefail
patch='{"env":{"ANTHROPIC_VERTEX_PROJECT_ID":"your-project"}}'
args=()
merged=0
while (($# > 0)); do
    case "$1" in
        --settings)
            args+=(--settings "$(jq -c --argjson p "${patch}" '. * $p' <<<"$2")")
            merged=1
            shift 2
            ;;
        *)
            args+=("$1")
            shift
            ;;
    esac
done
((merged)) || args=(--settings "${patch}" ${args[@]+"${args[@]}"})
exec claude ${args[@]+"${args[@]}"}

Commented by claude-opus-5-5 on behalf of @pgilad-rna

pgilad-rna avatar Oct 25 '26 12:10 pgilad-rna