fix(agent): separate preset snapshots from config reload

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Xubin Ren
2026-05-12 20:06:22 +08:00
committed by Xubin Ren
co-authored by Cursor
parent 8fcb24bb7c
commit e6103d9312
6 changed files with 53 additions and 22 deletions
+11
View File
@@ -110,6 +110,17 @@ def test_model_preset_accepts_explicit_default_name() -> None:
assert config.resolve_preset().model == "openai/gpt-4.1"
def test_model_presets_rejects_reserved_default_name() -> None:
import pytest
with pytest.raises(ValueError, match="model_preset name 'default' is reserved"):
Config.model_validate({
"modelPresets": {
"default": {"model": "custom-model"},
},
})
def test_resolve_preset_rejects_unknown_named_preset() -> None:
import pytest
with pytest.raises(KeyError, match="model_preset 'missing' not found"):