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)
- Subagent session created; stream starts on
openai/gpt-5.6-sol.
- Stream error:
AI_APICallError: The usage limit has been reached.
- Two
message=cancel events for the subagent session follow immediately (the plugin's abort; handleImmediate calls abortSession at L1384 before tryFallbackChain at L1391).
- The plugin re-sends on the same session with the fallback model (
fallbackToModel, L1201-1210).
- The fallback response completes in the subagent session:
finish: "stop", 58,456 input / 71 output tokens, full answer text persisted in the message parts.
- 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.
Title: Fallback in a subagent (task) session completes, but the parent task call returns "Task cancelled"
Environment
dist/index.jsof that version)tasktool (subagent_type: oracle), agentoracle, modelopenai/gpt-5.6-solObserved sequence (timestamps UTC, from the opencode log and session database)
openai/gpt-5.6-sol.AI_APICallError: The usage limit has been reached.message=cancelevents for the subagent session follow immediately (the plugin's abort;handleImmediatecallsabortSessionat L1384 beforetryFallbackChainat L1391).fallbackToModel, L1201-1210).finish: "stop", 58,456 input / 71 output tokens, full answer text persisted in the message parts.tasktool 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)
eventhook dispatchessession.errortohandleSessionErrorfor all sessions (L1861-1862); there is no session-type or parent/child filtering.subagent|parentID|parent_id|taskindist/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
Note: this issue was drafted with the assistance of an AI assistant.