diff --git a/src/ucode/agents/codex.py b/src/ucode/agents/codex.py index 26835cd57..e7badea30 100644 --- a/src/ucode/agents/codex.py +++ b/src/ucode/agents/codex.py @@ -401,13 +401,16 @@ def revert_legacy_shared_config() -> bool: through the workspace gateway. ``ucode revert`` only restored the per-profile file, leaving those edits in place. Surgically strip them here. - Also remove the shared app catalog reference and desktop trace exporter installed by modern - ucode. Returns True if anything was removed. + Also remove the shared app catalog reference, the per-launch model catalogs, and the desktop + trace exporter installed by modern ucode. Returns True if anything was removed from config. """ legacy_changed = _strip_legacy_ucode_entries(_legacy_config_path()) app_catalog_changed = detach_app_model_catalog() if app_catalog_changed and CODEX_MODEL_CATALOG_PATH.exists(): CODEX_MODEL_CATALOG_PATH.unlink() + # Launch-scoped catalogs from _model_catalog_path; only the reverted ug profile names them. + for path in CODEX_MODEL_CATALOG_PATH.parent.glob(f"{CODEX_MODEL_CATALOG_PATH.stem}-*.json"): + path.unlink(missing_ok=True) desktop_tracing_changed = _sync_desktop_tracing(None) return legacy_changed or app_catalog_changed or desktop_tracing_changed diff --git a/tests/test_agent_codex.py b/tests/test_agent_codex.py index b7386c510..2a6a29b6b 100644 --- a/tests/test_agent_codex.py +++ b/tests/test_agent_codex.py @@ -789,6 +789,8 @@ def test_strips_ucode_app_catalog_reference(self, capsys): shared_path.parent.mkdir() catalog_path = codex.CODEX_MODEL_CATALOG_PATH catalog_path.write_text("{}", encoding="utf-8") + launch_catalog = codex._model_catalog_path("https://example.com", "provider") + launch_catalog.write_text("{}", encoding="utf-8") shared_path.write_text( "model_catalog_json = " + json.dumps(str(catalog_path)) @@ -799,6 +801,7 @@ def test_strips_ucode_app_catalog_reference(self, capsys): assert read_toml_safe(shared_path) == {"personality": "friendly"} assert not catalog_path.exists() + assert not launch_catalog.exists() assert "codex app-server daemon restart" in " ".join(capsys.readouterr().err.split())