Agent Zero AI framework
Exclude Orchestrator runtime data from default backups
Alessandroa5feaec431a8
diff --git a/helpers/backup.py b/helpers/backup.pyindex f97ff67af..51b6abe38 100644--- a/helpers/backup.py+++ b/helpers/backup.py@@ -64,6 +64,7 @@ class BackupService:# All persistent user data is now centralized in /usr for easier backup and restore{agent_root}/usr/**!{agent_root}/usr/.time_travel/**+!{agent_root}/usr/plugins/_orchestrator/data/**"""def _get_agent_zero_version(self) -> str:diff --git a/helpers/backup.py.dox.md b/helpers/backup.py.dox.mdindex 5cb9c24ec..a20f68410 100644--- a/helpers/backup.py.dox.md+++ b/helpers/backup.py.dox.md@@ -26,7 +26,7 @@- Observed side-effect areas: filesystem reads, filesystem writes, filesystem deletion, settings/state persistence, secret handling.- Imported dependency areas include: `datetime`, `helpers`, `helpers.localization`, `helpers.print_style`, `json`, `os`, `pathspec`, `platform`, `tempfile`, `typing`, `zipfile`.- `test_patterns(..., max_files=None)` is the unlimited scan mode. UI preview and dry-run callers may pass bounded limits, but real backup creation and restore clean-before-restore must use unlimited matching so archives and cleanup are not silently truncated.-- Default backup metadata includes persistent `/usr` data but excludes Time Travel shadow history under `usr/.time_travel/**`.+- Default backup metadata includes persistent `/usr` data but excludes Time Travel shadow history under `usr/.time_travel/**` and Orchestrator state and credentials under `usr/plugins/_orchestrator/data/**`.- Restoring `usr/.env` preserves the destination instance's allowed origins while restoring authentication and other portable configuration from the archive.## Key Conceptsdiff --git a/tests/test_backup_large_archives.py b/tests/test_backup_large_archives.pyindex bd2223eb9..d5f964f88 100644--- a/tests/test_backup_large_archives.py+++ b/tests/test_backup_large_archives.py@@ -19,13 +19,17 @@ class UploadedBackup:@pytest.mark.asyncio-async def test_default_backup_patterns_exclude_time_travel_history(tmp_path):+async def test_default_backup_patterns_exclude_generated_history_and_orchestrator_data(tmp_path):root = tmp_path / "a0"usr = root / "usr"time_travel = usr / ".time_travel" / "workspaces" / "demo" / "repo.git"time_travel.mkdir(parents=True)+ orchestrator_data = usr / "plugins" / "_orchestrator" / "data" / "codex"+ orchestrator_data.mkdir(parents=True)(usr / "settings.json").write_text('{"ok": true}\n', encoding="utf-8")+ (orchestrator_data.parent.parent / "config.json").write_text("{}\n", encoding="utf-8")(time_travel / "objects.pack").write_text("history\n", encoding="utf-8")+ (orchestrator_data / "state.sqlite").write_text("state\n", encoding="utf-8")service = BackupService()service.agent_zero_root = str(root)@@ -36,8 +40,11 @@ async def test_default_backup_patterns_exclude_time_travel_history(tmp_path):paths = {item["real_path"] for item in files}assert str(usr / "settings.json") in paths+ assert str(orchestrator_data.parent.parent / "config.json") in pathsassert str(time_travel / "objects.pack") not in paths+ assert str(orchestrator_data / "state.sqlite") not in pathsassert f"{root}/usr/.time_travel/**" in metadata["exclude_patterns"]+ assert f"{root}/usr/plugins/_orchestrator/data/**" in metadata["exclude_patterns"]@pytest.mark.parametrize(