Skip to content

Session does not automatically return to parent after subagent execution #6491

Closed as not planned

Description

@mossbergmaverick

Description

When working with a subagent, the system correctly handles the transition to a child session (e.g., when permissions are required). However, once the child session's task is completed or permissions are granted, the focus remains in the child session.

Currently, the user has to switch back to the parent session manually every time, which creates significant friction and undermines the efficiency of using subagents.

Expected Behavior:
The session should automatically return to the parent context once the subagent's specific task or permission check is finished.

Actual Behavior:
The user stays stuck in the child session and must perform a manual switch to continue working in the parent session.

Additional Context:
This manual overhead defeats the purpose of a seamless subagent workflow. Ideally, the child session should be ephemeral or automatically yield back to the parent.

OpenCode version

1.0.218

Steps to reproduce

  1. Start a task in the parent session.
  2. Trigger an action that invokes a subagent (requiring a switch to a child session).
  3. Complete the required action/permission in the child session.
  4. Observe that the session remains in the "child" state instead of reverting.

Screenshot and/or share link

No response

Operating System

macOS Sonoma 15.7.3

Terminal

VSCode

Activity

  1. github-actions commented on Dec 31, 2025

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    Feel free to ignore if none of these address your specific case.

  2. rekram1-node commented on Dec 31, 2025

    @rekram1-node
    Contributor

    Yeah thats a good point, subagent ux is being thought about more rn

  3. diogosalazar commented on Dec 31, 2025

    @diogosalazar

    I suspect this behavior might be a regression, but in any case, it creates a few critical issues:

    1. Security Risks: When focus shifts to the subagent's session, the permission scope changes, potentially allowing that session to spawn nested sub-sessions.
    2. Navigation Lock: There is no way to return to the parent session while a permission prompt is active.
    3. Race Condition: If the user presses Esc to stop the subagent, the primary agent might try to resume or recreate the subagent faster than the user can switch back to the parent context.
  4. thdxr commented on Mar 25, 2026

    @thdxr
    Member

    To stay organized issues are automatically closed after 90 days of no activity. If the issue is still relevant please open a new one.

  5. removed
    bugSomething isn't working
    on May 3, 2026
  6. huornlmj commented on May 15, 2026

    @huornlmj

    Issue still present in version 1.14.50

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions