Skip to content

feat: Add list_tasks tool to query all background tasks #184

@randomm

Description

@randomm

Summary

Currently, we have task and check_task tools, but no way to list all running/pending tasks. We need a list_tasks tool to get an overview of all background tasks.

Current State

  • task tool - Spawn new agents (sync/async)
  • check_task tool - Check individual task status by ID
  • ❌ No way to list all tasks without knowing their IDs

Proposed Solution

Add a new list_tasks tool that exposes the existing internal listBackgroundTasks() function from packages/opencode/src/session/async-tasks.ts.

Use Cases

  • Track multiple concurrent tasks
  • Get overview of running/pending/completed tasks
  • Find task IDs without having saved them
  • Debug task scheduling issues

Implementation Notes

  • Internal function listBackgroundTasks() already exists
  • Returns { pending: string[], results: Record<string, BackgroundTaskResult> }
  • Need to add tool wrapper with proper parameters and documentation
  • Should filter to only show tasks accessible to the caller session

Acceptance Criteria

  • list_tasks tool created
  • Returns pending task IDs and completed results
  • Properly filtered by session ownership
  • Documentation added
  • Tests added
  • Fork-features manifest updated

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions