Skip to content

[FEATURE]: Add configurable timeout parameter to the Task tool #15080

Closed as not planned

Description

@jdocker8

Feature hasn't been suggested before.

  • I have verified this feature I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

The Task tool (used to dispatch subagents like explore and general) has no timeout parameter. Subagents can hang for 5–15+ minutes on tasks that should complete in 15–30 seconds, blocking the entire conversation with no way for the caller to recover programmatically.

The Bash tool already supports an optional timeout parameter (in milliseconds). The Task tool should have the same capability.

Proposed changes:

  1. Add an optional timeout parameter to the Task tool schema (milliseconds, consistent with Bash tool).
  2. Set a reasonable default timeout (e.g., 120,000 ms / 2 minutes) when none is specified.
  3. On timeout, return a structured timeout error so the calling agent can fall back — retry with a smaller scope, do the work directly, or inform the user.

Why this matters:

  • There is currently no workaround. The caller agent waits indefinitely and the user must manually abort.
  • Codebases with AI rules (e.g., "set explicit timeout per request," "never wait indefinitely") cannot enforce those rules on Task tool calls because the parameter doesn't exist.
  • This is distinct from the async/non-blocking dispatch request in Feature Request: Async Task Management - Non-blocking Subagent Dispatch #15069. That issue proposes a fundamentally different execution model. This request is narrower: just add a timeout so synchronous Task calls don't hang forever.

Note: Supersedes #15072, which was not created using the required feature request template.

Activity

  1. added
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on Feb 25, 2026
  2. github-actions commented on Feb 25, 2026

    @github-actions
    Contributor

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

  3. jdocker8 commented on Mar 25, 2026

    @jdocker8
    Author

    Between this issue and the repeated summaries issue I opened #13838 there's a significant amount of time lost. I suggest tickets like these be given a higher priority since having issues like these so drastically reduce the usability and productivity with opencode. The difference between opencode and Codex (not the model but the cli/gui) in speed of completing work is drastically in Codex favor.

  4. assigned and unassigned on Apr 26, 2026
  5. georgeglarson commented on Apr 30, 2026

    @georgeglarson
    Contributor

    Want to take this. Deterministic repro across providers; PR shortly.

    Repro: parallel opencode run against ~10 models, same prompt. 8 return in 36s–7min; mimo/mimo-v2.5-pro and minimax/MiniMax-M2.7 spawn the Explore Agent subagent and never return. Pre-inlining the files referenced in the prompt (so the model has no reason to invoke Explore Agent) makes both complete in <5min. The hang is on the subagent → parent return path, not the model.

    This matches the broader pattern across #24669, #23296, #13841, #21250, #22252, #18378, #23891 — all converge on the same root: tool/task.ts awaits ops.prompt(...) with no timeout, so any stall in the subagent path hangs the parent indefinitely.

    Approach (mirroring bash.ts):

    • Optional timeout: number (ms) on the Task Parameters schema.
    • OPENCODE_EXPERIMENTAL_TASK_DEFAULT_TIMEOUT_MS flag, default ~10 min.
    • Race ops.prompt(...) against Effect.sleep(timeout). On timeout: ops.cancel(nextSession.id) and return a <task_error> block with the task_id so the caller can retry with a larger timeout, narrow the scope, or fall back.

    Please assign if no objections.

  6. removed
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on May 3, 2026
  7. r-arteaga commented on May 16, 2026

    @r-arteaga

    same issue here with an android kotlin project. 90% of the times build process completes and shows BUILD SUCCESSFUL in the logs but still sub agent hangs.

  8. r-arteaga commented on Jun 20, 2026

    @r-arteaga

    same issue here with an android kotlin project. 90% of the times build process completes and shows BUILD SUCCESSFUL in the logs but still sub agent hangs.

    Quoting myself with a workaround

    In agents.md I added an instruction to build using gradlew with --no-daemon flag.

  9. github-actions commented on Aug 20, 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.

  10. added a commit that references this issue on Oct 4, 2026
    676e030
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