You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Follow-up to #2516. With the Agent-only concurrency fix in place, the ACP Session path still executes Read / Search / Fetch / read-only shell calls sequentially, even though CoreToolScheduler has been parallelizing these since #2563 via CONCURRENCY_SAFE_KINDS + isShellCommandReadOnly.
Expected: when the model returns, say, 5 read_file calls or a mix of read_file / grep / web_fetch, ACP runs the contiguous safe batch concurrently (matching the React TUI path).
Why is this needed?
Multi-read turns are a very common model pattern (reading 4-5 files before proposing an edit). Under the current ACP path each read blocks the next, multiplying end-to-end latency by the batch size. The React TUI path has already solved this via coreToolScheduler.partitionToolCalls — ACP users are left paying the cost.
Agent tools were safe to add with a minimal patch because there's typically ≤ a few Agent calls per turn and no confirmation UI pressure.
Extending to read-only kinds hits a structural blocker: Session.runTool interleaves L1–L5 permission checks, client.requestPermission RPC, and invocation.execute() in a single method. Running five runTool calls concurrently would fire five parallel requestPermission RPCs at the editor simultaneously, which is a bad UX on Zed / VS Code companion.
coreToolScheduler sidesteps this by design: its state machine resolves all permissions first (calls move to scheduled), then attemptExecutionOfScheduledCalls partitions and runs.
What would you like to be added?
Follow-up to #2516. With the Agent-only concurrency fix in place, the ACP Session path still executes Read / Search / Fetch / read-only shell calls sequentially, even though
CoreToolSchedulerhas been parallelizing these since #2563 viaCONCURRENCY_SAFE_KINDS+isShellCommandReadOnly.Expected: when the model returns, say, 5
read_filecalls or a mix ofread_file/grep/web_fetch, ACP runs the contiguous safe batch concurrently (matching the React TUI path).Why is this needed?
Multi-read turns are a very common model pattern (reading 4-5 files before proposing an edit). Under the current ACP path each read blocks the next, multiplying end-to-end latency by the batch size. The React TUI path has already solved this via
coreToolScheduler.partitionToolCalls— ACP users are left paying the cost.Why it wasn't fixed as part of #2516
Agent tools were safe to add with a minimal patch because there's typically ≤ a few Agent calls per turn and no confirmation UI pressure.
Extending to read-only kinds hits a structural blocker:
Session.runToolinterleaves L1–L5 permission checks,client.requestPermissionRPC, andinvocation.execute()in a single method. Running fiverunToolcalls concurrently would fire five parallelrequestPermissionRPCs at the editor simultaneously, which is a bad UX on Zed / VS Code companion.coreToolSchedulersidesteps this by design: its state machine resolves all permissions first (calls move toscheduled), thenattemptExecutionOfScheduledCallspartitions and runs.Suggested approach
Two-phase refactor inside
Session.ts:Split
runTool(signal, promptId, fc)into#prepareToolCall(fc) → PreparedCall | CancelledCall(build → L1–L5 →requestPermission→ Pre/PostToolUseHook wiring)#executePreparedCall(prepared) → Part[](pureinvocation.execute()+ emit + result shaping)In
runToolCalls:#prepareToolCallfor each call (permission stays sequential to avoid parallelrequestPermissionRPCs).isConcurrencySafe+partitionToolCallsfromcoreToolScheduler(ideally exported from@qwen-code/qwen-code-core).Promise.all(respectingQWEN_CODE_MAX_TOOL_CONCURRENCY).Relevant files
packages/cli/src/acp-integration/session/Session.ts—runTool(L1125+),runToolCalls(L1091, added in ACP Session: Agent tool calls should run concurrently #2516 fix)packages/core/src/core/coreToolScheduler.ts:355—isConcurrencySafepackages/core/src/core/coreToolScheduler.ts:383—partitionToolCallspackages/core/src/tools/tools.ts:753—CONCURRENCY_SAFE_KINDSRelated
coreToolScheduler)