Skip to content

[Bug] Esc abort of task tool still loses task_id on v1.18.21 — v1.18.20 fix incomplete #44791

Closed as not planned

Description

@mahan-fk

Description

After the fix in v1.18.20 ("Surface failed subagent tool calls with a resumable task_id"), cancelling a task sub-agent with Esc still returns only Task cancelled / Tool execution aborted with no task_id. The child session is preserved in DB but parent has no handle to resume.

Repro on 1.18.21 (includes v1.18.20):

  1. Primary dispatches sub-agent via task tool (e.g. "Write 200 line story, numbered 1..200")
  2. Wait ~15s (well past session creation, TUI shows sub-agent running)
  3. Press Esc once (TUI shows "esc again to interrupt")
  4. Parent receives generic Task cancelled — no task_id: ses_... line
  5. Child session DOES exist in DB with MessageAbortedError: Aborted (verified via opencode db "select id from session order by time_created desc"), e.g. ses_fca2e2e1fffew5cAkpmn6IgDgJ and ses_fca376712ffe8yo4PsY76GyGSW — but LLM cannot reference it.

Expected (per #13910):
task_id: ses_... (sub-agent session preserved — reuse to retry/inspect)
<task_error>Tool execution aborted</task_error>
and resume via task(task_id="ses_...").

Evidence:

  • Parent ses_fca390730ffeUxcxDUwJB9mr5J last messages have finish:"tool-calls" but no task_result with task_id
  • Child sessions: ses_fca376712ffe8yo4PsY76GyGSW (1787608733965) and ses_fca2e2e1fffew5cAkpmn6IgDgJ (1787609338370) both MessageAbortedError: Aborted, 0 tokens
  • v1.18.20 changelog lists "Surface failed subagent tool calls with a resumable task_id" — Esc path still empty

Suspected root cause: v1.18.20 fix wraps sub-agent internal failures inside tool/task.ts SessionPrompt.prompt() try/catch, but user Esc aborts the parent SessionPrompt.loop() AbortController outside that catch — all pending tools marked error("Tool execution aborted") before wrapper can return session.id. Same as #13910 lines 128-162, abort path not covered.

Suggested fix: ensure session.id is returned even on parent abort, and TUI renders task_id on aborted Task parts (cf. #24756).

Plugins

No response

OpenCode version

1.18.21

Steps to reproduce

  1. opencode with any model, send prompt that triggers task tool (e.g. "Explore codebase and write 200 lines story")
  2. While sub-agent running, press Esc after 15s
  3. Observe parent receives "Task cancelled" with no task_id; check opencode db — child session exists but is unreachable

Screenshot and/or share link

No response

Operating System

Windows 11

Terminal

Windows Terminal / PowerShell 7

Activity

  1. github-actions commented on Aug 24, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of or closely related to existing issues. Please check:

    If your issue is specifically that the v1.18.20 fix did not cover the Esc/parent-abort path, it may be worth linking to or reopening #13910 rather than filing separately.

  2. thdxr commented on Oct 11, 2026

    @thdxr
    Member

    Thanks for the report! OpenCode 2.0 is now out and development is focused on V2, so we're closing issues filed against OpenCode 1. Please upgrade (opencode upgrade --major, details: https://anoma.ly/notes/opencode-2-0), and if this is still relevant on 2.0, reopen this issue or open a new one with your 2.0 version.

    — from 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊

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