[Bug]: A user's message waits behind automatic delegated-task notices, even ones that arrived after it
Area
apps/server (run queue)
Summary
On a coordinator thread that has several delegated tasks, a user's message waits behind automatic delegated-task and background-task notices. A notice that arrives after the user's message can still be placed ahead of it. With turns running one at a time, the user gets no answer for minutes, and the thread looks stuck.
Environment
T3 Code 0.1.7 desktop, macOS, Apple Silicon, Claude provider (claudeAgent). One parent thread with about 8 delegated tasks running.
What happened
Queue of the parent thread at one moment (relative times):
| Order | Queued run | Requested |
|---|---|---|
| 1 | Delegated task "…" [completed] notice | t + 3 s |
| 2 | "Background task completed." | earlier, t − 2 min |
| 3 | User message | t |
-
The notice requested 3 seconds after the user's message was placed ahead of it.
-
One earlier queued run waited 5 min 48 s to start (requested 08:57:41, started 09:03:29 UTC), behind a long coordinator turn.
-
Trying to
promote_to_steerthe user's message failed twice:- once with "Target run … is completed and cannot be steered", because the active run had just finished;
- once with "No running provider turn found for active run …", because the next run was still starting (see #23271).
So in the gap between turns there was no way to get the message in sooner except reordering it by hand.
Expected
- A user's message should go ahead of queued automatic runs (delegated-task results, background-task notices). At minimum, it should never be placed behind notices that arrived after it.
- Ideally, queued automatic notices for the same thread should be batched into one turn, so a burst of child completions doesn't create one turn each.
- The UI could show the queue position ("2 automatic updates ahead") so the user can tell that the message is queued, not lost.
Workaround
Reordering by hand with t3_queue reorder put the message first.
This is the same problem as #34625, so I'm closing it in favour of that one. If it is different, say how and it will be reopened.