Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions apps/server/src/textGeneration/ClaudeTextGeneration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -233,8 +233,9 @@ it.layer(layerClaudeTextGenerationTest)("ClaudeTextGeneration", (it) => {
Effect.gen(function* () {
const isolation = {
cwdMustNotBe: process.cwd(),
argsMustContain: "--safe-mode --disallowedTools * --setting-sources",
argsMustNotContain: "--bare",
argsMustContain: "--safe-mode --setting-sources",
// `--disallowedTools *` also blocks the tool Claude uses to return structured_output.
argsMustNotContain: "--bare\n--disallowedTools",
};
const modelSelection = {
instanceId: ProviderInstanceId.make("claudeAgent"),
Expand Down Expand Up @@ -293,8 +294,9 @@ it.layer(layerClaudeTextGenerationTest)("ClaudeTextGeneration", (it) => {
{
output: JSON.stringify({ structured_output: { statements: [] } }),
cwdMustNotBe: process.cwd(),
argsMustContain: "--safe-mode --disallowedTools * --setting-sources",
argsMustNotContain: "--bare",
argsMustContain: "--safe-mode --setting-sources",
// `--disallowedTools *` also blocks the tool Claude uses to return structured_output.
argsMustNotContain: "--bare\n--disallowedTools",
},
(textGeneration) =>
textGeneration.generateConversationSummary({
Expand Down Expand Up @@ -329,8 +331,9 @@ it.layer(layerClaudeTextGenerationTest)("ClaudeTextGeneration", (it) => {
},
}),
cwdMustNotBe: process.cwd(),
argsMustContain: "--safe-mode --disallowedTools * --setting-sources",
argsMustNotContain: "--bare",
argsMustContain: "--safe-mode --setting-sources",
// `--disallowedTools *` also blocks the tool Claude uses to return structured_output.
argsMustNotContain: "--bare\n--disallowedTools",
},
(textGeneration) =>
textGeneration.generateModelEvaluation({
Expand Down
4 changes: 3 additions & 1 deletion apps/server/src/textGeneration/ClaudeTextGeneration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,9 @@ export const makeClaudeTextGeneration = Effect.fn("makeClaudeTextGeneration")(fu
...(investigate ? ["--setting-sources", "user"] : []),
"--disable-slash-commands",
// Safe mode isolates customizations while retaining subscription authentication.
...(isolated ? ["--safe-mode", "--disallowedTools", "*", "--setting-sources", ""] : []),
// `--tools ""` already removes every tool; `--disallowedTools *` would also block the
// internal tool that returns `structured_output`, so every isolated run would fail.
...(isolated ? ["--safe-mode", "--setting-sources", ""] : []),
...(noSessionPersistence ? [NO_SESSION_PERSISTENCE] : []),
// managed-mcp.json already isolates servers and makes Claude reject this flag.
...(managedMcpConfig ? [] : ["--strict-mcp-config"]),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,11 @@ if (argsMustContain && !args.includes(argsMustContain)) {
fail("args missing expected content", 2);
}

const argsMustNotContain = process.env.T3_FAKE_CLAUDE_ARGS_MUST_NOT_CONTAIN;
if (argsMustNotContain && args.includes(argsMustNotContain)) {
// One forbidden fragment per line.
const argsMustNotContain = (process.env.T3_FAKE_CLAUDE_ARGS_MUST_NOT_CONTAIN ?? "")
.split("\n")
.filter(Boolean);
if (argsMustNotContain.some((fragment) => args.includes(fragment))) {
fail("args contained forbidden content", 3);
}

Expand Down
Loading