fix(tools,agent-context): replace sync fs with tokio in FileExecutor, dedup box_err#4524
Merged
Conversation
ee1ceae to
9f7655a
Compare
… dedup box_err Replace the 6 remaining sync std::fs call sites in FileExecutor that were missed in #4502: - handle_create_directory, handle_delete_path, handle_move_path, handle_copy_path: converted to tokio::fs equivalents (make async). - grep_recursive, copy_dir_recursive: wrapped in spawn_blocking since the recursive traversal loop cannot be trivially converted to async. - execute_file_tool dispatcher: added .await to all newly-async handlers. Extract a private box_err helper in memory_backend.rs and replace 12 identical map_err(|e| Box::new(e) as Box<dyn Error + Send + Sync>) closures with map_err(box_err); no behavior change. Closes #4507, #4511
9f7655a to
ff2ef53
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
std::fsblocking call sites inFileExecutorthat were missed in the partial fix (fix(tools,index): replace blocking std::fs with tokio::fs and wire embed_provider #4502). Simple handlers (handle_create_directory,handle_delete_path,handle_move_path,handle_copy_path) are converted totokio::fsequivalents. Recursive helpers (grep_recursive,copy_dir_recursive) are wrapped intokio::task::spawn_blockingsince the traversal loop cannot be trivially made async.box_errhelper inmemory_backend.rsand replace 12 identicalmap_err(|e| Box::new(e) as Box<dyn Error + Send + Sync>)closures — no behavior change.Test plan
cargo +nightly fmt --checkpassescargo clippy --workspace -- -D warnings— zero warningscargo nextest run --workspace --lib --bins— 10054 tests passed, 0 failedRUSTFLAGS="-D warnings" cargo check --workspace --all-targets --features desktop,ide,server,chat,pdf,scheduler --lockedpassesspawn_blockingclosures satisfy'static + Send;box_errbounds correct for all 12 call sitesCloses #4507, #4511