mirror of
https://github.com/openai/codex.git
synced 2026-11-13 14:46:14 +00:00
feat: config aliases (#18140)
Rename `no_memories_if_mcp_or_web_search` → `disable_on_external_context` with backward compatibility While doing so, we add a key alias system on our layer merging system. What we try to avoid is a case where a company managed config use an old name while the user has a new name in it's local config (which would make the deserialization fail)
This commit is contained in:
1 parent
af7b8d551c
commit
cfc23eee3d
14 files changed
+250
-34
No files matched your search
@@ -0,0 +1,34 @@
|
||||
use super::*;
|
||||
use pretty_assertions::assert_eq;
|
||||
|
||||
#[test]
|
||||
fn origins_use_canonical_key_aliases() {
|
||||
let layer = ConfigLayerEntry::new(
|
||||
ConfigLayerSource::SessionFlags,
|
||||
toml::from_str(
|
||||
r#"
|
||||
[memories]
|
||||
no_memories_if_mcp_or_web_search = true
|
||||
"#,
|
||||
)
|
||||
.expect("config TOML should parse"),
|
||||
);
|
||||
let metadata = layer.metadata();
|
||||
let stack = ConfigLayerStack::new(
|
||||
vec![layer],
|
||||
ConfigRequirements::default(),
|
||||
ConfigRequirementsToml::default(),
|
||||
)
|
||||
.expect("single layer stack should be valid");
|
||||
|
||||
let origins = stack.origins();
|
||||
|
||||
assert_eq!(
|
||||
origins.get("memories.disable_on_external_context"),
|
||||
Some(&metadata)
|
||||
);
|
||||
assert!(
|
||||
!origins.contains_key("memories.no_memories_if_mcp_or_web_search"),
|
||||
"legacy key should be canonicalized before origin recording"
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user