Repository navigation
Description
Follow-up to #1019 / #1080, split out as agreed in review.
What works now
#1080 routed sub-agent tool calls that need approval to session/request_permission. Those calls are announced as a tool_call before the request, prefixed subagent:, and titled with the sub-agent name.
What is still missing
Sub-agent tools that need no approval are never announced at all. signalToolApproval in source/subagents/subagent-executor.ts is only reached for calls that need approval; everything else runs without touching the ACP layer. So a client gets cards for the approval-gated subset of a sub-agent's work and no visibility into the rest. A read-heavy sub-agent can run a dozen tools and show nothing.
An approved call is marked completed at approval time, not when it runs. The handler in source/acp/acp-conversation.ts settles the card on approval because the sub-agent layer never reports results back. That was a deliberate trade against leaving the card spinning forever, but it means a client sees completed for a tool that may then fail, and never sees real output.
Both have the same root cause: SubagentExecutor does not thread its tool results out to the ACP conversation. Fixing that closes both at once - announce every sub-agent tool call, then update it with the real terminal status and output.
Also unresolved: mode and alwaysAllow are ignored inside sub-agents
needsApprovalForTool is passed only {mode: this.currentMode()}, and the ACP executor is constructed in source/plain/initialize.ts with the default parentMode: 'normal' and no mode resolver. A yolo or auto-accept session is therefore prompted inside a sub-agent for a tool it would not be prompted for at top level. Pre-existing, but #1080 is what made it visible. Noted in that changeset.
Also unresolved: overlapping sessions can cross-answer approvals
The approval slot in source/utils/tool-approval-queue.ts is a process-wide singleton with last-writer-wins semantics. runAcpConversation scopes its handler to the turn with a LIFO-correct disposer, which stops the handler outliving the turn, but turnActive is per session (source/acp/acp-session.ts), so two sessions can be mid-turn at once. For that overlap the later installer answers the earlier session's approvals against the wrong session id and abort controller, which the client rejects as invalid params.
Closing it needs the slot keyed by session id, or an approval channel threaded through SubagentExecutor - the same threading the two items above want, so it is probably one piece of work.
Activity
addyCooks commentedon Sep 1, 2026
Hey @will-lamerton
I'd like to take this one
I have a working fix locally that closes all four items in one change, since they do share the root cause you identified.
Approach: replace the process-wide approval slot (on the ACP path) with a session-keyed tool bridge a registry mapping a session id to a
{begin, end}channel.SubagentExecutorcallsbegin()for every tool call, not just approval-gated ones, and reports the real status and output viaend()— so read-heavy sub-agents are visible, and a card is never markedcompletedat approval time.runAcpConversationregisters its bridge undersession.sessionIdfor the turn, so overlapping sessions can't answer each other's approvals.session.developmentMode+nonInteractiveAlwaysAllowthe same authority the top-level loop uses. That closes themode/alwaysAllowgap without giving the shared executor a mode it can't correctly hold across sessions.subagent:<agentId>:<callId>, so a second run'scall_1can't upsert onto a finished card.The allow-list guard deliberately still runs ahead of the announcement, and the global-slot path is untouched when no bridge is registered, so the Ink UI is unaffected.
Testing: 25 new tests covering an approved-then-failing tool reporting
failed, a no-approval tool being announced and settled,yolo/alwaysAllownot prompting inside a sub-agent, and two turns overlapping inchat()each answering their own session. Typecheck, lint, format and knip clean.Could you assign this to me? Happy to open the PR right away.
fix(acp): route subagent tool calls through a per-session bridge (Nan…