Skip to content

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

feat(ragfs): add plaintext fallback for encrypted-read migration path (#2712)

baojun-zhangcea96fb8cccf
diff --git a/crates/ragfs/src/core/encryption_wrapper.rs b/crates/ragfs/src/core/encryption_wrapper.rs
index 1705bc381..98841d663 100644
--- a/crates/ragfs/src/core/encryption_wrapper.rs
+++ b/crates/ragfs/src/core/encryption_wrapper.rs
@@ -165,11 +165,16 @@ impl FileSystem for EncryptionWrappedFS {
let plaintext = match self.decrypt_envelope(&account_id, &data) {
Ok(plaintext) => plaintext,
Err(err) => {
+ if !crypto::is_encrypted(&data) {
+ // ponytail: transitional plaintext fallback for backends that enabled
+ // encryption after plaintext files already existed; remove after migration.
+ return Ok(slice_bytes(data, offset, size));
+ }
warn!(
path = %path,
account_id = %account_id,
ciphertext_len = data.len(),
- encrypted_magic = crypto::is_encrypted(&data),
+ encrypted_magic = true,
error = %err,
"failed to decrypt encrypted RAGFS file"
);