mirror of
https://github.com/openai/codex.git
synced 2026-11-20 23:08:21 +00:00
Embed defaults in the packaged config layer (#38179)
## What changed - Add an embedded `defaults.toml` and always install it as the lowest-precedence configuration layer when no packaged-defaults path is supplied. - Keep packaged defaults out of config RPC layer and origin metadata. - Report a user setting as overridden only when the effective layer has higher precedence, so clearing a setting can fall back to its packaged default without a false override. ## Testing - Cover loading the packaged layer when other configuration files are absent. - Cover config RPC filtering and clearing a user value that falls back to a packaged default. GitOrigin-RevId: c1c0e1e681e4ac1be2602550972533443c5df51b
This commit is contained in:
1 parent
8270a7c74d
commit
0e82c62a44
7 files changed
+87
-26
No files matched your search
@@ -159,12 +159,25 @@ pub async fn load_config_layers_state(
|
||||
),
|
||||
)
|
||||
})?;
|
||||
Some(ConfigLayerEntry::new(
|
||||
ConfigLayerEntry::new(
|
||||
ConfigLayerSource::PackagedDefaults { file: file.clone() },
|
||||
resolve_relative_paths_in_config_toml(config, base_dir)?,
|
||||
))
|
||||
)
|
||||
} else {
|
||||
None
|
||||
let file = AbsolutePathBuf::from_absolute_path(std::env::current_exe()?)?;
|
||||
let raw_toml = include_str!("../../defaults.toml");
|
||||
let config = toml::from_str(raw_toml).map_err(|error| {
|
||||
io::Error::new(
|
||||
io::ErrorKind::InvalidData,
|
||||
format!("invalid embedded packaged defaults; this is a Codex build error: {error}"),
|
||||
)
|
||||
})?;
|
||||
ConfigLayerEntry::new_with_raw_toml(
|
||||
ConfigLayerSource::PackagedDefaults { file },
|
||||
config,
|
||||
raw_toml.to_owned(),
|
||||
AbsolutePathBuf::from_absolute_path(codex_home)?,
|
||||
)
|
||||
};
|
||||
let active_user_profile = overrides.user_config_profile.clone();
|
||||
let ignore_managed_requirements = overrides.ignore_managed_requirements;
|
||||
@@ -250,7 +263,7 @@ pub async fn load_config_layers_state(
|
||||
.map_err(io::Error::other)?;
|
||||
|
||||
let mut layers = Vec::<ConfigLayerEntry>::new();
|
||||
layers.extend(packaged_defaults_layer);
|
||||
layers.push(packaged_defaults_layer);
|
||||
|
||||
let cli_overrides_layer = if cli_overrides.is_empty() {
|
||||
None
|
||||
|
||||
Reference in new issue
Block a user