Skip to content

Self-evolving Context Database for AI Agents. Unify Agent Memory, Knowledge RAG and Skills.

reactor(ragfs): prevent recursive backup sync loop by moving default backup workspace and renaming config key (#2767)

baojun-zhange07464e327ee
diff --git a/docs/en/guides/13-multi-write-storage.md b/docs/en/guides/13-multi-write-storage.md
index c3f8c66ef..b0375432a 100644
--- a/docs/en/guides/13-multi-write-storage.md
+++ b/docs/en/guides/13-multi-write-storage.md
@@ -28,7 +28,7 @@ The following example uses a local directory as the primary backend and replicat
"name": "local-backup",
"backend": "local",
"local": {
- "local_dir": "./data/backup"
+ "workspace": "./data/backup"
}
}
]
@@ -43,6 +43,7 @@ Notes:
- The top-level `backend` is the primary backend.
- `backups.items[]` is the backup backend list.
- `name` is the stable identity of a backup; later sync metadata refers to it.
+- A backup with `backend = "local"` uses `local.workspace` to point to its local directory.
- If `sync_type` is omitted, treat it as async by default.
## Configuring Multiple Backups
@@ -62,7 +63,7 @@ You can configure more than one backup. The following example writes to both a l
"name": "local-az2",
"backend": "local",
"local": {
- "local_dir": "./data/local-az2"
+ "workspace": "./data/local-az2"
}
},
{
@@ -291,7 +292,7 @@ Example with global encryption enabled:
"name": "encrypted-backup",
"backend": "local",
"local": {
- "local_dir": "./data/encrypted-backup"
+ "workspace": "./data/encrypted-backup"
},
"encryption": {
"enabled": true
diff --git a/docs/zh/guides/13-multi-write-storage.md b/docs/zh/guides/13-multi-write-storage.md
index 934a543e6..32a6473f0 100644
--- a/docs/zh/guides/13-multi-write-storage.md
+++ b/docs/zh/guides/13-multi-write-storage.md
@@ -28,7 +28,7 @@
"name": "local-backup",
"backend": "local",
"local": {
- "local_dir": "./data/backup"
+ "workspace": "./data/backup"
}
}
]
@@ -43,6 +43,7 @@
- 顶层 `backend` 是 primary。
- `backups.items[]` 是 backup 列表。
- `name` 是 backup 的稳定身份,后续同步元数据会引用它。
+- `backend = "local"` 的 backup 使用 `local.workspace` 指定本地目录。
- `sync_type` 不配置时默认按异步模式理解。
## 多 Backup 配置
@@ -62,7 +63,7 @@
"name": "local-az2",
"backend": "local",
"local": {
- "local_dir": "./data/local-az2"
+ "workspace": "./data/local-az2"
}
},
{
@@ -291,7 +292,7 @@ Exclude 用于让某个 backup 跳过匹配文件。
"name": "encrypted-backup",
"backend": "local",
"local": {
- "local_dir": "./data/encrypted-backup"
+ "workspace": "./data/encrypted-backup"
},
"encryption": {
"enabled": true
diff --git a/openviking/utils/agfs_utils.py b/openviking/utils/agfs_utils.py
index b946af57e..0495f8961 100644
--- a/openviking/utils/agfs_utils.py
+++ b/openviking/utils/agfs_utils.py
@@ -331,12 +331,12 @@ def _serialize_s3_backup_params(
def _serialize_local_backup_params(
item: Any, backend_config: Any, data_path: Path
) -> Dict[str, Any]:
- """Serialize one local backup item and fill the default workspace local_dir."""
+ """Serialize one local backup item and map workspace to the localfs local_dir param."""
local_dir = (
- _get_config_value(backend_config, "local_dir") if backend_config is not None else None
+ _get_config_value(backend_config, "workspace") if backend_config is not None else None
)
if local_dir is None:
- local_dir = data_path / "viking" / "_backups" / _get_config_value(item, "name")
+ local_dir = data_path / "_backups" / _get_config_value(item, "name")
local_dir_path = Path(local_dir).expanduser()
return {"local_dir": str(local_dir_path)}
diff --git a/tests/misc/test_config_validation.py b/tests/misc/test_config_validation.py
index 8a50aa935..6b819798c 100644
--- a/tests/misc/test_config_validation.py
+++ b/tests/misc/test_config_validation.py
@@ -432,7 +432,7 @@ def test_generate_plugin_config_materializes_multiwrite_backups(tmp_path):
{
"name": "local-explicit",
"backend": "local",
- "local": {"local_dir": str(explicit_backup_dir)},
+ "local": {"workspace": str(explicit_backup_dir)},
},
{
"name": "local-default",
@@ -469,9 +469,7 @@ def test_generate_plugin_config_materializes_multiwrite_backups(tmp_path):
assert not explicit_backup_dir.exists()
assert default_local["backend"] == "localfs"
- assert default_local["params"]["local_dir"] == str(
- tmp_path / "viking" / "_backups" / "local-default"
- )
+ assert default_local["params"]["local_dir"] == str(tmp_path / "_backups" / "local-default")
assert s3_backup["backend"] == "s3fs"
assert s3_backup["params"] == {