Skip to content
Source
Sign inSign up
pingdotgg/t3code

[Bug]: Mixed fan-out runs serially: delegate_task batched with foreground native Agent calls starts only after they finish #34706

Openclaytonfaria(GitHub profile, opens in a new tab) opened this issue 0 comments

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

apps/server

Summary

A Claude parent sends a mixed fan-out in one assistant message: two native Agent reviewers on Claude models, plus one delegate_task to a Codex model. The orchestration instructions route each child this way. The parent expects all three to run at once. They don't. The delegate_task call starts only after both native agents finish, so the cross-provider child is serialized behind the Claude children.

T3 itself did nothing wrong: the child was created the moment the call reached the MCP server. The cause looks like Claude Code's tool scheduling. Native Agent calls in a batch run concurrently, but an MCP tool call is only run once the concurrent calls ahead of it in that message finish (as far as I can tell, Claude Code treats MCP tools as concurrency-safe only when they carry readOnlyHint). Nothing in the orchestration instructions warns about this, and the model believes "independent calls in one message run in parallel", so it batches them.

Related but distinct: #34379 is about a foreground Agent blocking the parent's turn. This one is about a delegate_task sent in the same message being delayed behind foreground Agent calls, and then blocking the turn again if it uses mode:"wait".

Steps to reproduce

  1. Open a Claude thread (Opus 5.5) with the T3 MCP attached and a Codex provider available.
  2. Ask for three independent reviewers on different providers, e.g. "Have another Opus, a Fable and a Codex review this file in parallel, then iterate on their findings."
  3. The parent calls orchestrator_capabilities and then, as the instructions say, sends in one message:
    • Agent (Claude Opus, run_in_background:false)
    • Agent (Claude Fable, run_in_background:false)
    • mcp__t3-code__delegate_task with target: {providerInstanceId:"codex", model:"gpt-6-astra", options:{reasoningEffort:"xhigh"}}, role:"review", mode:"wait", timeoutMs:1200000
  4. Compare when the Codex child thread is created with when the two native agents finish.

Expected behavior

All three children start within a second or two of the parent's message and run side by side. Wall time is roughly the slowest child.

Actual behavior

From the parent thread's activity timeline (t3_thread_read, view:"activity"):

Time (UTC)Event
02:36:14.628Parent writes the shared brief file
02:36:22.419Parent's message with the 3 tool calls (the delegate_task item is stamped here, status running)
02:38:08.452Native Agent #1 (Opus) completes
02:38:55.757Native Agent #2 (Fable) completes
02:38:55.770delegate_task child item is created: 13 ms after the last native agent finished

So the Codex child started about 2.5 minutes late. Its start time is tied to the slowest native agent finishing, not to when the call was sent. Wall time becomes max(native agents) + codex instead of max(all three).

Because the parent chose mode:"wait" (defensible, since the next step needs all three results), the parent turn then stays blocked for the whole Codex run as well (up to the 20-minute timeout). To the user the thread looks stalled, and they can't tell whether T3 is broken.

The parent's own reasoning at the time: "I'm lining up three reviewers to run at the same time: Opus and Fable through the native agent, and Codex through delegate_task in wait mode. I'm putting all three calls in one message so they run concurrently." The model clearly expected concurrency.

Why the current instructions lead here

The Claude orchestration block currently says:

Subagents: use your native tool when the child uses your provider, a model it offers, and no settings beyond yours (Claude Agent, run_in_background:false; …). Use delegate_task for another provider's model, …

Each rule is correct on its own. Together, for a mixed fan-out, they produce foreground native agents plus an MCP call in the same message. Combined with Claude Code's general "send independent tool calls in one message" guidance, the model batches them. No line covers ordering when native and delegated children are mixed, or says that an MCP call batched with foreground Agent calls won't start until they finish.

The delegate_task schema helps a little ("Default 'async'. 'wait' only if this turn needs the result"), but it says nothing about batching either.

Suggested fix

Instructions only. One sentence in the Claude orchestration block, e.g.:

Mixing native and delegated children: send delegate_task (mode:"async") in its own message first, then the native Agent calls; collect the delegated result with t3_thread_wait. An MCP call batched with foreground Agent calls does not start until they finish.

With that ordering, all children overlap. The parent blocks on the native agents (as it does today), then on whatever the Codex child still needs, so wall time is about max(all).

Other options I considered, less good:

  • Tell the parent to always use async for every child in a mixed fan-out. That works, but it overlaps with the #34379 discussion about foreground vs background.
  • Annotate delegate_task with readOnlyHint: true so Claude Code treats it as concurrency-safe. That fixes the scheduling with no prompt change, but the hint is semantically wrong (the tool starts work and may write files in the child), so probably not.

Suggested eval case: "Have a Claude reviewer and a Codex reviewer review X in parallel." Pass if the Codex child is created within a few seconds of the parent's message, not after the Claude child finishes.

Impact

Minor bug or occasional failure

(It costs minutes per fan-out, more with long reviewers, and the parent looks hung. It isn't blocking, but it quietly defeats the point of fanning out to several providers.)

Version or commit

t3 CLI v0.1.9 (runtime 0.1.8)

Environment

Linux (Arch-based), T3 Code with the Claude Code harness 2.1.322, parent Claude Opus 5.5, native children Claude Opus 5.5 + Claude Fable 5.2, delegated child Codex gpt-6-astra (reasoningEffort: xhigh), runtime mode full-access.

Logs or stack traces

# Parent thread, activity view (trimmed)
pos 62  subagent      "Opus reviews skill"    completed  updatedAt 2026-11-12T02:38:08.452Z
pos 63  subagent      "Fable reviews skill"   completed  updatedAt 2026-11-12T02:38:55.757Z
pos 64  dynamic_tool  mcp__t3-code__delegate_task  running  updatedAt 2026-11-12T02:36:22.419Z
          input: { role: "review", mode: "wait", timeoutMs: 1200000,
                   target: { providerInstanceId: "codex", model: "gpt-6-astra",
                             options: { reasoningEffort: "xhigh" } } }
pos 65  subagent      "Codex reviews skill"   running    updatedAt 2026-11-12T02:38:55.770Z

Workaround

Tell the agent (or put in a memory note or skill): when mixing providers, start delegate_task async in its own message first, then the native agents.

  1. tanstack-source added labelsbug

Sign in to join this conversation.