Skip to content

[opencode2] subagent: required sessionID prevents spawning first child session #43619

Closed as not planned

Description

@amirrezasalimi

Summary

The subagent tool cannot spawn an initial child session because its documentation says to omit sessionID for a new session, while the exposed tool schema requires sessionID. This blocks all coding delegation workflows that need to create their first child agent.

Environment

  • opencode version: opencode2 v0.0.0-beta-17728
  • OS: Darwin 25.5.0 arm64
  • Terminal: TERM=xterm-256color, COLORTERM=truecolor, TERM_PROGRAM unset
  • Shell: /bin/zsh
  • Install/channel: beta
  • Active plugins: None found in workspace or user config

Reproduction

  1. Start a task that requires delegating work to a subagent.
  2. Attempt to invoke subagent without sessionID, as directed by the tool documentation: “Calls without a sessionID start a new conversation.”
  3. Observe that the exposed schema defines sessionID as a required string, so a valid new-child invocation cannot be constructed.
  4. As a workaround attempt, pass the current conversation session ID.
  5. Observe the error: Session <redacted> is not a child of the current session.

Expected Behavior

sessionID should be optional. Omitting it should create a fresh child session and return its new session ID. Supplying an existing child session ID should continue that session.

Actual Behavior

The tool schema requires sessionID, contradicting the documented new-session behavior. Passing the parent session ID fails because it is not a child:

Session <redacted> is not a child of the current session

An empty invocation also terminates with:

Tool execution interrupted

As a result, the first child session cannot be created and coding delegation is blocked.

Additional Context

  • The issue occurred while trying to delegate a coding task to pro-coder.
  • Both the tool description and orchestration instructions expect calls without a session ID to start a new child.
  • No active OpenCode plugins were found, so this does not appear plugin-related.
  • GitHub CLI is installed and authenticated.
  • Secrets and project-specific details have been omitted.

Activity

  1. changed the title [-]subagent: required sessionID prevents spawning first child session[/-] [+][opencode2] subagent: required sessionID prevents spawning first child session[/+] on Aug 20, 2026
  2. neriousy commented on Aug 20, 2026

    @neriousy
    Member

    What model are you using? It seems your agent is trying to add a fabricated session ID to the sessionid field

  3. amirrezasalimi commented on Aug 20, 2026

    @amirrezasalimi
    Author

    What model are you using? It seems your agent is trying to add a fabricated session ID to the sessionid field

    I used gpt-sol and sonnet-5

    I think it's a new version bug, it wasn't like this before last update

  4. neriousy commented on Aug 20, 2026

    @neriousy
    Member

    any plugins / additional wrappers etc?

  5. amirrezasalimi commented on Aug 20, 2026

    @amirrezasalimi
    Author
    Image nope, can it be because of sub agent model or it's about orchestrator?
  6. neriousy commented on Aug 20, 2026

    @neriousy
    Member

    I think it's highly likely it's due to the orchestrator stuff

  7. amirrezasalimi commented on Aug 20, 2026

    @amirrezasalimi
    Author

    I think it's highly likely it's due to the orchestrator stuff

    is there a way so i can share full log of session?

  8. amirrezasalimi commented on Aug 20, 2026

    @amirrezasalimi
    Author
    Image
  9. neriousy commented on Aug 20, 2026

    @neriousy
    Member

    Have you tried with another provider than 9router I believe its because of that

  10. amirrezasalimi commented on Aug 20, 2026

    @amirrezasalimi
    Author

    You right, I got this new issue when i changed my vpn/proxy to windscribe, so it's ok now when i switch back to my v2ray.( I know it's weird )
    sorry for taking your time!
    Thanks

  11. BlacKSnowDot0 commented on Aug 25, 2026

    @BlacKSnowDot0

    i've added this to .config/opencode/AGENTS.md

    # Global agent instructions
    
    ## Subagent tool — critical
    
    - When spawning a NEW subagent with the `subagent` tool, **omit `sessionID` entirely**. It is optional.
    - NEVER set `sessionID` to the current session's own ID, and never invent values like `ses_new`. Both fail with `Session ... is not a child of the current session` / `Subagent session not found`.
    - Only pass `sessionID` when resuming a previous subagent, using the exact ID that appeared in an earlier `subagent` tool result (`<subagent sessionID="..." ...>`).
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions