Skip to content

Fallback in a subagent (task) session completes, but the parent task call returns "Task cancelled" #4

Description

@dwizzle204

Title: Fallback in a subagent (task) session completes, but the parent task call returns "Task cancelled"

Environment

  • opencode 1.18.18
  • opencode-auto-fallback v0.4.59 (line references below are to dist/index.js of that version)
  • A subagent session created via the task tool (subagent_type: oracle), agent oracle, model openai/gpt-5.6-sol

Observed sequence (timestamps UTC, from the opencode log and session database)

  1. Subagent session created; stream starts on openai/gpt-5.6-sol.
  2. Stream error: AI_APICallError: The usage limit has been reached.
  3. Two message=cancel events for the subagent session follow immediately (the plugin's abort; handleImmediate calls abortSession at L1384 before tryFallbackChain at L1391).
  4. The plugin re-sends on the same session with the fallback model (fallbackToModel, L1201-1210).
  5. The fallback response completes in the subagent session: finish: "stop", 58,456 input / 71 output tokens, full answer text persisted in the message parts.
  6. The task tool call in the parent session returns "Task cancelled". No message containing the subagent's answer appears in the parent session.

Code facts (v0.4.59)

  • The event hook dispatches session.error to handleSessionError for all sessions (L1861-1862); there is no session-type or parent/child filtering.
  • The plugin bundle contains no reference to subagent, task, or parent-session identifiers (grep for subagent|parentID|parent_id|task in dist/index.js: 0 matches).

Net effect observed: when the failing session is a task-dispatched subagent, the plugin's abort-and-re-send completes a fallback response inside the subagent session, but the parent's task call has already been cancelled, so the completed answer is not delivered to the parent.

Not determined

  • Whether the opencode plugin API provides a way to deliver a completed subagent response to the parent task call after an abort. No assumption is made here about where the fix belongs.

Note: this issue was drafted with the assistance of an AI assistant.

Activity

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions