Skip to content

V2: subagent: no session resume / no session_id exposed #36654

Closed

Description

@dmmop

Summary

The subagent tool launches one-shot child sessions with a fresh context and exposes no session identifier or resume API. There is no way to continue a conversation with the same subagent across multiple turns, forcing users to re-spawn a new agent (losing prior context) for every follow-up request.

Environment

  • opencode version: 1.17.18
  • OS: Linux 7.0.0-27-generic codex-mini, openai responses api #27-Ubuntu SMP PREEMPT_DYNAMIC x86_64 GNU/Linux
  • Terminal: TERM_PROGRAM=ghostty, TERM=xterm-256color, COLORTERM=truecolor
  • Shell: /usr/bin/zsh
  • Install/channel: Unavailable: not captured
  • Active plugins: omitted by request

Reproduction

  1. Invoke the subagent tool with any agent and a prompt (e.g. "say hola").
  2. Observe the child session runs with fresh context and returns its final response.
  3. Attempt to continue the conversation with the same subagent (e.g. "now say adios").
  4. The tool provides no session_id, resume method, or message injection; a new isolated subagent must be spawned instead.

Expected Behavior

The subagent tool should expose a session_id (or similar) and a resume/inject mechanism so an existing child session can be continued, preserving context across turns.

Actual Behavior

Each subagent call is isolated and ephemeral. Parameters are limited to agent, description, prompt, and background. No session handle is returned and no resume API exists, so multi-turn interaction with the same subagent is impossible.

Additional Context

  • Confirmed by inspecting the available tool surface: subagent returns only the child's final response (foreground) or launch confirmation (background).
  • Workaround: maintain an external long-lived agent process with its own message loop to retain state across turns.

Activity

  1. github-actions commented on Jul 13, 2026

    @github-actions
    Contributor

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

  2. magoz commented on Jul 19, 2026

    @magoz

    Reproduced on opencode2 v0.0.0-next-15834 (next channel, Darwin arm64).

    One correction/clarification: the V2 backend does support resuming and steering child
    sessions. The missing surface is the model-facing subagent tool.

    Current subagent tool parameters are only:

    • agent
    • description
    • prompt
    • background

    A background launch returns a child session ID, but the tool exposes no operation for reading,
    messaging, steering, or resuming that child.

    I validated the API workaround with a disposable child session:

    1. GET /api/session/{sessionID} showed the expected child parentID.
    2. GET /api/session/{sessionID}/message exposed its conversation.
    3. After the child completed, POST /api/session/{sessionID}/prompt with
      {"text":"...","resume":true,"delivery":"queue"} resumed it and produced a second response.
    4. While it was active, another prompt with delivery:"steer" was incorporated into the same
      turn.
    5. POST /api/session/{sessionID}/wait waited until the resumed child became idle.

    So the backend capability already exists. The remaining issue is tool exposure/discoverability:
    agents commonly conclude that follow-up is impossible unless explicitly told to inspect and use
    the local API through shell.

    Suggested resolution: expose child session operations directly through subagent (or another
    model-facing tool), including read/message/resume/steer. At minimum, advertise the supported API
    fallback to orchestrating agents.

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