#12706·kilocode

[Bug 7.4.17] Task subagents retry overloads, then abort and leave an orphaned tool

Author: telemetrya2018-dotcomCreated Jul 30, 2026Updated Sep 29, 2026

Description

On Kilo Code 7.4.17, foreground Task subagents can spend several minutes retrying server_is_overloaded, then all active children are cancelled and the parent receives only Tool execution aborted. A model-initiated retry creates duplicate child sessions and fails again. The parent loop can then exit with an orphaned interrupted Task tool.

The incident is especially confusing when provider.openai.options.chunkTimeout is configured, because the cancellation boundary strongly matches that timeout while the parent is waiting for local Task tools.

Environment

  • Kilo Code: 7.4.17
  • Surface: VS Code extension on Windows 11
  • Parent and child model: openai/gpt-5.6-sol-pro
  • Child agent: built-in explore subagent
  • Runtime: AI SDK
  • Relevant provider options:
jsonc
{
  "timeout": 300000,
  "chunkTimeout": 180000
}

Reproduction timeline

The parent launched two Task subagents in parallel.

First batch:

  • 09:17:15Z: two child sessions were created.
  • Their provider calls repeatedly returned service_unavailable_error / server_is_overloaded and one ProviderHeaderTimeoutError.
  • The children kept retrying and one child reached a second agent step.
  • 09:18:11Z: the last concurrently running non-Task tool in the parent completed.
  • 09:21:11Z: both child sessions were cancelled, approximately 180 seconds after that last parent tool event.
  • 09:21:13Z: both parent Task calls changed to error: Tool execution aborted after 238.1 seconds total.
  • One child ended as MessageAbortedError; the other retained an unfinished assistant message.

The parent model then retried the same two investigations by creating two new child sessions.

Second batch:

  • 09:22:31Z: two replacement child sessions were created.
  • They again received repeated server_is_overloaded responses but also performed real work and tool calls.
  • 09:25:31Z: both children were cancelled.
  • 09:25:34Z: both parent Task calls changed to error: Tool execution aborted after 182.7/182.8 seconds.
  • The parent log then reported:
loop exit with orphaned interrupted tool ... tool=task

The configured chunkTimeout was 180,000 ms. The second failure aligns almost exactly with it. The first failure also aligns with 180 seconds after the last other parallel tool completed. This suggests that the provider stream idle timer may continue running while the parent is legitimately waiting for Task children.

The upstream overload is a valid trigger, but it should not produce an opaque/orphaned lifecycle state.

Actual behavior

  • Transient server_is_overloaded responses are retried repeatedly for several minutes with no useful status in the parent UI.
  • Active child work is cancelled at the parent timeout boundary.
  • The Task result loses the underlying cause and only says Tool execution aborted.
  • No resumable task_id is returned on this error path.
  • Retrying creates new duplicate child sessions instead of resuming the existing children.
  • The parent can exit with orphaned interrupted tool.

Expected behavior

  1. Provider chunkTimeout should measure silence from the provider transport, not time spent executing or awaiting a local Task tool.
  2. Task/subagent lifecycle timeout should be separate and configurable.
  3. Transient provider errors should have a bounded retry policy, preferably one automatic retry by default or a configurable count.
  4. The UI should show a localized, actionable terminal message with elapsed time, phase, retry count, and root cause. For example:
Subagent was cancelled after 3 minutes while the parent was waiting.
Last upstream error: server_is_overloaded. Automatic retry 1/1 exhausted.
Child session: <task_id>; it can be resumed.
  1. The Task error path should always return the existing child task_id, partial result/transcript location, and terminal state so the parent can retry exactly once by resuming the same child.
  2. Cancelling children must settle every parent Task call cleanly; the parent loop must not retain an orphaned interrupted tool.

Related issues

  • #12483: provider stream idle timeout and chunkTimeout workaround.
  • #11708: Task subagent blocks the parent and has no independent cancellation/lifecycle timeout.
  • #11745: subagent timeout can be ignored.
  • #12493: control, stop, prompt, and resume Task subagents.
  • #9792: retryable provider failures were not handled cleanly; closed as stale.

Privacy-safe evidence available

I have the exact parent/child session IDs, message IDs, Task call IDs, database rows, and opencode.log timeline. I can provide a sanitized log bundle if maintainers specify the preferred attachment format.