Skip to content
Open
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
11 changes: 11 additions & 0 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -617,6 +617,17 @@ export function initConfig(directory: string): void {
];
const globalConfig = loadConfigFromPaths(CONFIG_FILES);
const projectConfig = loadConfigFromPaths(projectPaths);

// Guard: if neither global nor project config files were found (transient I/O
// failure, race condition, or missing files), do NOT rebuild the entire CONFIG
// from scratch. Calling buildConfig({}) with an empty object fills every field
// with hardcoded defaults — silently overwriting user-configured embedding
// dimensions, model, and API endpoint. The CONFIG singleton already carries
// the correct values from module-level initialization (line 593).
if (Object.keys(globalConfig).length === 0 && Object.keys(projectConfig).length === 0) {
return;
}

const merged = deepMerge(globalConfig, projectConfig);
Object.assign(CONFIG, buildConfig(merged));
}
Expand Down