Repository navigation
Description
Before submitting
- I searched existing issues and did not find a duplicate.
- I included enough detail to reproduce or investigate the problem.
Area
apps/server
Steps to reproduce
From the repository root of a checkout of the commit under Version or commit with dependencies installed, save the script below as repro.sh outside the checkout and run bash repro.sh "$PWD" (set REPRO_SCRATCH to choose where its temporary fixture goes; it defaults to TMPDIR). The script creates a private fixture with its own HOME, TMPDIR and T3CODE_HOME, writes a temporary test file at apps/server/src/orchestration-v2/Adapters/claudeAppendDash.verify.test.ts that reuses the typed setup helpers from ClaudeAdapterV2.test.ts, runs only that file with env -u NODE_ENV, and removes the test file and fixture on exit. It never runs the Claude executable or calls a model.
The test configures the production Claude adapter with each launch-argument string below as the instance's launch arguments, opens a session, ensures its provider thread and calls runtime.startTurn. A query runner that implements the production interface records the SDK options instead of spawning Claude. It compares:
--append-system-prompt "Always answer in English"
--append-system-prompt "- Always answer in English"
--append-system-prompt "-- Always answer in English"
--append-system-prompt "--bogus-flag"
--append-system-prompt="- Always answer in English"
--append-system-prompt="-- Always answer in English"
The script exits 0 only while both double-hyphen values fail with the exact error above and all four controls succeed with their complete prompt text preserved.
The corresponding user configuration is the Claude instance's Launch arguments setting before a new thread or process starts; createClaudeAdapterV2 forwards that instance config into the same settings input the test uses. The browser presentation was not exercised.
Reproduction script: repro.sh
#!/bin/bash
set -euo pipefail
checkout=${1:?Usage: repro.sh /path/to/t3code-checkout}
checkout=$(cd "$checkout" && pwd)
fixture_parent=${REPRO_SCRATCH:-${TMPDIR:-/tmp}}
tmp=$(mktemp -d "$fixture_parent/append-dash.XXXXXX")
fixture="$checkout/apps/server/src/orchestration-v2/Adapters/claudeAppendDash.verify.test.ts"
if test -e "$fixture"; then echo 'Refusing to overwrite fixture' >&2; exit 2; fi
trap 'rm -f "$fixture"; rm -rf "$tmp"' EXIT
mkdir -p "$tmp/user-profile" "$tmp/tmp" "$tmp/t3" "$tmp/work"
python3 - "$checkout" "$fixture" <<'PY'
import pathlib, sys
repo=pathlib.Path(sys.argv[1])
source=(repo/'apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.test.ts').read_text()
# Reuse only typed setup helpers; the independent comparisons are below.
helpers=source[source.index('function makeClaudeTestAppThread('):source.index('describe("ClaudeAdapterV2 runtime query policy"')]
start=source[source.index(' const startTurnWithLaunchArgs ='):source.index(' const appendSystemPrompt =')]
imports='''import { appendFileSync } from "node:fs";
import * as ClaudeSdk from "@anthropic-ai/claude-agent-sdk";
import { vi } from "vite-plus/test";
import * as NodeServices from "@effect/platform-node/NodeServices";
import * as NodeCrypto from "@effect/platform-node/NodeCrypto";
import { ClaudeSettings, MessageId, NodeId, ProjectId, ProviderInstanceId, ProviderSessionId, RunAttemptId, RunId, ThreadId, type ModelSelection, type OrchestrationV2AppThread, type OrchestrationV2ProviderThread } from "@t3tools/contracts";
import { assert, it } from "@effect/vitest";
import * as DateTime from "effect/DateTime";
import * as SecureRandom from "effect/crypto/SecureRandom";
import * as Effect from "effect/Effect";
import * as Exit from "effect/Exit";
import * as FileSystem from "effect/FileSystem";
import * as Layer from "effect/Layer";
import * as Path from "effect/Path";
import * as Schema from "effect/Schema";
import * as Stream from "effect/Stream";
import * as McpProviderSessions from "@t3tools/provider-core/server/McpProviderSessions";
import * as ProviderAdapter from "@t3tools/provider-core/server/ProviderAdapter";
import * as IdAllocator from "@t3tools/provider-core/server/IdAllocator";
import { makeProviderFailure } from "@t3tools/provider-core/server/failure";
import { parseCliArgs } from "@t3tools/shared/cliArgs";
import * as ClaudeAdapterV2 from "./ClaudeAdapterV2.ts";
vi.mock("@anthropic-ai/claude-agent-sdk", async (importOriginal) => ({
...(await importOriginal<typeof ClaudeSdk>()),
resolveSettings: vi.fn().mockResolvedValue({effective: {}, provenance: {}, sources: []}),
}));
const DEFAULT_CLAUDE_SETTINGS = Schema.decodeSync(ClaudeSettings)({});
const CLAUDE_TEST_MODEL_SELECTION = {instanceId: ProviderInstanceId.make(ClaudeAdapterV2.CLAUDE_PROVIDER), model: "claude-sonnet-4-6", options: []} satisfies ModelSelection;
const CLAUDE_TEST_RUNTIME_POLICY = ProviderAdapter.ProviderAdapterV2RuntimePolicy.make({runtimeMode: "full-access", interactionMode: "default", cwd: process.env.VERIFY_CWD!});
'''
checks='''
it.effect("independently compares append prompt dash values through production startTurn", () => Effect.scoped(Effect.gen(function* () {
const cases = [
{ label: "plain-control", args: '--append-system-prompt "Always answer in English"', text: "Always answer in English", success: true },
{ label: "single-dash-bullet", args: '--append-system-prompt "- Always answer in English"', text: "- Always answer in English", success: true },
{ label: "double-dash-failure", args: '--append-system-prompt "-- Always answer in English"', text: "-- Always answer in English", success: false },
{ label: "double-dash-unknown-looking-value", args: '--append-system-prompt "--bogus-flag"', text: "--bogus-flag", success: false },
{ label: "single-dash-equals-control", args: '--append-system-prompt="- Always answer in English"', text: "- Always answer in English", success: true },
{ label: "double-dash-equals-workaround", args: '--append-system-prompt="-- Always answer in English"', text: "-- Always answer in English", success: true },
];
for (const row of cases) {
const result = yield* startTurnWithLaunchArgs(row.args, process.env.VERIFY_CWD!);
const failure = Exit.isFailure(result.exit) ? makeProviderFailure({cause: result.exit.cause, class: "provider_error"}) : null;
const options = result.opened[0];
const append = (options?.systemPrompt as {append?: string} | undefined)?.append;
const captured = {label: row.label, args: row.args, parsed: parseCliArgs(row.args), success: Exit.isSuccess(result.exit), queryOpens: result.opened.length, appendPreserved: append?.endsWith("\\n\\n" + row.text) ?? false, error: failure?.message ?? null};
appendFileSync(process.env.VERIFY_RESULTS!, JSON.stringify(captured) + "\\n");
assert.equal(captured.success, row.success, row.label);
assert.equal(captured.queryOpens, row.success ? 1 : 0, row.label);
assert.equal(captured.appendPreserved, row.success, row.label);
if (!row.success) assert.equal(captured.error, "The --append-system-prompt launch argument has no text. Add it after the flag in the Claude launch arguments, then send the message again.");
}
})).pipe(Effect.provide(Layer.mergeAll(IdAllocator.layer, McpProviderSessions.layer, NodeServices.layer, NodeCrypto.layer))));
'''
pathlib.Path(sys.argv[2]).write_text(imports+helpers+start+checks)
PY
cd "$checkout"
env -u NODE_ENV HOME="$tmp/user-profile" TMPDIR="$tmp/tmp" T3CODE_HOME="$tmp/t3" VERIFY_CWD="$tmp/work" VERIFY_RESULTS="$tmp/results.jsonl" PATH="$checkout/node_modules/.bin:$PATH" vp test run apps/server/src/orchestration-v2/Adapters/claudeAppendDash.verify.test.ts
cat "$tmp/results.jsonl"Expected behavior
A quoted prompt value after --append-system-prompt should reach the SDK's systemPrompt.append after T3's instructions, including when its first two characters are hyphens. The append-argument reader's doc comment says it "checks the append launch arguments the way the Claude CLI would", and the option constructor folds inline prompt text after T3's instructions. That reader and its missing-value check came from #20413 (8c51e4e), whose description says configured append text must reach the model and that invalid values fail before a process is replaced.
The Claude Code CLI 2.1.322 consumes such a value as the prompt. With an empty private HOME and CLAUDE_CONFIG_DIR and a minimal environment, each probe below ends with a deliberately nonexistent option so it fails at argument parsing before any turn runs. With "-- Always answer in English", "- Always answer in English" or --bogus-flag after --append-system-prompt, the CLI reports only that final unknown option, so it accepted the dash-leading token as the prompt. Omitting the value gives option '--append-system-prompt <prompt>' argument missing, and --bogus-flag alone gives unknown option '--bogus-flag':
-p --append-system-prompt "-- Always answer in English" --t3-verifier-nonexistent-option -> exit 1: error: unknown option '--t3-verifier-nonexistent-option'
-p --append-system-prompt "- Always answer in English" --t3-verifier-nonexistent-option -> exit 1: error: unknown option '--t3-verifier-nonexistent-option'
-p --append-system-prompt --bogus-flag --t3-verifier-nonexistent-option -> exit 1: error: unknown option '--t3-verifier-nonexistent-option'
-p --append-system-prompt -> exit 1: error: option '--append-system-prompt <prompt>' argument missing
-p --bogus-flag -> exit 1: error: unknown option '--bogus-flag'
Actual behavior
When a Claude instance's Launch arguments contain --append-system-prompt "-- Always answer in English" (any quoted prompt value whose first two characters are hyphens), a fresh Claude turn fails before the process opens with The --append-system-prompt launch argument has no text. Add it after the flag in the Claude launch arguments, then send the message again. The user did supply text, and the Claude CLI accepts that same argument as the prompt, so the instruction in the error cannot fix the input. Plain text and a single-hyphen Markdown bullet such as "- Always answer in English" work; only values beginning with -- fail. The quoted equals form --append-system-prompt="-- Always answer in English" works today.
For both quoted values that begin with --, runtime.startTurn fails before the query runner opens (zero query opens) and the mapped provider error is The --append-system-prompt launch argument has no text. Add it after the flag in the Claude launch arguments, then send the message again. The plain-text control, the single-hyphen Markdown bullet and both quoted equals-form values succeed, open one query and preserve the exact prompt text after T3's instructions. The rerun at d9805b2 exited 0 with these results (the args field is omitted, and the parsed parser output is kept only for the failing rows):
{"label":"plain-control","success":true,"queryOpens":1,"appendPreserved":true,"error":null}
{"label":"single-dash-bullet","success":true,"queryOpens":1,"appendPreserved":true,"error":null}
{"label":"double-dash-failure","parsed":{"flags":{"append-system-prompt":null," Always answer in English":null},"positionals":[]},"success":false,"queryOpens":0,"appendPreserved":false,"error":"The --append-system-prompt launch argument has no text. Add it after the flag in the Claude launch arguments, then send the message again."}
{"label":"double-dash-unknown-looking-value","parsed":{"flags":{"append-system-prompt":null,"bogus-flag":null},"positionals":[]},"success":false,"queryOpens":0,"appendPreserved":false,"error":"The --append-system-prompt launch argument has no text. Add it after the flag in the Claude launch arguments, then send the message again."}
{"label":"single-dash-equals-control","success":true,"queryOpens":1,"appendPreserved":true,"error":null}
{"label":"double-dash-equals-workaround","success":true,"queryOpens":1,"appendPreserved":true,"error":null}
The turn-start failure and the absence of a query open are observed. That the failed turn is shown as an error item with this message is established from production source only: the turn-start service writes the mapped failure as an error item. The browser rendering, reuse of an already running Claude process and real model adherence were not observed.
Evidence
- Expected source: the append-argument reader's contract at
apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.tslines 1956-1985 and the option constructor at lines 1824-1845 (linked above), from fix(server): Claude append-system-prompt launch arguments reach the model #20413; the Claude Code CLI 2.1.322 parse-time probes above, which accept a---leading value as the prompt. - Failure source: the reproduction output above;
parseCliArgstreats the next token as a value only when it does not begin with--, so it recordsappend-system-promptasnulland the prompt text as another flag; the fresh-process preflight instartTurnthen raisesClaudeAppendSystemPromptMissingValueError, whose message is the observed error. - Evidence provenance: observed
- Local verification: reproduced
- Reproduction completeness: complete
The generic parser's next-token rule was introduced with the Launch Args setting in #1971 (5e1dd56) and its tests pin adjacent boolean long flags such as --chrome --debug as separate flags, so a blanket parser change could break those callers; the conflict is with this known value-taking Claude option. Existing focused tests for parseCliArgs, tokenizeCliArgs and the append launch arguments passed at d9805b2 (26 passed, 366 unselected).
Related
Hypothesis, not established: the generic parser's next-token rule conflicts with the append reader's expectation that this value-taking option always consumes the next argument. Related but different: #20413 added append folding and the missing-value check, resolving #13934 (a prompt file ignored); open issue #26973 concerns instructions inserted later by an external launcher; #14890 is an older closed, unmerged append-folding PR; #21336 is a closed, unmerged PR about continuing to parse options after a standalone -- terminator, a different token. Open PR #34874 changes Claude text generation --settings handling and not this parsing. No open issue or PR for this behavior was found.
Restoration check
With the same Launch arguments, --append-system-prompt "-- Always answer in English" and --append-system-prompt "--bogus-flag" start the turn, open one query and end systemPrompt.append with exactly -- Always answer in English or --bogus-flag after T3's instructions; today both fail with the "has no text" error and open no query. Controls that must keep passing: the plain and single-hyphen values and both equals-form values keep their current exact preservation, a genuinely missing value (--append-system-prompt with nothing after it) still fails before a process opens, and adjacent boolean flags parsed by parseCliArgs for other callers (for example --chrome --debug) keep their current meaning. The script asserts the current defect and exits nonzero once it is fixed; reverse its double-hyphen assertions to use it as a regression check.
Impact
Minor bug or occasional failure
P2 (supported): A fresh Claude process cannot start for a bounded set of valid prompt values that the Claude CLI accepts, and the error tells the user to add text they already supplied; the turn fails rather than losing the prompt silently, and other prompt values are unaffected.
Version or commit
d9805b2; the same six-case reproduction gave identical results at upstream main 4099e62. At upstream main d8f3fef, packages/shared/src/cliArgs.ts is byte-identical and the append-argument reader and its error message are unchanged (source comparison only; not rerun there).
Environment
Darwin arm64, Node v26.12.1, test runner v5.0.5, Claude Agent SDK dependency 0.3.321, native Claude Code CLI 2.1.322 (the latest release when tested) used only for parse-time probes. Function-level reproduction through the production Claude adapter's startTurn; no T3 server, browser, desktop app or model-backed Claude turn was run.
Logs or stack traces
Tests 1 passed (1)
{"label":"plain-control","args":"--append-system-prompt \"Always answer in English\"","parsed":{"flags":{"append-system-prompt":"Always answer in English"},"positionals":[]},"success":true,"queryOpens":1,"appendPreserved":true,"error":null}
{"label":"single-dash-bullet","args":"--append-system-prompt \"- Always answer in English\"","parsed":{"flags":{"append-system-prompt":"- Always answer in English"},"positionals":[]},"success":true,"queryOpens":1,"appendPreserved":true,"error":null}
{"label":"double-dash-failure","args":"--append-system-prompt \"-- Always answer in English\"","parsed":{"flags":{"append-system-prompt":null," Always answer in English":null},"positionals":[]},"success":false,"queryOpens":0,"appendPreserved":false,"error":"The --append-system-prompt launch argument has no text. Add it after the flag in the Claude launch arguments, then send the message again."}
{"label":"double-dash-unknown-looking-value","args":"--append-system-prompt \"--bogus-flag\"","parsed":{"flags":{"append-system-prompt":null,"bogus-flag":null},"positionals":[]},"success":false,"queryOpens":0,"appendPreserved":false,"error":"The --append-system-prompt launch argument has no text. Add it after the flag in the Claude launch arguments, then send the message again."}
{"label":"single-dash-equals-control","args":"--append-system-prompt=\"- Always answer in English\"","parsed":{"flags":{"append-system-prompt":"- Always answer in English"},"positionals":[]},"success":true,"queryOpens":1,"appendPreserved":true,"error":null}
{"label":"double-dash-equals-workaround","args":"--append-system-prompt=\"-- Always answer in English\"","parsed":{"flags":{"append-system-prompt":"-- Always answer in English"},"positionals":[]},"success":true,"queryOpens":1,"appendPreserved":true,"error":null}
Screenshots, recordings, or supporting files
No response
Workaround
Use the quoted equals form, --append-system-prompt="-- Always answer in English"; it started the turn and preserved the exact prompt text in the same reproduction. Keep a multiword value quoted.
Activity
maria-rcks commentedon Nov 15, 2026
Note
Written by
claude-fable-5-2on behalf of MariaClosing: this account is denounced in
.github/VOUCHED.tdfor filing automated issues faster than maintainers can triage them. A fix PR that links this issue is not affected by this close.