Skip to content

Task tool accepts parent session ID as task_id, causing silent deadlock #37506

Closed as not planned

Description

@RuLdaYu

Description

Description

The task tool does not validate whether the provided task_id references the caller's own session. When the current session's own ID is passed as task_id, the tool "succeeds" and spawns a subagent, but that subagent is actually a self-reference — creating a circular deadlock where the subagent waits for the parent and the parent waits for the subagent, resulting in an infinite hang.

Suggested Fixes

  1. Add a validation at the Task tool entry point: reject if task_id equals the current session ID
  2. Follow the approach from PR feat: nested sub-agent spawning (up to 5 levels) + fixes for #23091 / #13715 #32301 — restrict task_id resume to direct children only (matching parentID in the session tree)

Plugins

opencode-subagent-magazine@latest

OpenCode version

1.18.3

Steps to reproduce

Steps to Reproduce

  1. Obtain the current session's own ID (e.g. ses_xxxx...)
  2. Call the task tool with task_id set to the current session's ID
  3. Observe — the tool returns "success", but the subagent stays in "running" state indefinitely
  4. The subagent never completes and cannot be cancelled normally

Screenshot and/or share link

Share link

opencode share

Operating System

windows11

Terminal

powershell

Activity

  1. github-actions commented on Sep 17, 2026

    @github-actions
    Contributor

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

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