Skip to content

armgit / codex

Public Imported from GitHub
0

Lightweight coding agent that runs in your terminal

Rust

w (#8)

Thibault Sottiaux1b40e19baf0b
diff --git a/codex-cli/src/utils/config.ts b/codex-cli/src/utils/config.ts
index 07f9b40af4..a98473b205 100644
--- a/codex-cli/src/utils/config.ts
+++ b/codex-cli/src/utils/config.ts
@@ -63,7 +63,7 @@ export type MemoryConfig = {
enabled: boolean;
};
-// Represents full runtime config, including loaded instructions
+// Represents full runtime config, including loaded instructions.
export type AppConfig = {
apiKey?: string;
model: string;
@@ -91,7 +91,7 @@ export function discoverProjectDocPath(startDir: string): string | null {
}
}
- // 2) Fallback: walk up to the Git root and look there
+ // 2) Fallback: walk up to the Git root and look there.
let dir = cwd;
// eslint-disable-next-line no-constant-condition
while (true) {
@@ -104,13 +104,13 @@ export function discoverProjectDocPath(startDir: string): string | null {
return candidate;
}
}
- // If Git root but no doc, stop looking
+ // If Git root but no doc, stop looking.
return null;
}
const parent = dirname(dir);
if (parent === dir) {
- // Reached filesystem root without finding Git
+ // Reached filesystem root without finding Git.
return null;
}
dir = parent;
@@ -157,7 +157,6 @@ export function loadProjectDoc(cwd: string, explicitPath?: string): string {
}
}
-// (Receives params for testing)
export type LoadConfigOptions = {
/** Working directory used for project doc discovery */
cwd?: string;
@@ -210,7 +209,7 @@ export const loadConfig = (
? readFileSync(instructionsFilePathResolved, "utf-8")
: DEFAULT_INSTRUCTIONS;
- // Project doc -----------------------------------------------------------
+ // Project doc support.
const shouldLoadProjectDoc =
!options.disableProjectDoc &&
process.env["CODEX_DISABLE_PROJECT_DOC"] !== "1";
diff --git a/codex-cli/src/utils/model-utils.ts b/codex-cli/src/utils/model-utils.ts
index 7dabd4fd34..07d924c05b 100644
--- a/codex-cli/src/utils/model-utils.ts
+++ b/codex-cli/src/utils/model-utils.ts
@@ -1,6 +1,7 @@
import { OPENAI_API_KEY } from "./config";
import OpenAI from "openai";
+const MODEL_LIST_TIMEOUT_MS = 2_000; // 2 seconds
export const RECOMMENDED_MODELS: Array<string> = ["o4-mini", "o3"];
/**
@@ -14,9 +15,9 @@ export const RECOMMENDED_MODELS: Array<string> = ["o4-mini", "o3"];
let modelsPromise: Promise<Array<string>> | null = null;
async function fetchModels(): Promise<Array<string>> {
- // If the user has not configured an API key we cannot hit the network
+ // If the user has not configured an API key we cannot hit the network.
if (!OPENAI_API_KEY) {
- return ["o4-mini"];
+ return RECOMMENDED_MODELS;
}
try {
@@ -67,8 +68,6 @@ export async function isModelSupportedForResponses(
return true;
}
- const MODEL_LIST_TIMEOUT_MS = 2_000;
-
try {
const models = await Promise.race<Array<string>>([
getAvailableModels(),