Description
Sync subagents (spawned via actor tool with action: "run") hang indefinitely when they trigger a permission ask. The permission prompt is never surfaced to the user because the subagent is treated as an interactive actor waiting for user confirmation, but no human is attached to reply.
Root Cause
In session/prompt.ts, the askNonInteractive check only marks actors as non-interactive if:
- They are in
SYSTEM_SPAWNED_AGENT_TYPES (checkpoint-writer, dream, distill), OR
- They have
background: true (only set for spawn action)
Sync subagents (run action) have background: false and are not in SYSTEM_SPAWNED_AGENT_TYPES, so they are treated as interactive. When they hit a permission ask, the system waits for a user reply that never comes.
Proposed Fix
All subagents should be marked as non-interactive because they have no attached human:
const askNonInteractive = askActor
? SYSTEM_SPAWNED_AGENT_TYPES.has(askActor.agent) || askActor.background || askActor.mode === "subagent"
: SYSTEM_SPAWNED_AGENT_TYPES.has(input.agent.name)
This ensures sync subagents fail clean with DeniedError instead of hanging forever.
Related Issues
MiMo Code Reference
This fix has been implemented in MiMo Code PR #1537: XiaomiMiMo/MiMo-Code#1537
Environment
- OpenCode version: 1.17.8
- OS: Windows 11
- Terminal: PowerShell
Steps to Reproduce
- Set bash permissions to "ask" for the build agent
- Spawn a sync subagent that runs a bash command
- The subagent hangs forever waiting for permission confirmation that never comes
Description
Sync subagents (spawned via
actortool withaction: "run") hang indefinitely when they trigger a permission ask. The permission prompt is never surfaced to the user because the subagent is treated as an interactive actor waiting for user confirmation, but no human is attached to reply.Root Cause
In
session/prompt.ts, theaskNonInteractivecheck only marks actors as non-interactive if:SYSTEM_SPAWNED_AGENT_TYPES(checkpoint-writer, dream, distill), ORbackground: true(only set forspawnaction)Sync subagents (
runaction) havebackground: falseand are not inSYSTEM_SPAWNED_AGENT_TYPES, so they are treated as interactive. When they hit a permission ask, the system waits for a user reply that never comes.Proposed Fix
All subagents should be marked as non-interactive because they have no attached human:
This ensures sync subagents fail clean with
DeniedErrorinstead of hanging forever.Related Issues
MiMo Code Reference
This fix has been implemented in MiMo Code PR #1537: XiaomiMiMo/MiMo-Code#1537
Environment
Steps to Reproduce