The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 21, 12:15 UTC
fix(server): Claude text generation honors --settings launch args (#34874)
Julius Marminge committed
Nov 14, 2026 at 20:55 UTC
85a81b7a8b0af7e0f7702fbe359ff6b311256182
3 files changed
+44
-1
apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.ts
+1
-1
@@ -2384,7 +2384,7 @@ const decodeClaudeLaunchArgSettings = Schema.decodeUnknownEffect(
2384
* relative to the thread's cwd (the project or its worktree).
2385
* makeClaudeQueryOptions merges the result beneath T3's own settings.
2386
*/
2387
-const readClaudeLaunchArgSettings = Effect.fn("ClaudeAdapterV2.readLaunchArgSettings")(
2387
+export const readClaudeLaunchArgSettings = Effect.fn("ClaudeAdapterV2.readLaunchArgSettings")(
2388
function* (input: {
2389
readonly settings: ClaudeSettings | undefined;
2390
readonly cwd: string | null;
apps/server/src/textGeneration/ClaudeTextGeneration.test.ts
+29
@@ -234,6 +234,35 @@ it.layer(layerClaudeTextGenerationTest)("ClaudeTextGeneration", (it) => {
234
}),
235
);
236
237
+ it.effect("passes --settings from the instance launch args to Claude text generation", () =>
238
+ withFakeClaudeEnv(
239
+ {
240
+ output: JSON.stringify({
241
+ structured_output: {
242
+ title: "Use instance settings",
243
+ },
244
+ }),
245
+ argsMustContain: `"env":{"ANTHROPIC_VERTEX_PROJECT_ID":"vertex-project-a"}`,
246
+ claudeConfig: {
247
+ launchArgs: `--settings '{"env":{"ANTHROPIC_VERTEX_PROJECT_ID":"vertex-project-a"}}'`,
248
+ },
249
+ },
250
+ (textGeneration) =>
251
+ Effect.gen(function* () {
252
+ const generated = yield* textGeneration.generateThreadTitle({
253
+ cwd: process.cwd(),
254
+ message: "thread title",
255
+ modelSelection: {
256
+ instanceId: ProviderInstanceId.make("claudeAgent"),
257
+ model: SYNTHETIC_CLAUDE_STANDARD_MODEL,
258
+ },
259
+ });
260
+
261
+ expect(generated.title).toBe(sanitizeThreadTitle("Use instance settings"));
262
+ }),
263
+ ),
264
+ );
265
+
266
it.effect("retries without --no-session-persistence when the Claude CLI rejects it", () =>
267
withFakeClaudeEnv(
268
{
apps/server/src/textGeneration/ClaudeTextGeneration.ts
+14
@@ -1,6 +1,7 @@
1
import * as Effect from "effect/Effect";
2
import * as FileSystem from "effect/FileSystem";
3
import * as Option from "effect/Option";
4
+import * as Path from "effect/Path";
5
import * as Schema from "effect/Schema";
6
import * as Scope from "effect/Scope";
7
import * as Stream from "effect/Stream";
@@ -33,6 +34,7 @@ import {
34
hasClaudeManagedMcpConfig,
35
makeClaudeEnvironment,
36
} from "../provider/Drivers/ClaudeHome.ts";
37
+import { readClaudeLaunchArgSettings } from "../orchestration-v2/Adapters/ClaudeAdapterV2.ts";
38
39
const CLAUDE_TIMEOUT_MS = 180_000;
40
/** `--tools` takes bare names; patterns go in the allow list. */
@@ -105,6 +107,7 @@ export const makeClaudeTextGeneration = Effect.fn("makeClaudeTextGeneration")(fu
107
) {
108
const commandSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
109
const fileSystem = yield* FileSystem.FileSystem;
110
+ const path = yield* Path.Path;
111
const claudeEnvironment = yield* makeClaudeEnvironment(claudeSettings, environment);
112
const scopedModelCatalog = modelCatalog.pipe(
113
Effect.map((catalog) => scopeClaudeModelCatalog(catalog, claudeSettings.customModels)),
@@ -200,7 +203,18 @@ export const makeClaudeTextGeneration = Effect.fn("makeClaudeTextGeneration")(fu
203
: undefined;
204
const fastMode =
205
fastModeDescriptor?.type === "boolean" ? fastModeDescriptor.currentValue : undefined;
206
+ const launchArgSettings = yield* readClaudeLaunchArgSettings({
207
+ settings: claudeSettings,
208
+ cwd,
209
+ fileSystem,
210
+ path,
211
+ }).pipe(
212
+ Effect.mapError(
213
+ (cause) => new TextGenerationError({ operation, detail: cause.message, cause }),
214
+ ),
215
+ );
216
const settings = {
217
+ ...launchArgSettings,
218
disableAllHooks: true,
219
...(typeof thinking === "boolean" ? { alwaysThinkingEnabled: thinking } : {}),
220
...(fastMode ? { fastMode: true } : {}),