Skip to content

Background subagent task_status returns 'cancelled' but session data still accessible via task(task_id=) resume #27827

Closed

Description

@YoungJurry

Bug Description

When using task(background=true) to launch a background subagent, the task completes successfully and results are visible in the UI. However, when the parent agent polls for results using task_status(task_id="...", wait=true), it returns state: cancelled with empty error.

The session data is not lost — using task(task_id="...", prompt="...") to resume the session retrieves the full completed results.

Steps to Reproduce

  1. Set OPENCODE_EXPERIMENTAL_BACKGROUND_SUBAGENTS=true
  2. Launch background subagent: task(background=true, ...)
  3. The subagent completes its work (results visible in parent session context)
  4. Parent agent calls task_status(task_id="...", wait=true) to get results
  5. state: cancelled is returned, no result data

Expected Behavior

task_status(wait=true) should return state: completed with the full task result data, matching what is visible in the session UI.

Workaround

Instead of using task_status, use task(task_id="<same_id>", prompt="return your previous result") to resume the session and retrieve results. But this is clunky — the parent agent shouldn't need to know the prompt again.

Environment

  • OpenCode version: latest
  • Feature flag: OPENCODE_EXPERIMENTAL_BACKGROUND_SUBAGENTS=true
  • Plugin: @tarquinen/opencode-dcp@latest (DCP)

Activity

  1. YoungJurry commented on May 16, 2026

    @YoungJurry
    Author

    Closing and re-submitting as a new issue — the triage bot did not assign labels or staff. Re-submitted to ensure proper triage.

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

Metadata

Metadata

Assignees

No one assigned

    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