Skip to content

fix: subagent permission asks hang indefinitely (sync subagents treated as interactive) #35073

Description

@Ivaloz

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:

  1. They are in SYSTEM_SPAWNED_AGENT_TYPES (checkpoint-writer, dream, distill), OR
  2. 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

  1. Set bash permissions to "ask" for the build agent
  2. Spawn a sync subagent that runs a bash command
  3. The subagent hangs forever waiting for permission confirmation that never comes

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions