fix(tui): allow agent starts to join parallel dispatch batches (#3801)#3812
Conversation
|
Claude finished @Hmbown's task in 1m 44s —— View job Code Review
SummaryClean, well-scoped change. The Three things worth addressing: Finding 1 — Misleading doc comment on
|
Agent tool now reports starts_detached_for(action=start) = true, enabling independent agent launches to join parallel batches via the detached-start path in plan_tool_execution_batches. In auto-approved modes (YOLO), multiple agent calls in one model turn no longer serialize under the global tool-exec write lock — they dispatch concurrently up to configured concurrency limits. Also: - is_read_only_for returns true for status/peek (read-only queries) - supports_parallel_for returns true for status/peek - approval_requirement_for returns Auto for status/peek (no approval needed) Tests: agent_start_detached_plans_join_single_parallel_batch, agent_start_detached_plans_batch_with_readonly_tools. Closes #3801 (child of #3800).
9b90118 to
2d9fce9
Compare
|
Claude finished @Hmbown's task in 2m 51s —— View job Code Review
SummaryThe batch-planner hook design is clean and the Finding 1 —
|
Closes #3801 (child of #3800).
Problem
Multiple
agenttool calls in one parent turn were serialized as non-parallel tools because theagenttool spec did not overridesupports_parallel()(defaulting tofalse). In high fanout (e.g. 20 concurrent agent launches), launch latency scaled linearly — each agent resolved its model route under the global tool-execution write lock, making the TUI feel frozen.Change
Three input-aware overrides on
AgentTool'sToolSpecimpl:starts_detached_for(action=start) = true—action=startlaunches a background agent and returns immediately. This lets agent launches join parallel batches via thedetached_startpath inplan_tool_execution_batches(which requiresdetached_start && !approval_required && !interactive). In auto-approved modes (YOLO),approval_requiredis alreadyfalse, so the path fires.supports_parallel_for(status|peek) = trueandis_read_only_for(status|peek) = true— read-only queries of manager state can safely run in parallel batches.approval_requirement_for(status|peek) = Auto— status/peek are read-only queries that don't need user approval.Security / policy guardrails (per the issue)
action=startandaction=cancelstill returnApprovalRequirement::Required. In non-YOLO modes, each agent launch still prompts for approval and is thus serial (expected). The parallel path only fires whenauto_approve = true.agenttool opts in via its ownToolSpecimpl.Tests
agent_start_detached_plans_join_single_parallel_batch: 4 agent starts form 1 parallel batch, not 4 serial batches.agent_start_detached_plans_batch_with_readonly_tools: mixed grep + agent start + grep form 1 parallel batch.