Repository navigation
[#331] Batch read-only tool calls in a turn - #334
Draft
Youssef-joe wants to merge 2 commits into
Draft
Youssef-joe wants to merge 2 commits into
Youssef-joe wants to merge 2 commits into
Conversation
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.
Why
A turn that asks for several files is common, but today only subagent starts overlap: every other call runs one after another. This makes read-heavy turns needlessly slow. Follow-on to #331.
What changed
ToolExecutor::parallel_safe()— a conservative, name-level allowlist of read-only tools:show_file,list_directory,search_text,expand_context,fetch_url,web_search,use_skill.ToolExecutor::lists_agents()—run_agentwithagent: "list"is a local registry search, not a subagent start, so it counts as read-only.starts_subagent()keeps real starts in the subagent batch.ToolExecutor::has_agent_hooks()— read batching is disabled when hooks are installed, because hooks can observe call order.BatchKind+parallel_run()insrc/session.rsreplace the inlineruns_subagentscan.continue_agentcalls for the same task never share a batch; different tasks may.doc/manual/en/30-tools.mdconcurrency wording updated.Safety
Deliberately excluded: file writers,
run_shell_command(can do anything),browse(stateful page-link numbers),graph_*/semantic_search(may build or refresh caches), and MCP tools (approval policy, unknown side effects). Results are still written back in the order the model asked for them.Tests
Four new unit tests in
src/session.rs:read_only_calls_overlap_but_writes_do_nota_read_and_a_subagent_do_not_overlapcontinuations_of_one_task_stay_in_orderlisting_agents_is_read_only_but_starting_one_is_notVerification:
Notes
AUTHORSas required for a first contribution.