Skip to content

OpenAI's Codex Security CLI and TypeScript SDK for finding, validating, and fixing security vulnerabilities. npm: https://www.npmjs.com/package/@openai/codex-security

feat(cli): share model options across commands (#1143)

mldangelo-oai336fbb9282f5
diff --git a/plugins/codex-security/mcp-app/tests/test_deep_scan_executor.mjs b/plugins/codex-security/mcp-app/tests/test_deep_scan_executor.mjs
index 868c92bde..535330007 100644
--- a/plugins/codex-security/mcp-app/tests/test_deep_scan_executor.mjs
+++ b/plugins/codex-security/mcp-app/tests/test_deep_scan_executor.mjs
@@ -1167,127 +1167,165 @@ async function testWorkerRuntimeSettings() {
);
const launches = [];
childProcess.spawn = (command, args, options) => {
- launches.push({ command, args, environment: options.env });
+ const markerPath = path.join(
+ fixture.root,
+ `invocation-${launches.length}.json`,
+ );
+ const environment = {
+ ...options.env,
+ FAKE_CODEX_MARKER: markerPath,
+ FAKE_CODEX_PREFLIGHT_MARKER: markerPath,
+ };
+ launches.push({ command, args, environment, markerPath });
return originalSpawn(
command,
command === process.execPath ||
command === path.toNamespacedPath(process.execPath)
? [fixture.executablePath, ...args]
: args,
- options,
+ { ...options, env: environment },
);
};
syncBuiltinESMExports();
- const executor = new CodexSdkWorkerExecutor({
- model: "gpt-5.6-sol",
- reasoningEffort: "xhigh",
- parentSandbox: trustedParentSandboxWithDenials,
- artifactContext: {
- pluginRoot: fixture.root,
- scanRoot: fixture.root,
- repoRoot: fixture.root,
- scanId: "fixture-scan",
- pythonCommand: helperPython,
- },
- });
+ const settings = [
+ { model: "gpt-5.6-sol", reasoningEffort: "xhigh" },
+ { model: "gpt-6-astra", reasoningEffort: "ultra" },
+ { model: "gpt-6.1-sol", reasoningEffort: "max" },
+ ];
+ const executors = settings.map(
+ (modelSettings) =>
+ new CodexSdkWorkerExecutor({
+ ...modelSettings,
+ parentSandbox: trustedParentSandboxWithDenials,
+ artifactContext: {
+ pluginRoot: fixture.root,
+ scanRoot: fixture.root,
+ repoRoot: fixture.root,
+ scanId: `fixture-scan-${modelSettings.model}`,
+ pythonCommand: helperPython,
+ },
+ }),
+ );
// A running coordinator retains its settings if the source file changes.
for (const kind of ["discovery", "dedup"]) {
for (const resumeThreadId of [undefined, "fixture-resumed-thread"]) {
launches.length = 0;
- await executor.run({
- kind,
- promptPath,
- workingDirectory: fixture.root,
- subagents: 0,
- resumeThreadId,
- artifactContext: {
- root: fixture.root,
- layout: kind === "dedup" ? "reducer" : "worker",
- ...(kind === "dedup"
- ? {
- deepReducer: { scanRoot: fixture.root, claimedWorkers: [] },
- }
- : {}),
- },
- signal: new AbortController().signal,
- });
+ await Promise.all(
+ executors.map((executor) =>
+ executor.run({
+ kind,
+ promptPath,
+ workingDirectory: fixture.root,
+ subagents: 0,
+ resumeThreadId,
+ artifactContext: {
+ root: fixture.root,
+ layout: kind === "dedup" ? "reducer" : "worker",
+ ...(kind === "dedup"
+ ? {
+ deepReducer: {
+ scanRoot: fixture.root,
+ claimedWorkers: [],
+ },
+ }
+ : {}),
+ },
+ signal: new AbortController().signal,
+ }),
+ ),
+ );
const workerLaunches = launches.filter(
({ args }) => args[0] === "exec",
);
- assert.equal(workerLaunches.length, 1);
- const workerLaunch = workerLaunches[0];
- assert.equal(
- workerLaunch.command,
- process.platform === "win32"
- ? path.toNamespacedPath(process.execPath)
- : process.execPath,
- );
- assert.equal(
- workerLaunch.environment.CODEX_CLI_PATH,
- process.execPath,
- );
- assert.equal(
- workerLaunch.environment.CODEX_HOME,
- await realpath(codexHome),
- );
- assert.equal(
- workerLaunch.environment.CODEX_SECURITY_CONFIG_PATH,
- configPath,
- );
- assert.equal(
- workerLaunch.environment.CODEX_SECURITY_DEEP_SCAN_CONFIG_PATH,
- process.env.CODEX_SECURITY_DEEP_SCAN_CONFIG_PATH,
- );
- assert.equal(
- workerPermissionProfileOverride(workerLaunch.args),
- 'permissions.codex_security_deep_scan_worker={extends=":read-only",filesystem={":root"="read","/repo/.env"="deny","/repo/**/.secret"="deny","/repo/**/*.pem"="deny",glob_scan_max_depth=3},network={enabled=false}}',
- );
- const invocation = JSON.parse(
- await readFile(fixture.markerPath, "utf8"),
- );
- if (expected === undefined) {
+ assert.equal(workerLaunches.length, settings.length);
+ for (const { model, reasoningEffort } of settings) {
+ const workerLaunch = workerLaunches.find(
+ ({ args }) => args[args.indexOf("--model") + 1] === model,
+ );
+ assert.ok(workerLaunch, `missing worker launch for ${model}`);
+ assert.equal(
+ workerLaunch.command,
+ process.platform === "win32"
+ ? path.toNamespacedPath(process.execPath)
+ : process.execPath,
+ );
+ assert.equal(
+ workerLaunch.environment.CODEX_CLI_PATH,
+ process.execPath,
+ );
+ assert.equal(
+ workerLaunch.environment.CODEX_HOME,
+ await realpath(codexHome),
+ );
assert.equal(
- invocation.argv.some((arg) =>
- arg.startsWith("model_reasoning_summary="),
+ workerLaunch.environment.CODEX_SECURITY_CONFIG_PATH,
+ configPath,
+ );
+ assert.equal(
+ workerLaunch.environment.CODEX_SECURITY_DEEP_SCAN_CONFIG_PATH,
+ process.env.CODEX_SECURITY_DEEP_SCAN_CONFIG_PATH,
+ );
+ assert.equal(
+ workerPermissionProfileOverride(workerLaunch.args),
+ 'permissions.codex_security_deep_scan_worker={extends=":read-only",filesystem={":root"="read","/repo/.env"="deny","/repo/**/.secret"="deny","/repo/**/*.pem"="deny",glob_scan_max_depth=3},network={enabled=false}}',
+ );
+ const invocation = JSON.parse(
+ await readFile(workerLaunch.markerPath, "utf8"),
+ );
+ if (expected === undefined) {
+ assert.equal(
+ invocation.argv.some((arg) =>
+ arg.startsWith("model_reasoning_summary="),
+ ),
+ false,
+ );
+ } else {
+ assert.equal(
+ invocation.argv.includes(
+ `model_reasoning_summary=${JSON.stringify(expected)}`,
+ ),
+ true,
+ );
+ }
+ assert.equal(
+ invocation.argv.includes(
+ `model_reasoning_effort=${JSON.stringify(reasoningEffort)}`,
),
- false,
+ true,
+ );
+ assertFlagPair(invocation.argv, "--model", model);
+ assert.equal(
+ invocation.argv.includes("resume"),
+ resumeThreadId !== undefined,
);
- } else {
+ assert.equal(invocation.configPath, configPath);
+ assert.deepEqual(invocation.gitEnvironment, gitEnvironment);
+ for (const [name, value] of Object.entries(gitEnvironment)) {
+ assert.equal(process.env[name], value);
+ }
+ assert.equal(invocation.python, python);
assert.equal(
invocation.argv.includes(
- `model_reasoning_summary=${JSON.stringify(expected)}`,
+ `mcp_servers.cs_artifacts.env.CODEX_SECURITY_PYTHON_COMMAND=${JSON.stringify(helperPython)}`,
),
true,
);
+ assert.equal(process.env.PYTHON, python);
+ assert.equal(
+ invocation.deepConfigPath,
+ process.env.CODEX_SECURITY_DEEP_SCAN_CONFIG_PATH,
+ );
+ assertReadOnlyWorkerPolicy(invocation.argv);
+ assertWorkerSubagentPolicy(invocation.argv, 0);
}
- assert.equal(
- invocation.argv.includes('model_reasoning_effort="xhigh"'),
- true,
- );
- assertFlagPair(invocation.argv, "--model", "gpt-5.6-sol");
- assert.equal(invocation.configPath, configPath);
- const preflight = JSON.parse(
- await readFile(fixture.preflightMarkerPath, "utf8"),
- );
- assert.deepEqual(invocation.gitEnvironment, gitEnvironment);
- assert.deepEqual(preflight.gitEnvironment, gitEnvironment);
- for (const [name, value] of Object.entries(gitEnvironment)) {
- assert.equal(process.env[name], value);
+ for (const launch of launches.filter(({ args }) =>
+ args.includes("app-server"),
+ )) {
+ const preflight = JSON.parse(
+ await readFile(launch.markerPath, "utf8"),
+ );
+ assert.deepEqual(preflight.gitEnvironment, gitEnvironment);
}
- assert.equal(invocation.python, python);
- assert.equal(
- invocation.argv.includes(
- `mcp_servers.cs_artifacts.env.CODEX_SECURITY_PYTHON_COMMAND=${JSON.stringify(helperPython)}`,
- ),
- true,
- );
- assert.equal(process.env.PYTHON, python);
- assert.equal(
- invocation.deepConfigPath,
- process.env.CODEX_SECURITY_DEEP_SCAN_CONFIG_PATH,
- );
- assertReadOnlyWorkerPolicy(invocation.argv);
- assertWorkerSubagentPolicy(invocation.argv, 0);
await writeFile(configPath, 'model_reasoning_summary = "detailed"\n');
}
}
@@ -2195,7 +2233,7 @@ async function fakeCodexFixture(
`const preflightProfile = ${JSON.stringify(preflightProfile)};`,
`const preflightAllowed = ${JSON.stringify(preflightAllowed)};`,
`const accountResult = ${JSON.stringify(accountResult)};`,
- `const preflightMarkerPath = ${JSON.stringify(preflightMarkerPath)};`,
+ `const preflightMarkerPath = process.env.FAKE_CODEX_PREFLIGHT_MARKER ?? ${JSON.stringify(preflightMarkerPath)};`,
"if (process.argv.includes('app-server')) {",
" const preflight = { cwd: process.cwd(), codexHome: process.env.CODEX_HOME, gitEnvironment: Object.fromEntries(['PATH', 'CODEX_SECURITY_GIT', 'GIT_SSH_COMMAND', 'GIT_CONFIG_GLOBAL'].map(name => [name, process.env[name]])), requests: [] };",
" writeFileSync(preflightMarkerPath, JSON.stringify(preflight));",
diff --git a/sdk/typescript/README.md b/sdk/typescript/README.md
index fc00bf583..57e1a744c 100644
--- a/sdk/typescript/README.md
+++ b/sdk/typescript/README.md
@@ -861,13 +861,28 @@ sandbox = "unelevated"
```
Use `--model` to choose a model and `--effort minimal|low|medium|high|xhigh|max`
-for reasoning effort. Repeat `--codex KEY=VALUE` for other TOML settings:
+for reasoning effort. Both flags work with `scan`, `bulk-scan`, `scan-components`,
+`policy`, `validate`, `patch`, `verify-fix`, `suggest-owners`, `classify-severity`,
+`scans match`, and `scans compare`.
+
+Model IDs are passed through to Codex, including `gpt-6-astra`, `gpt-6.1-sol`,
+and `gpt-6-luna`; availability depends on your credentials and inference provider.
+For Astra and GPT-6.1 Sol, use `low`, `medium`, `high`, `xhigh`, or `max`, as
+documented in the [OpenAI model guide](https://developers.openai.com/api/docs/guides/latest-model).
+Omitting these flags preserves each command's defaults: scans, policy generation,
+validation, patching, verification, and owner suggestions use `gpt-5.6-sol`/`xhigh`;
+matching and severity classification use Codex's configured model and `medium` effort.
+
+Repeat `--codex KEY=VALUE` for other TOML settings on commands that support it:
```bash
npx @openai/codex-security scan . \
- --model gpt-5.6-terra \
+ --model gpt-6.1-sol \
--effort high \
--codex features.multi_agent_v2.max_concurrent_threads_per_session=4
+
+npx @openai/codex-security patch issues.md --model gpt-6-astra --effort max
+npx @openai/codex-security verify-fix issues.md --model gpt-6.1-sol --effort high
```
The thread limit of `9` includes the parent and up to eight delegated workers.
@@ -884,15 +899,15 @@ or `features.plugins` are rejected, including in profiles. Multi-agent v2 must
stay enabled: `agents.max_threads` and
`features.multi_agent_v2.enabled=false` are rejected.
-`validate`, `patch`, and `verify-fix` accept `--auth`, `--effort`, and the `model`,
-`model_reasoning_effort`, `model_provider`, `model_providers`, and
-`analytics.enabled` keys in `--codex`, but no other runtime overrides.
+`validate`, `patch`, and `verify-fix` accept `--auth`, `--model`, and `--effort`.
+Their `--codex` overrides are limited to `model`, `model_reasoning_effort`,
+`model_provider`, `model_providers`, and `analytics.enabled`.
Use the same provider settings as `scan` when routing a standalone patch
through a custom inference gateway:
```bash
npx @openai/codex-security patch "Security issue" \
- --codex 'model="gateway-model"' \
+ --model gateway-model \
--codex 'model_provider="gateway"' \
--codex 'model_providers.gateway.name="Gateway"' \
--codex 'model_providers.gateway.base_url="https://gateway.example.test/v1"' \
@@ -901,9 +916,14 @@ npx @openai/codex-security patch "Security issue" \
```
Set the selected provider's API-key environment variable before running the
-command. Provider settings also apply to `patch --assess-patch-risk`.
+command. Model, effort, and provider settings also apply to
+`patch --assess-patch-risk`.
Sandbox, approval, and plugin settings remain controlled by the command.
+`scans resume` and `scans rerun` retain the saved scan's settings. `dedupe` uses
+separate screening and review models, so it does not expose a single model/effort
+override.
+
Use `--codex 'analytics.enabled=false'` to disable Codex usage analytics and
built-in metrics for a command:
@@ -1052,6 +1072,8 @@ means an upper estimate is unavailable, including models without verified
long-context rates. `cost.pricing` records the price source, verification date,
processing tier, short-context rates, and verified long-context rates when known.
Models without known short-context prices still have no cost estimate.
+GPT-6 Astra, GPT-6.1 Sol, and GPT-6 Luna have verified standard prices for cost
+estimates and `--max-cost` limits.
For compatibility, `cacheWriteInputTokens` remains the reported token subtotal.
`cacheWriteInputTokensReported: false` means at least one included usage record
@@ -1668,7 +1690,16 @@ retaining stable finding identities. Ctrl-C keeps comparisons already saved.
Only high-confidence duplicates are grouped; uncertain and independently
related findings stay separate. Matching preserves triage and sealed artifacts.
-Codex is called only when a new decision is needed, using existing authentication.
+Codex runs only for new matching decisions, using existing authentication.
+`scans match` and `scans compare` accept `--model` and `--effort`; the defaults
+are Codex's configured model and `medium` effort. Cached matches are reused
+even when these flags change. To recompute all matches:
+
+```bash
+npx @openai/codex-security scans match --all --force \
+ --model gpt-6.1-sol --effort high
+```
+
Scans without sealed artifacts are skipped, but their confirmed links can still
be reused. Older custom plugins save confirmed and uncertain matches; use the
bundled plugin for related links and large comparisons.
@@ -1848,9 +1879,10 @@ npx @openai/codex-security patch --scan SCAN_ID --assess-patch-risk --create-pr
npx @openai/codex-security patch --linear-issue SEC-123 --assess-patch-risk --create-pr
```
-`--scan latest` selects the current repository's latest scan. Patch commands
-support `--json`, including literal-text and file inputs. Change
-the model with `--codex 'model="gpt-5.6-sol"'` or effort with `--effort high`.
+`--scan latest` selects the current repository's latest completed scan. Patch
+commands support `--json`, including literal-text and file inputs. Change
+the model with `--model gpt-6.1-sol` or effort with `--effort high`.
+The existing `--codex 'model="..."'` syntax is also supported.
Each finding gets its own saved Codex desktop task.
Before patching, the CLI runs a command with the task's sandbox policy. If the
diff --git a/sdk/typescript/src/api.ts b/sdk/typescript/src/api.ts
index 2d97f8a30..193954b2f 100644
--- a/sdk/typescript/src/api.ts
+++ b/sdk/typescript/src/api.ts
@@ -60,6 +60,7 @@ import {
scanModelProvider,
type CodexSecurityConfig,
type JsonObject,
+ type ScanModelConfiguration,
writeCodexConfig,
} from "./config.js";
import {
@@ -403,7 +404,7 @@ type ScanObserverName =
| "onStage"
| "onWarning";
-export interface ScanPreflight extends DeepScanOptions {
+export interface ScanPreflight extends DeepScanOptions, ScanModelConfiguration {
repository: string;
target: NormalizedTarget;
mode: ScanMode;
@@ -411,9 +412,7 @@ export interface ScanPreflight extends DeepScanOptions {
outputDir: string | null;
archiveDir?: string;
authentication: ScanAuthentication;
- model: string;
modelProvider?: string;
- reasoningEffort: string;
maxCostUsd?: number;
deepScanSources?: DeepScanSources;
}
diff --git a/sdk/typescript/src/classify-severity.ts b/sdk/typescript/src/classify-severity.ts
index 59077a7fc..57af60c20 100644
--- a/sdk/typescript/src/classify-severity.ts
+++ b/sdk/typescript/src/classify-severity.ts
@@ -1,7 +1,6 @@
import { readFile, readdir } from "node:fs/promises";
import { join } from "node:path";
import { z } from "incur";
-import type { CodexSecurityConfig } from "./config.js";
import { CodexSecurityError } from "./errors.js";
import { workflowDigest } from "./finding-workflow.js";
import { prepareKnowledgeBase } from "./knowledge-base.js";
@@ -20,18 +19,19 @@ export type SeverityClassificationFinding = Pick<
Partial<Pick<Finding, "occurrenceId" | "severity">> &
Record<string, unknown>;
-export interface ClassifySeverityOptions {
+export interface ClassifySeverityOptions extends Pick<
+ ReadOnlyCodexOptions,
+ | "config"
+ | "environment"
+ | "model"
+ | "reasoningEffort"
+ | "signal"
+ | "workingDirectory"
+> {
/** Classification policy. Omit to inherit existing severity without a model call. */
rubricPath?: string;
/** Supporting evidence, separate from classification policy. */
knowledgeBasePaths?: readonly string[];
- config?: CodexSecurityConfig;
- environment?: NodeJS.ProcessEnv;
- model?: string;
- reasoningEffort?:
- "minimal" | "low" | "medium" | "high" | "xhigh" | "max" | "ultra";
- signal?: AbortSignal;
- workingDirectory?: string;
/** @internal Test client for the shared read-only runtime. */
codex?: ReadOnlyCodexOptions["codex"];
}
diff --git a/sdk/typescript/src/cli.ts b/sdk/typescript/src/cli.ts
index 6eac49b75..a46fa5b97 100644
--- a/sdk/typescript/src/cli.ts
+++ b/sdk/typescript/src/cli.ts
@@ -306,13 +306,25 @@ const MODEL_REASONING_EFFORTS = [
"xhigh",
"max",
] as const;
-type ScanReasoningEffort = (typeof MODEL_REASONING_EFFORTS)[number];
const DEFAULT_SCAN_MODEL_CONFIGURATION =
scanModelConfiguration(DEFAULT_CODEX_CONFIG);
-const CODEX_OVERRIDE_DESCRIPTION =
- 'Repeat TOML KEY=VALUE; e.g. model_reasoning_effort="high" or features.multi_agent_v2.max_concurrent_threads_per_session=4.';
+const MODEL_OPTIONS = modelOptions();
+type ModelCliOptions = z.infer<typeof MODEL_OPTIONS>;
+const MATCHING_MODEL_OPTIONS = modelOptions(
+ "Model for finding matching (default: Codex's configured model).",
+ "Matching reasoning effort (default: medium).",
+);
const SKILL_CODEX_OVERRIDE_DESCRIPTION =
'Repeat TOML model="gpt-5.6-terra", model_reasoning_effort="high", model_provider="gateway", model_providers.<name>.<key>=VALUE, or analytics.enabled=false.';
+const SKILL_CONFIG_OPTIONS = MODEL_OPTIONS.extend({
+ codex: z
+ .array(optionValue("--codex"))
+ .default([])
+ .describe(SKILL_CODEX_OVERRIDE_DESCRIPTION),
+});
+type SkillConfiguration = z.infer<typeof SKILL_CONFIG_OPTIONS>;
+const CODEX_OVERRIDE_DESCRIPTION =
+ 'Repeat TOML KEY=VALUE; e.g. model_reasoning_effort="high" or features.multi_agent_v2.max_concurrent_threads_per_session=4.';
const PLUGIN_PATH_DESCRIPTION =
"Codex Security plugin directory or ZIP (default: bundled plugin).";
const PYTHON_PATH_DESCRIPTION =
@@ -962,15 +974,19 @@ class FindingProgressPresenter {
}
}
-function effortOption() {
- return z
- .enum(MODEL_REASONING_EFFORTS, {
- error: "--effort must be minimal, low, medium, high, xhigh, or max.",
- })
- .optional()
- .describe(
- `Model reasoning effort (default: ${DEFAULT_SCAN_MODEL_CONFIGURATION.reasoningEffort}).`,
- );
+function modelOptions(
+ modelDescription = `Model to use (default: ${DEFAULT_SCAN_MODEL_CONFIGURATION.model}).`,
+ effortDescription = `Model reasoning effort (default: ${DEFAULT_SCAN_MODEL_CONFIGURATION.reasoningEffort}).`,
+) {
+ return z.object({
+ model: optionValue("--model").optional().describe(modelDescription),
+ effort: z
+ .enum(MODEL_REASONING_EFFORTS, {
+ error: "--effort must be minimal, low, medium, high, xhigh, or max.",
+ })
+ .optional()
+ .describe(effortDescription),
+ });
}
type DeepCliOptionName = Extract<
@@ -1133,8 +1149,7 @@ interface PatchRiskRequest {
repository: string;
base: string;
files?: readonly string[];
- codexOverrides: readonly string[];
- effort: ScanReasoningEffort | undefined;
+ configuration: SkillConfiguration;
}
interface PatchRiskReport {
@@ -1912,8 +1927,10 @@ export async function main(
);
return result?.["scans"] as SavedScan[] | undefined;
};
+ type MatchingCliOptions = ModelCliOptions & { force?: boolean };
const runMatching = async (
operation: (options: ScanComparisonOptions) => Promise<JsonObject>,
+ selection: MatchingCliOptions,
): Promise<JsonObject> => {
const controller = new AbortController();
let firstSignalAt = 0;
@@ -1943,6 +1960,10 @@ export async function main(
let previousProgress = "";
try {
const result = await operation({
+ ...(selection.model === undefined ? {} : { model: selection.model }),
+ ...(selection.effort === undefined
+ ? {}
+ : { reasoningEffort: selection.effort }),
environment: dependencies.environment,
workingDirectory: dependencies.currentDirectory(),
signal: controller.signal,
@@ -1979,7 +2000,7 @@ export async function main(
const matchScanPair = async (
beforeId: string,
afterId: string,
- force = false,
+ selection: MatchingCliOptions,
): Promise<JsonObject> =>
runMatching(async (options) => {
const { matchingCached, matchingInputs, ...comparison } =
@@ -1995,7 +2016,7 @@ export async function main(
undefined,
options.signal,
);
- if (matchingCached && !force) return comparison;
+ if (matchingCached && !selection.force) return comparison;
const input = matchingInputs as JsonObject & ScanComparisonInput;
const matching = await dependencies.matchFindings(input, options);
options.signal?.throwIfAborted();
@@ -2011,7 +2032,7 @@ export async function main(
JSON.stringify(matching),
options.signal,
);
- });
+ }, selection);
const presentHistory = (
result: JsonObject | undefined,
command: HistoryCommand,
@@ -2497,20 +2518,23 @@ export async function main(
.boolean()
.default(false)
.describe("Recompute an existing semantic finding comparison."),
+ ...MATCHING_MODEL_OPTIONS.shape,
}),
output: z.record(z.string(), z.unknown()).optional(),
async run({ args, format, options }) {
if (options.all) {
return presentHistory(
- await runMatching((matchingOptions) =>
- matchAllScans(dependencies, options.force, matchingOptions),
+ await runMatching(
+ (matchingOptions) =>
+ matchAllScans(dependencies, options.force, matchingOptions),
+ options,
),
"match-all",
format,
);
}
return presentHistory(
- await matchScanPair(args.beforeId!, args.afterId!, options.force),
+ await matchScanPair(args.beforeId!, args.afterId!, options),
"compare",
format,
);
@@ -2532,8 +2556,9 @@ export async function main(
.optional()
.describe("Later saved scan identifier (default: latest completed)."),
}),
+ options: MATCHING_MODEL_OPTIONS,
output: z.record(z.string(), z.unknown()).optional(),
- async run({ args, format }) {
+ async run({ args, format, options }) {
let { beforeId, afterId } = args;
if (beforeId === undefined) {
const scans = await latestScans(2);
@@ -2545,7 +2570,7 @@ export async function main(
if (afterId === undefined) return;
}
return presentHistory(
- await matchScanPair(beforeId, afterId),
+ await matchScanPair(beforeId, afterId, options),
"compare",
format,
);
@@ -3353,12 +3378,7 @@ export async function main(
.describe(
"Select ChatGPT, OPENAI_API_KEY/CODEX_API_KEY, or automatic authentication.",
),
- model: optionValue("--model")
- .optional()
- .describe(
- `Model to use (default: ${DEFAULT_SCAN_MODEL_CONFIGURATION.model}).`,
- ),
- effort: effortOption(),
+ ...MODEL_OPTIONS.shape,
provider: PROVIDER_OPTION.describe(
"Inference provider for policy generation.",
),
@@ -3591,12 +3611,9 @@ export async function main(
"Scan mode (default: standard); deep supports repository and path targets.",
),
...DEEP_SCAN_OPTION_SCHEMAS,
- model: optionValue("--model")
- .optional()
- .describe(
- `OpenAI model to use (default: ${DEFAULT_SCAN_MODEL_CONFIGURATION.model}).`,
- ),
- effort: effortOption(),
+ ...modelOptions(
+ `OpenAI model to use (default: ${DEFAULT_SCAN_MODEL_CONFIGURATION.model}).`,
+ ).shape,
provider: PROVIDER_OPTION,
outputDir: optionValue("--output-dir")
.optional()
@@ -3881,14 +3898,10 @@ export async function main(
.describe(
"Local Git repository (default: current directory); analyzes committed HEAD.",
),
- model: optionValue("--model")
- .optional()
- .describe(
- "Model for owner suggestions (default: Codex Security model).",
- ),
- effort: effortOption().describe(
+ ...modelOptions(
+ "Model for owner suggestions (default: Codex Security model).",
"Reasoning effort (default: Codex Security effort).",
- ),
+ ).shape,
}),
output: z.record(z.string(), z.unknown()).optional(),
async run({ args, options }) {
@@ -3975,12 +3988,10 @@ export async function main(
.describe(
"Classify only this finding ID; repeat to select deduplicated findings.",
),
- model: optionValue("--model")
- .optional()
- .describe("Model for rubric classification."),
- effort: effortOption().describe(
+ ...modelOptions(
+ "Model for rubric classification.",
"Classification reasoning effort (default: medium).",
- ),
+ ).shape,
}),
output: z.record(z.string(), z.unknown()).optional(),
async run({ options }) {
@@ -4238,10 +4249,7 @@ export async function main(
postScanPromptFile: optionValue("--post-scan-prompt-file")
.optional()
.describe("Run FILE after each scan, including failures."),
- model: optionValue("--model")
- .optional()
- .describe("Model for planning and component scans."),
- effort: effortOption(),
+ ...modelOptions("Model for planning and component scans.").shape,
provider: PROVIDER_OPTION,
maxCost: z
.number()
@@ -4512,12 +4520,9 @@ export async function main(
postScanPromptFile: optionValue("--post-scan-prompt-file")
.optional()
.describe("Run FILE after each scan, including failures."),
- model: optionValue("--model")
- .optional()
- .describe(
- `OpenAI model for each repository (default: ${DEFAULT_SCAN_MODEL_CONFIGURATION.model}).`,
- ),
- effort: effortOption(),
+ ...modelOptions(
+ `OpenAI model for each repository (default: ${DEFAULT_SCAN_MODEL_CONFIGURATION.model}).`,
+ ).shape,
provider: PROVIDER_OPTION,
maxAttempts: z
.number()
@@ -4882,19 +4887,14 @@ export async function main(
.describe(
"Select ChatGPT, OPENAI_API_KEY/CODEX_API_KEY, or automatic authentication.",
),
- effort: effortOption(),
- codex: z
- .array(optionValue("--codex"))
- .default([])
- .describe(SKILL_CODEX_OVERRIDE_DESCRIPTION),
+ ...SKILL_CONFIG_OPTIONS.shape,
}),
async run({ options }) {
try {
exitCode = await runSkill(
"validation",
positionals,
- options.codex,
- options.effort,
+ options,
output,
errorOutput,
dependencies,
@@ -4925,7 +4925,7 @@ export async function main(
.describe(
"Select ChatGPT, OPENAI_API_KEY/CODEX_API_KEY, or automatic authentication.",
),
- effort: effortOption(),
+ ...MODEL_OPTIONS.shape,
scan: optionValue("--scan")
.optional()
.describe(
@@ -4946,10 +4946,7 @@ export async function main(
.optional()
.describe("JSON Linear issue filter for --linear-project."),
linearApiKey: linearApiKeyOption(),
- codex: z
- .array(optionValue("--codex"))
- .default([])
- .describe(SKILL_CODEX_OVERRIDE_DESCRIPTION),
+ codex: SKILL_CONFIG_OPTIONS.shape.codex,
}),
examples: [
{
@@ -5065,8 +5062,7 @@ export async function main(
exitCode = await runSkill(
"verify-fix",
selected === undefined ? [...positionals, ...imports] : [],
- options.codex,
- options.effort,
+ options,
verificationOutput,
errorOutput,
dependencies,
@@ -5160,7 +5156,7 @@ export async function main(
.describe(
"Select ChatGPT, OPENAI_API_KEY/CODEX_API_KEY, or automatic authentication.",
),
- effort: effortOption(),
+ ...MODEL_OPTIONS.shape,
externalSandbox: z
.boolean()
.default(false)
@@ -5199,10 +5195,7 @@ export async function main(
.describe(
"Resume publication of a saved patch branch without patching again.",
),
- codex: z
- .array(optionValue("--codex"))
- .default([])
- .describe(SKILL_CODEX_OVERRIDE_DESCRIPTION),
+ codex: SKILL_CONFIG_OPTIONS.shape.codex,
}),
examples: [
{
@@ -5240,6 +5233,7 @@ export async function main(
linear ||
options.linearFilter !== undefined ||
options.linearApiKey !== undefined ||
+ options.model !== undefined ||
options.effort !== undefined ||
options.auth !== "auto" ||
options.codex.length > 0
@@ -5307,8 +5301,7 @@ export async function main(
(await snapshotPatchState(selected.repository, dependencies));
const patches = await runFindingPatches(
selected,
- options.codex,
- options.effort,
+ options,
errorOutput,
dependencies,
{
@@ -5349,8 +5342,7 @@ export async function main(
repository: selected.repository,
base: patchRiskBase,
files,
- codexOverrides: options.codex,
- effort: options.effort,
+ configuration: options,
auth: options.auth,
},
errorOutput,
@@ -5434,8 +5426,7 @@ export async function main(
exitCode = await runSkill(
"fix-finding",
[...positionals, ...imports],
- options.codex,
- options.effort,
+ options,
{
write: (value) => {
report += value.toString();
@@ -5483,8 +5474,7 @@ export async function main(
environment,
base: patchGitBase!,
files,
- codexOverrides: options.codex,
- effort: options.effort,
+ configuration: options,
auth: options.auth,
},
errorOutput,
@@ -7250,8 +7240,7 @@ async function assessPatchRisk(
const status = await runSkill(
"assess-patch-risk",
[],
- request.codexOverrides,
- request.effort,
+ request.configuration,
stdout,
stderr,
dependencies,
@@ -7322,8 +7311,7 @@ async function resolvePatchValidationPrompt(
async function runFindingPatches(
selected: SelectedFindings,
- codexOverrides: readonly string[],
- effort: ScanReasoningEffort | undefined,
+ configuration: SkillConfiguration,
stderr: Writable,
dependencies: CliDependencies,
options: Omit<SkillRunOptions, "directory" | "findings"> = {},
@@ -7368,8 +7356,7 @@ async function runFindingPatches(
status = await runSkill(
"fix-finding",
[],
- codexOverrides,
- effort,
+ configuration,
stdout,
patchErrors,
dependencies,
@@ -7457,14 +7444,14 @@ async function runFindingPatches(
async function runSkill(
skill: "validation" | "fix-finding" | "verify-fix" | "assess-patch-risk",
inputs: readonly (string | ImportedIssue)[],
- codexOverrides: readonly string[],
- effort: ScanReasoningEffort | undefined,
+ configuration: SkillConfiguration,
stdout: Writable,
stderr: Writable,
dependencies: CliDependencies,
options: SkillRunOptions = {},
): Promise<number> {
- const overrides = parseCodexOverrides(codexOverrides, undefined, effort);
+ const { codex, model: selectedModel, effort } = configuration;
+ const overrides = parseCodexOverrides(codex, selectedModel, effort);
if (
Object.entries(overrides).some(
([key, value]) =>
@@ -7654,7 +7641,7 @@ async function runSkill(
`model=${JSON.stringify(model)}`,
"--config",
`model_reasoning_effort=${JSON.stringify(reasoningEffort)}`,
- ...codexOverrides
+ ...codex
.filter(
(value) =>
value.startsWith("analytics.") || value.startsWith("analytics="),
@@ -9035,13 +9022,15 @@ async function executeScan(
try {
patches = await runFindingPatches(
selected,
- [
- `model=${JSON.stringify(effectiveModel)}`,
- ...(patchAnalyticsOverride === undefined
- ? []
- : [patchAnalyticsOverride]),
- ],
- effectiveReasoningEffort as ScanReasoningEffort,
+ {
+ codex: [
+ `model=${JSON.stringify(effectiveModel)}`,
+ `model_reasoning_effort=${JSON.stringify(effectiveReasoningEffort)}`,
+ ...(patchAnalyticsOverride === undefined
+ ? []
+ : [patchAnalyticsOverride]),
+ ],
+ },
errorOutput,
dependencies,
{
@@ -9582,7 +9571,7 @@ function resolveCliScope(
export function parseCodexOverrides(
values: readonly string[],
model?: string,
- effort?: ScanReasoningEffort,
+ effort?: ModelCliOptions["effort"],
provider?: "openai" | "amazon-bedrock" | ExternalModelProvider,
defaults?: JsonObject,
): JsonObject {
diff --git a/sdk/typescript/src/cost-model.ts b/sdk/typescript/src/cost-model.ts
index 3d1f22eab..b54ca4601 100644
--- a/sdk/typescript/src/cost-model.ts
+++ b/sdk/typescript/src/cost-model.ts
@@ -53,7 +53,9 @@ const MODEL_PRICING_NANODOLLARS: Readonly<Record<string, ModelPricing>> = {
// GPT-5.5 has no additional cache-write charge.
"gpt-5.5": [5_000, 500, 5_000, 30_000],
"gpt-5.5-2026-04-23": [5_000, 500, 5_000, 30_000],
+ "gpt-6.1-sol": [2_000, 100, 2_500, 10_000],
"gpt-6-astra": [10_000, 1_000, 12_500, 50_000],
+ "gpt-6-luna": [100, 10, 125, 500],
"gpt-5.6": [4_000, 400, 5_000, 20_000],
"gpt-5.6-sol": [4_000, 400, 5_000, 20_000],
"gpt-5.6-terra": [2_000, 200, 2_500, 12_000],
@@ -72,7 +74,9 @@ const LONG_CONTEXT_PRICING_NANODOLLARS: Readonly<Record<string, ModelPricing>> =
{
"gpt-5.5": [10_000, 1_000, 10_000, 45_000],
"gpt-5.5-2026-04-23": [10_000, 1_000, 10_000, 45_000],
+ "gpt-6.1-sol": [4_000, 200, 5_000, 15_000],
"gpt-6-astra": [20_000, 2_000, 25_000, 75_000],
+ "gpt-6-luna": [200, 20, 250, 750],
"gpt-5.6": [8_000, 800, 10_000, 30_000],
"gpt-5.6-sol": [8_000, 800, 10_000, 30_000],
"gpt-5.6-terra": [4_000, 400, 5_000, 18_000],
@@ -196,7 +200,10 @@ export function estimateScanCost(
source: pricingModel.startsWith("gpt-5.5")
? "https://developers.openai.com/api/docs/models/gpt-5.5"
: "https://developers.openai.com/api/docs/pricing",
- asOf: "2026-09-14",
+ asOf:
+ pricingModel === "gpt-6.1-sol" || pricingModel === "gpt-6-luna"
+ ? "2026-09-30"
+ : "2026-09-14",
serviceTier: "standard",
context: "short",
usdPerMillionTokens: usdPerMillionTokens(pricing),
diff --git a/sdk/typescript/src/security-policy.ts b/sdk/typescript/src/security-policy.ts
index af17ba3fa..3aaff171e 100644
--- a/sdk/typescript/src/security-policy.ts
+++ b/sdk/typescript/src/security-policy.ts
@@ -23,6 +23,7 @@ import { promisify } from "node:util";
import { z } from "incur";
import type { ScanAuthentication, ScanOptions } from "./api.js";
import { jsonForPrompt } from "./codex-prompt.js";
+import type { ScanModelConfiguration } from "./config.js";
import type { ScanCost } from "./cost.js";
import { CodexSecurityError, InvalidTargetError } from "./errors.js";
import { resolvePluginPython, type ProcessEnvironment } from "./runtime.js";
@@ -115,11 +116,10 @@ export async function securityPolicyProtectedRoots(
return [...new Set([roots.at(-1) ?? target.repository, ...metadata.flat()])];
}
-export interface SecurityPolicyPreflight extends SecurityPolicyTarget {
+export interface SecurityPolicyPreflight
+ extends SecurityPolicyTarget, ScanModelConfiguration {
outputDir: string | null;
authentication: ScanAuthentication;
- model: string;
- reasoningEffort: string;
maxCostUsd?: number;
}
diff --git a/sdk/typescript/src/suggest-owners.ts b/sdk/typescript/src/suggest-owners.ts
index 3fdb2b79e..711c8ff32 100644
--- a/sdk/typescript/src/suggest-owners.ts
+++ b/sdk/typescript/src/suggest-owners.ts
@@ -6,7 +6,11 @@ import {
type OwnerEvidence,
type OwnerIdentity,
} from "./owner-evidence.js";
-import { mergedCodexConfig, scanModelConfiguration } from "./config.js";
+import {
+ mergedCodexConfig,
+ scanModelConfiguration,
+ type ScanModelConfiguration,
+} from "./config.js";
import { CodexSecurityError, safeErrorMessage } from "./errors.js";
import {
runReadOnlyCodex,
@@ -53,11 +57,9 @@ export interface OwnerSuggestion {
limitations: string[];
}
-export interface OwnerSuggestions {
+export interface OwnerSuggestions extends ScanModelConfiguration {
schemaVersion: 1;
revision: string;
- model: string;
- reasoningEffort: string;
results: OwnerSuggestion[];
}
diff --git a/sdk/typescript/tests-ts/api.test.ts b/sdk/typescript/tests-ts/api.test.ts
index 03ae0aad5..ceb37ccf7 100644
--- a/sdk/typescript/tests-ts/api.test.ts
+++ b/sdk/typescript/tests-ts/api.test.ts
@@ -999,6 +999,28 @@ describe("CodexSecurity orchestration", () => {
await expect(
client.preflight(repository, { maxCostUsd: 5 }),
).resolves.toMatchObject({ model: "gpt-5.6-sol", maxCostUsd: 5 });
+ for (const model of [
+ "gpt-6-astra",
+ "gpt-6.1-sol",
+ "gpt-6-luna",
+ "openai.gpt-6.1-sol",
+ "openai.gpt-6-luna",
+ ]) {
+ const configured = new TestClient(
+ { codexOverrides: { model } },
+ {
+ environment: {},
+ prepareRuntime: async () => {
+ runtimeStarted = true;
+ throw new Error("runtime should not initialize");
+ },
+ },
+ );
+ await expect(
+ configured.preflight(repository, { maxCostUsd: 5 }),
+ ).resolves.toMatchObject({ model, maxCostUsd: 5 });
+ await configured.close();
+ }
for (const maxCostUsd of [0, -1, Number.NaN, Number.POSITIVE_INFINITY]) {
await expect(
client.preflight(repository, { maxCostUsd }),
diff --git a/sdk/typescript/tests-ts/cli-patch.test.ts b/sdk/typescript/tests-ts/cli-patch.test.ts
index 1c5e52bc3..35af5b6a1 100644
--- a/sdk/typescript/tests-ts/cli-patch.test.ts
+++ b/sdk/typescript/tests-ts/cli-patch.test.ts
@@ -687,6 +687,10 @@ describe("scan and patch workflow", () => {
const outcome = await runWorkflow(
[
"patch",
+ "--model",
+ "gpt-6.1-sol",
+ "--effort",
+ "max",
"--auth",
"chatgpt",
"--scan",
@@ -698,6 +702,8 @@ describe("scan and patch workflow", () => {
result,
onWorkbench: () => savedScan(result),
onCodex: (args, output) => {
+ expect(args).toContain('model="gpt-6.1-sol"');
+ expect(args).toContain('model_reasoning_effort="max"');
expect(output?.auth).toBe("chatgpt");
completePatches(args, output);
return 0;
@@ -705,13 +711,13 @@ describe("scan and patch workflow", () => {
},
{
configure: (current) => {
- Object.assign(current, {
- assessPatchRisk: async (request: { auth?: string }) => {
- expect(request.auth).toBe("chatgpt");
- assessments += 1;
- return patchRiskAssessment();
- },
- });
+ current.assessPatchRisk = async (request) => {
+ expect(request.auth).toBe("chatgpt");
+ expect(request.configuration.model).toBe("gpt-6.1-sol");
+ expect(request.configuration.effort).toBe("max");
+ assessments += 1;
+ return patchRiskAssessment();
+ };
},
},
);
@@ -829,6 +835,10 @@ describe("scan and patch workflow", () => {
const outcome = await runWorkflow(
[
"patch",
+ "--model",
+ "gpt-6.1-sol",
+ "--effort",
+ "max",
"Synthetic issue",
"--assess-patch-risk",
"--codex",
@@ -841,6 +851,8 @@ describe("scan and patch workflow", () => {
{
currentDirectory: repository,
onCodex: async (args, output) => {
+ expect(args).toContain('model="gpt-6.1-sol"');
+ expect(args).toContain('model_reasoning_effort="max"');
expect(args).toContain("analytics.enabled=false");
expect(args).toContain('model_provider="synthetic.gateway"');
expect(output?.modelProvider).toBe("synthetic.gateway");
@@ -1308,6 +1320,8 @@ describe("scan and patch workflow", () => {
"api-key",
"--safety-identifier",
"synthetic-user",
+ "--codex",
+ 'model_reasoning_effort="ultra"',
"--json",
],
{
@@ -1322,6 +1336,7 @@ describe("scan and patch workflow", () => {
);
expect(attributed.exitCode).toBe(0);
expect(invocation).toContain('safety_identifier="synthetic-user"');
+ expect(invocation).toContain('model_reasoning_effort="ultra"');
for (const selection of [
["--provider", "fireworks"],
@@ -1703,6 +1718,7 @@ describe("scan and patch workflow", () => {
test("rejects new patch inputs when resuming publication", async () => {
for (const input of [
["--scan", "scan-1"],
+ ["--model", "gpt-6-astra"],
["--linear-issue", "SEC-123"],
["--create-pr"],
["--assess-patch-risk"],
diff --git a/sdk/typescript/tests-ts/cli-skills.test.ts b/sdk/typescript/tests-ts/cli-skills.test.ts
index e5f310837..ab68d17c7 100644
--- a/sdk/typescript/tests-ts/cli-skills.test.ts
+++ b/sdk/typescript/tests-ts/cli-skills.test.ts
@@ -140,6 +140,7 @@ describe("CLI skill commands", () => {
`Usage: codex-security ${command} ${command === "patch" ? `[${argument}]` : `<${argument}>`}`,
);
expect(help.text()).toContain("--effort <effort>");
+ expect(help.text()).toContain("--model <model>");
expect(help.text()).toContain("--codex <key=value>");
expect(help.text()).toContain('model="gpt-5.6-terra"');
expect(help.text()).toContain('model_reasoning_effort="high"');
@@ -843,9 +844,18 @@ describe("CLI skill commands", () => {
}
});
- test.each(["validate", "patch", "verify-fix"] as const)(
- "passes custom inference settings and authentication to %s",
- async (command) => {
+ test.each(
+ (["validate", "patch", "verify-fix"] as const).flatMap((command) => [
+ [command, ["--codex", 'model="synthetic-model"'], "xhigh"] as const,
+ [
+ command,
+ ["--model", "synthetic-model", "--effort", "high"],
+ "high",
+ ] as const,
+ ]),
+ )(
+ "passes custom inference settings and authentication to %s with %j (%s effort)",
+ async (command, selection, effort) => {
const providerConfiguration = {
name: "Synthetic gateway",
base_url: "https://gateway.example.test/v1",
@@ -853,7 +863,6 @@ describe("CLI skill commands", () => {
env_key: "SYNTHETIC_GATEWAY_KEY",
};
const overrides = [
- 'model="synthetic-model"',
'model_provider="synthetic"',
...Object.entries(providerConfiguration).map(
([key, value]) =>
@@ -867,6 +876,7 @@ describe("CLI skill commands", () => {
[
command,
"Synthetic finding",
+ ...selection,
...overrides.flatMap((override) => ["--codex", override]),
],
capture().stream,
@@ -902,6 +912,7 @@ describe("CLI skill commands", () => {
stderr.text(),
).toBe(0);
expect(invocation).toContain('model="synthetic-model"');
+ expect(invocation).toContain(`model_reasoning_effort="${effort}"`);
expect(invocation).toContain('model_provider="synthetic"');
expect(
parseToml(
@@ -999,36 +1010,50 @@ describe("CLI skill commands", () => {
},
);
- test("selects reasoning effort directly for validation and patching", async () => {
- for (const command of ["validate", "patch"] as const) {
- let invocation: readonly string[] = [];
- const stderr = capture();
-
- expect(
- await main(
- [
- command,
- "a candidate finding",
- "--effort",
- "max",
- "--codex",
- 'model="gpt-5.6-terra"',
- ],
- capture().stream,
- stderr.stream,
- dependencies({
- onCodex: (args) => {
- invocation = args;
- return 0;
- },
- }),
- ),
- ).toBe(0);
- expect(invocation).toContain('model="gpt-5.6-terra"');
- expect(invocation).toContain('model_reasoning_effort="max"');
- expect(stderr.text()).toBe(
- command === "patch" ? "Patch applied. Files changed: 1.\n" : "",
- );
+ test.each(["validate", "patch", "verify-fix"] as const)(
+ "selects the model and reasoning effort directly for %s",
+ async (command) => {
+ for (const model of ["gpt-6-astra", "gpt-6.1-sol"]) {
+ let invocation: readonly string[] = [];
+ const stderr = capture();
+ expect(
+ await main(
+ [
+ command,
+ "a candidate finding",
+ ...(model === "gpt-6-astra"
+ ? ["--model", model]
+ : [`--model=${model}`]),
+ "--effort",
+ "max",
+ ],
+ capture().stream,
+ stderr.stream,
+ dependencies({
+ onCodex: (args, output) => {
+ invocation = args;
+ if (command === "verify-fix") {
+ output?.stdout.write(
+ JSON.stringify({
+ results: [
+ {
+ id: "finding-1",
+ status: "fixed",
+ evidence: "The fix is present.",
+ },
+ ],
+ }),
+ );
+ }
+ return 0;
+ },
+ }),
+ ),
+ stderr.text(),
+ ).toBe(0);
+ expect(invocation).toContain(`model="${model}"`);
+ expect(invocation).toContain('model_reasoning_effort="max"');
+ }
for (const [options, message] of [
[
@@ -1039,10 +1064,15 @@ describe("CLI skill commands", () => {
["--effort", "high", "--codex", 'model_reasoning_effort="medium"'],
"--effort conflicts with --codex model_reasoning_effort",
],
+ [
+ ["--model", "gpt-6.1-sol", "--codex", 'model="gpt-6-astra"'],
+ "--model conflicts with --codex model",
+ ],
+ [["--model", " "], "model must be a nonempty string"],
+ [["--model"], "Missing value for flag: --model"],
] as const) {
let started = false;
const invalidStderr = capture();
-
expect(
await main(
[command, "a candidate finding", ...options],
@@ -1059,8 +1089,8 @@ describe("CLI skill commands", () => {
expect(invalidStderr.text()).toContain(message);
expect(started).toBe(false);
}
- }
- });
+ },
+ );
test("rejects empty and non-file skill inputs before launching Codex", async () => {
const directory = await mkdtemp(
diff --git a/sdk/typescript/tests-ts/cli-verify-fix.test.ts b/sdk/typescript/tests-ts/cli-verify-fix.test.ts
index 5cf40d545..061ffd0e6 100644
--- a/sdk/typescript/tests-ts/cli-verify-fix.test.ts
+++ b/sdk/typescript/tests-ts/cli-verify-fix.test.ts
@@ -326,7 +326,18 @@ describe("read-only finding verification", () => {
expect(
await main(
- ["verify-fix", "--scan", "scan-1", "--severity", "high", "--json"],
+ [
+ "verify-fix",
+ "--scan",
+ "scan-1",
+ "--severity",
+ "high",
+ "--model",
+ "gpt-6-astra",
+ "--effort",
+ "max",
+ "--json",
+ ],
stdout.stream,
capture().stream,
dependencies({
@@ -340,7 +351,9 @@ describe("read-only finding verification", () => {
},
};
},
- onCodex: (_args, output) => {
+ onCodex: (args, output) => {
+ expect(args).toContain('model="gpt-6-astra"');
+ expect(args).toContain('model_reasoning_effort="max"');
expect(output?.appServer?.directory).toBe("/saved/repository");
expect(output?.appServer?.sandbox).toBe("read-only");
const findings = JSON.parse(
diff --git a/sdk/typescript/tests-ts/cli-workbench.test.ts b/sdk/typescript/tests-ts/cli-workbench.test.ts
index b2c25f6ca..1a1b26e4d 100644
--- a/sdk/typescript/tests-ts/cli-workbench.test.ts
+++ b/sdk/typescript/tests-ts/cli-workbench.test.ts
@@ -191,7 +191,17 @@ describe("CLI workbench", () => {
{ scanId: "legacy" },
],
[
- ["scans", "compare", "before", "after", "--json"],
+ [
+ "scans",
+ "compare",
+ "before",
+ "after",
+ "--model",
+ "synthetic-model",
+ "--effort",
+ "high",
+ "--json",
+ ],
[
"compare-scans",
"--before-scan-id",
@@ -209,7 +219,17 @@ describe("CLI workbench", () => {
{ comparable: true, summary: { persisting: 1, resolved: 1 } },
],
[
- ["scans", "match", "before", "after", "--json"],
+ [
+ "scans",
+ "match",
+ "before",
+ "after",
+ "--model",
+ "synthetic-model",
+ "--effort",
+ "high",
+ "--json",
+ ],
[
"compare-scans",
"--before-scan-id",
@@ -479,6 +499,72 @@ describe("CLI workbench", () => {
}
});
+ test.each([
+ ["match", ["before", "after"]],
+ ["match", ["--all"]],
+ ["compare", ["before", "after"]],
+ ] as const)(
+ "forwards optional model settings for scans %s %j",
+ async (command, scanArgs) => {
+ for (const selection of [
+ [],
+ ["--model", "synthetic-model", "--effort", "high"],
+ ]) {
+ const selections: Array<{
+ model?: string;
+ reasoningEffort?: string;
+ }> = [];
+ const before = [{ occurrenceId: "before" }];
+ const after = [{ occurrenceId: "after" }];
+ expect(
+ await main(
+ ["scans", command, ...scanArgs, ...selection, "--json"],
+ capture().stream,
+ capture().stream,
+ dependencies({
+ onWorkbench: (args): JsonObject => {
+ if (args[0] === "compare-scans") {
+ return {
+ matchingCached: false,
+ matchingInputs: { before, after },
+ };
+ }
+ if (args[0] === "list-unmatched-scan-pairs") {
+ return {
+ repository: "/current/repository",
+ scanCount: 2,
+ unavailableScans: 0,
+ skippedPairs: 0,
+ batches: [
+ {
+ afterScanId: "after",
+ afterFindings: after,
+ beforeScans: [{ scanId: "before", findings: before }],
+ },
+ ],
+ };
+ }
+ return {};
+ },
+ onMatch: async (_input, options) => {
+ selections.push({
+ model: options?.model,
+ reasoningEffort: options?.reasoningEffort,
+ });
+ return { matches: [], uncertain: [] };
+ },
+ }),
+ ),
+ ).toBe(0);
+ expect(selections).toEqual([
+ selection.length === 0
+ ? { model: undefined, reasoningEffort: undefined }
+ : { model: "synthetic-model", reasoningEffort: "high" },
+ ]);
+ }
+ },
+ );
+
test("requires two completed scans for a default comparison", async () => {
const stderr = capture();
expect(
diff --git a/sdk/typescript/tests-ts/cli.test.ts b/sdk/typescript/tests-ts/cli.test.ts
index b04b831ef..795b657c2 100644
--- a/sdk/typescript/tests-ts/cli.test.ts
+++ b/sdk/typescript/tests-ts/cli.test.ts
@@ -2467,6 +2467,14 @@ describe("CLI", () => {
test("selects scan models and reasoning without TOML quoting", async () => {
for (const [options, expected] of [
[["--model", "gpt-5.6-terra"], { model: "gpt-5.6-terra" }],
+ [
+ ["--model", "gpt-6-astra", "--effort", "max"],
+ { model: "gpt-6-astra", model_reasoning_effort: "max" },
+ ],
+ [
+ ["--model=gpt-6.1-sol", "--effort=max"],
+ { model: "gpt-6.1-sol", model_reasoning_effort: "max" },
+ ],
[["--model=gpt-5.6-sol"], { model: "gpt-5.6-sol" }],
[["--effort", "minimal"], { model_reasoning_effort: "minimal" }],
[["--effort=xhigh"], { model_reasoning_effort: "xhigh" }],
diff --git a/sdk/typescript/tests-ts/cost-context.test.ts b/sdk/typescript/tests-ts/cost-context.test.ts
index dfdd69277..b198747cd 100644
--- a/sdk/typescript/tests-ts/cost-context.test.ts
+++ b/sdk/typescript/tests-ts/cost-context.test.ts
@@ -9,7 +9,9 @@ import {
test.each([
["gpt-5.5", [5, 0.5, 5, 30], [10, 1, 10, 45]],
["gpt-5.5-2026-04-23", [5, 0.5, 5, 30], [10, 1, 10, 45]],
+ ["gpt-6.1-sol", [2, 0.1, 2.5, 10], [4, 0.2, 5, 15]],
["gpt-6-astra", [10, 1, 12.5, 50], [20, 2, 25, 75]],
+ ["gpt-6-luna", [0.1, 0.01, 0.125, 0.5], [0.2, 0.02, 0.25, 0.75]],
["gpt-5.6", [4, 0.4, 5, 20], [8, 0.8, 10, 30]],
["gpt-5.6-sol", [4, 0.4, 5, 20], [8, 0.8, 10, 30]],
["gpt-5.6-terra", [2, 0.2, 2.5, 12], [4, 0.4, 5, 18]],
diff --git a/sdk/typescript/tests-ts/cost-model.property.test.ts b/sdk/typescript/tests-ts/cost-model.property.test.ts
index 8bc9ddecc..b9557aec2 100644
--- a/sdk/typescript/tests-ts/cost-model.property.test.ts
+++ b/sdk/typescript/tests-ts/cost-model.property.test.ts
@@ -6,7 +6,9 @@ import { propertyOptions } from "./support/property.js";
const rates = [
["gpt-5.5", 5000n, 500n, 5000n, 30000n],
["gpt-5.5-2026-04-23", 5000n, 500n, 5000n, 30000n],
+ ["gpt-6.1-sol", 2000n, 100n, 2500n, 10000n],
["gpt-6-astra", 10000n, 1000n, 12500n, 50000n],
+ ["gpt-6-luna", 100n, 10n, 125n, 500n],
["gpt-5.6", 4000n, 400n, 5000n, 20000n],
["gpt-5.6-sol", 4000n, 400n, 5000n, 20000n],
["gpt-5.6-terra", 2000n, 200n, 2500n, 12000n],