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(storage): fix empty chunk overwrite during multiwrite copy (#2652)
baojun-zhangccc059bdf887
diff --git a/crates/ragfs/src/core/multibackend_wrapper.rs b/crates/ragfs/src/core/multibackend_wrapper.rsindex 932d24fa8..dab454415 100644--- a/crates/ragfs/src/core/multibackend_wrapper.rs+++ b/crates/ragfs/src/core/multibackend_wrapper.rs@@ -307,6 +307,16 @@ async fn copy_file_state(while offset < size {let chunk_len = (size - offset).min(DEFAULT_COPY_CHUNK_SIZE as u64);let chunk = source.read(source_path, offset, chunk_len).await?;+ if chunk.is_empty() {+ if offset == 0 {+ if destination.exists(destination_path).await {+ destination.truncate(destination_path, 0).await?;+ } else {+ destination.create(destination_path).await?;+ }+ }+ break;+ }let flag = if offset == 0 {WriteFlag::Create} else {@@ -316,12 +326,6 @@ async fn copy_file_state(.write(destination_path, &chunk, offset, flag).await?;offset = offset.saturating_add(chunk.len() as u64);- if chunk.is_empty() {- return Err(Error::internal(format!(- "source returned empty chunk while copying '{}' -> '{}'",- source_path, destination_path- )));- }}Ok(())})