Skip to content

[Bug]: Delegated-task completions always jump ahead of queued messages, which can wait forever #34625

Closed
Jesse-pink-lab/t3code
#1

Description

@Jesse-pink-lab

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

Steps to reproduce

  1. In a thread, delegate several tasks with delegate_task (async), and keep the thread busy so their results queue instead of steering into the running turn.
  2. While the thread is busy, queue an ordinary message on it, from the composer or from another thread with t3_thread_send in queue mode.
  3. Let the delegates keep finishing. Each time the thread's run ends, check which queued run starts next.

Expected behavior

Queued runs start in roughly the order they were requested. A completion that arrived after the queued message waits its turn.

Actual behavior

queuedRunsInDeliveryOrder (apps/server/src/orchestration-v2/QueuedRunOrder.ts) puts every queued delegated-task completion ahead of every other queued run, no matter when it arrived. A newer completion always starts first, so the ordinary message waits until no completion is queued at all. Under a steady stream of completions it never runs. We saw queued messages wait 39 to 65 minutes behind completions that arrived after them.

Impact

Major degradation or frequent failure

Version or commit

Observed on v0.1.3. The same code is on main @ 08930ca.

Environment

Desktop app, server-side orchestration. Any provider.

Workaround

Send urgent messages so they steer the running turn (auto mode), or promote a queued message to steer.

A fix is proposed in #34620. It keeps each kind's queue order and starts runs in request order.

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions