Skip to content

[Bug]: Linked delegated tasks omit the next hint, leading parents to poll #38362

Closed as not planned

Description

@andrewfree

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

This was generated by AI during triage.

  1. Link two T3 Code environments. From a Cursor parent, call delegate_task with mode: "async" and target.environmentId set to the linked environment. Give the child work that stays active longer than 45 seconds.
  2. While the child is running, call t3_thread_wait on the linked child thread with untilDelegatedWorkSettled: true and timeoutMs: 120000.

Expected behavior

For a linked delegate owned by the caller, surface next when T3 can confirm that completion will wake the parent, as it does for local delegates. Keep the existing per-call wait cap. See #24782 and #16719.

Actual behavior

The async dispatch returned status: "running" without next. Seven linked waits with requested timeouts from 120 to 3,600 seconds returned after about 46 seconds each with status: "running", timedOut: true, and no next. The tool guidance tells the parent to call again if a wait times out without next. The parent kept polling and eventually retrieved the completed result with task_status.

Impact

Minor bug or occasional failure

Version or commit

0.1.11-nightly.20261117.4838 (ea6d3fc30fb0)

Environment

Two linked macOS T3 Code environments, with a Cursor parent.

Logs or stack traces

Sanitized provider trace: a `120000` ms wait returned in `45.829` s with `{"status":"running","timedOut":true}` and no `next` field. This comes from one observed run and source review. Automatic wake after the parent yields remains to be verified separately.

Screenshots, recordings, or supporting files

No response

Workaround

No response

Investigated and written with GPT-6.2 Sol through Codex in T3 Code. Claude Opus 5.5 independently investigated and triaged the report, and Claude Fable 5.2 verified the final draft, both through Claude Agent in T3 Code.

Activity

  1. added
    bugSomething is broken or behaving incorrectly.
    needs-triageIssue needs maintainer review and initial categorization.
    on Nov 17, 2026
  2. juliusmarminge commented on Nov 17, 2026

    @juliusmarminge
    Member

    I tried to reproduce this on the current build and could not.

    Not reproduced in a real run of two linked environments with a Cursor parent; the evidence is a failing unit test plus source reading. On origin/main 7b44788 I added one assertion to the existing parameterised test 'a blocking %s delegation cancelled mid-wait wakes its parent like an async task' in apps/server/src/mcp/OrchestratorMcpService.test.ts: after the cancelled wait, task_status on the still-running task must return next === ORCHESTRATOR_MCP_RUNNING_TASK_NEXT. Ran vp test run src/mcp/OrchestratorMcpService.test.ts -t "cancelled mid-wait" in apps/server: the local case passes and the remote case fails with next undefined, even though the task is running with completionWake 'always'. Source reading: delegateTask with target.environmentId returns readTask(...), which for a task without a local child goes to readRemoteTask, and that function never sets next. t3_thread_wait with environmentId is forwarded by McpToolAccess.routed to the peer, whose waitForThread only adds next for an app_owned task held by a parent thread in its own environment; it has none for a linked delegate, so the forwarded reply has no next either. The ~46 s returns match the existing MAX_WAIT_TIMEOUT_MS per-call cap.

    Closing as not planned. If it still happens for you, reply with the exact steps and the version you are on and it will be looked at again.

  3. andrewfree commented on Nov 18, 2026

    @andrewfree
    Author

    Thanks for looking at this. It still happens on 0.1.11-nightly.20261117.4838 (ea6d3fc30fb0), and your added assertion shows the same thing: for a linked task, task_status returns running without next.

    What this means for users

    next is the hint T3 adds to a running delegate's response: "Completion wakes this thread. Do not wait on it or poll it." Local delegates get it. When an agent hands work to a linked environment (a second T3 server), none of the responses include it.

    The wake itself works. Earlier the same day, on 4838, the same Cursor parent ended its turn after three linked dispatches, and each child's completion started a new parent turn. Without the hint, though, the agent has to guess, and the t3_thread_wait description tells it to call again when a wait times out without next. So sometimes it ends its turn, and sometimes it holds the turn open and polls:

    • On one delegation it made 14 polling calls in about 7 minutes: 7 waits, 6 thread reads and 1 status check. The waits asked for 120 to 3,600 seconds and each returned after about 46 seconds.
    • Each poll is another model call, and the thread stays busy until the child finishes.

    Steps to reproduce

    Two linked macOS arm64 servers, A and B, both on 4838, with a Cursor parent on A.

    1. On A, call delegate_task with mode: "async", setting target.environmentId, target.projectId, target.providerInstanceId and target.model to valid choices on B. Give the child a few minutes of work.
      Result: running, remoteChild present, no next. None of the 11 linked dispatches in my trace returned next (9 running, 2 starting), and two of them came after this issue was closed.
    2. Call t3_thread_wait with B's environmentId, the remoteChild.threadId, untilDelegatedWorkSettled: true and timeoutMs: 120000.
      Result: after 45.8 s, running, timedOut: true, no next. That matches the existing 45 s per-call cap, which can stay.
    3. While the child still runs, call task_status on A with the taskId.
      Result: running, no next. This is the call your assertion makes after cancelling a blocking wait.

    Source check

    OrchestratorMcpService.ts, McpToolAccess.ts, PeerForwarding.ts, RemoteDelegation.ts and the orchestrator tools.ts are byte-identical at ea6d3fc30fb0, 7b4478895d (the commit you tested), b387e3a179 (4851) and 959c4c1ecf (main when I checked). readRemoteTask never sets next. Without it, the tool descriptions point in opposite directions: task_status says not to call it on a running task before completion wakes you, while t3_thread_wait says to call again.

    Not tested: a live run on 4851 or main.

    Ask

    Could you reopen this to track returning next for linked delegates? That would cover delegate_task, task_status and timed-out t3_thread_wait responses, in the cases where T3 can confirm the delegate's completion will wake the calling parent.

    Edited to add the user impact and the wake evidence. The first version listed the wake after the parent ends its turn as untested; the trace shows it working on 4838.

    Live trace evidence gathered by GPT-6.2 Sol through Codex in T3 Code. Source check, trace analysis and edits by Claude Opus 5.5; first draft and readability review by Claude Fable 5.2; both through Claude Code in T3 Code. Independent reviews by GPT-6.2 Astra and GPT-6.2 Sol through Codex in T3 Code.

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

    bugSomething is broken or behaving incorrectly.needs-triageIssue needs maintainer review and initial categorization.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions