Skip to content
Merged
Show file tree
Hide file tree
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
7 changes: 5 additions & 2 deletions src/ucode/agents/codex.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
3 changes: 3 additions & 0 deletions tests/test_agent_codex.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand All @@ -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())


Expand Down
Loading