Self-evolving Context Database for AI Agents. Unify Agent Memory, Knowledge RAG and Skills.
Python agent-contextagent-memoryagent-pluginsagentic-ragcontext-databasedsh-pluginknowledge-basememorymemory-managementself-evolvingvector-database
fix(ragfs): return config error instead of panicking when pathlock manager is missing (#4083)
wutongyuonced88967aaeb96
diff --git a/crates/ragfs/src/core/mountable.rs b/crates/ragfs/src/core/mountable.rsindex ed1c66d1d..9f6bb7490 100644--- a/crates/ragfs/src/core/mountable.rs+++ b/crates/ragfs/src/core/mountable.rs@@ -449,7 +449,9 @@ impl MountableFS {.pathlock_manager.get().cloned()- .expect("pathlock manager must be initialized before multi-write mount");+ .ok_or_else(|| {+ Error::config("pathlock manager must be initialized before multi-write mount")+ })?;build_multi_write_fs(&self.registry,config,@@ -605,7 +607,9 @@ impl MountableFS {.pathlock_manager.get().cloned()- .expect("pathlock manager must be initialized before raw copy");+ .ok_or_else(|| {+ Error::config("pathlock manager must be initialized before raw copy")+ })?;let request = PathLockRequest {path: dst_path.to_string(),kind: PathLockKind::Exact,@@ -1665,11 +1669,12 @@ mod tests {use crate::cache::{CacheNamespace, CachePolicy, MemoryCacheProvider};use crate::plugins::MemFSPlugin;- let mfs = MountableFS::with_cache(+ let mfs = with_test_pathlock_manager(Arc::new(MountableFS::with_cache(Arc::new(MemoryCacheProvider::new()),CacheNamespace::new("copy-cache-test"),CachePolicy::default(),- );+ )))+ .await;mfs.register_plugin(MemFSPlugin).await;mfs.mount(test_config("memfs", "/local")).await.unwrap();mfs.mkdir("/local/dir", 0o755).await.unwrap();@@ -1846,11 +1851,12 @@ mod tests {use crate::core::{FsContextInner, FS_CTX};use crate::plugins::MemFSPlugin;- let mfs = MountableFS::with_cache(+ let mfs = with_test_pathlock_manager(Arc::new(MountableFS::with_cache(Arc::new(MemoryCacheProvider::new()),CacheNamespace::new("cached-multiwrite-test"),CachePolicy::default(),- );+ )))+ .await;mfs.register_plugin(MemFSPlugin).await;let mut config = multiwrite_test_config("memfs", "memfs", "/local");@@ -1888,6 +1894,21 @@ mod tests {assert!(mfs.list_mounts().await.is_empty());}+ #[tokio::test]+ async fn multiwrite_mount_without_pathlock_returns_config_error() {+ use crate::plugins::MemFSPlugin;++ let mfs = MountableFS::new();+ mfs.register_plugin(MemFSPlugin).await;++ let error = mfs+ .mount(multiwrite_test_config("memfs", "memfs", "/local"))+ .await+ .unwrap_err();++ assert!(matches!(error, Error::Config(_)));+ }+#[tokio::test]async fn test_mount_duplicate_error() {let mfs = Arc::new(MountableFS::new());