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): ignore path locks during shape probe (#2695)
Qin Haojie94c32da7a2e5
diff --git a/crates/ragfs/src/core/encryption_wrapper.rs b/crates/ragfs/src/core/encryption_wrapper.rsindex 18f02c44d..1705bc381 100644--- a/crates/ragfs/src/core/encryption_wrapper.rs+++ b/crates/ragfs/src/core/encryption_wrapper.rs@@ -12,6 +12,7 @@ use std::collections::HashMap;use std::sync::{Arc, RwLock};use async_trait::async_trait;+use tracing::warn;use crate::crypto;use crate::shape::SHAPE_MANIFEST_PATH;@@ -161,7 +162,20 @@ impl FileSystem for EncryptionWrappedFS {// the startup probe, so this layer always expects ciphertext.let data = self.inner.read(path, 0, 0).await?;let account_id = self.require_account_id()?;- let plaintext = self.decrypt_envelope(&account_id, &data)?;+ let plaintext = match self.decrypt_envelope(&account_id, &data) {+ Ok(plaintext) => plaintext,+ Err(err) => {+ warn!(+ path = %path,+ account_id = %account_id,+ ciphertext_len = data.len(),+ encrypted_magic = crypto::is_encrypted(&data),+ error = %err,+ "failed to decrypt encrypted RAGFS file"+ );+ return Err(err);+ }+ };Ok(slice_bytes(plaintext, offset, size))}diff --git a/crates/ragfs/src/shape/probe.rs b/crates/ragfs/src/shape/probe.rsindex ad8ac0f5e..4a098b39e 100644--- a/crates/ragfs/src/shape/probe.rs+++ b/crates/ragfs/src/shape/probe.rs@@ -9,6 +9,8 @@ use futures::stream::{self, StreamExt};use super::manifest::{StorageShape, SHAPE_MANIFEST_PATH};const SYSTEM_ACCOUNT_ID: &[u8] = b"_system";+const PATH_LOCK_FILE: &str = ".path.ovlock";+const EXACT_LOCK_FILE_PREFIX: &str = ".exact.ovlock.";fn normalize_shape_path(path: &str) -> String {let mut normalized = path.trim().to_string();@@ -32,6 +34,11 @@ fn is_persistent_task_record_path(path: &str) -> bool {false}+fn is_path_lock_record_path(path: &str) -> bool {+ let name = path.rsplit('/').next().unwrap_or("");+ name == PATH_LOCK_FILE || name.starts_with(EXACT_LOCK_FILE_PREFIX)+}+/// Read the raw guard-file bytes from the backend root.async fn read_shape_guard_raw(raw_fs: &Arc<dyn FileSystem>) -> Result<Option<Vec<u8>>> {match raw_fs.read(SHAPE_MANIFEST_PATH, 0, 0).await {@@ -121,7 +128,10 @@ pub async fn detect_legacy_shape(raw_fs: &Arc<dyn FileSystem>) -> Result<Option<}let normalized = normalize_shape_path(&entry.path);- if normalized == SHAPE_MANIFEST_PATH || is_persistent_task_record_path(&normalized) {+ if normalized == SHAPE_MANIFEST_PATH+ || is_persistent_task_record_path(&normalized)+ || is_path_lock_record_path(&normalized)+ {continue;}candidates.push(normalized);