Skip to content
Source
Sign inSign up
pingdotgg/t3code

Agents ask to move the thread instead of delegating when running tasks across linked machines #49749

Opendylan1020(GitHub profile, opens in a new tab) opened this issue 2 comments

I regularly run prompts like "update X on all computers in the fleet" across my linked environments. Recently, instead of just delegating the task out to each machine and reporting back, agents started popping up the "Move this thread to another machine?" card (t3_thread_handoff) and stopping their turn.

I dug into main to see why this started happening. It looks like #49075 (for #49066) fixed a similar case right after linking a new machine, but when your machines are already linked, listing or using existing links doesn't emit that post-link notice, and the shared system prompt, tool descriptions, and composer context chips still heavily steer models toward t3_thread_handoff over delegate_task.

Full code trace and diagrams are below.


AI Details

Summary

Since thread handoff (t3_thread_handoff) was introduced in #44774 (3f63afc1f8), prompts asking an agent to run a task across already-linked machines can cause the agent to propose moving the current thread (t3_thread_handoff) instead of delegating work (delegate_task with target.environmentId).

#49075 (91db08de08, fixing #49066) updated the post-link acceptance notice in apps/server/src/peer/PeerLinkRequests.ts:465 to explicitly steer remote tasks to delegate_task. However, listing or directly using already-linked environments does not emit that notice, leaving models to rely on the shared prompt, tool descriptions, and (when attached) environment context chips.

Reproduction

  1. Have 2+ machines already linked via Linked Environments (reachable, full-access or auto-accept-edits).
  2. Start a thread on one machine and ask something like:

    "Update X on all computers in the fleet"

    (or @-mention one or more linked environments and ask the agent to run a command/update there and report back).
  3. Actual: The agent lists linked environments and calls t3_thread_handoff, showing the "Move this thread to another machine?" card (HandoffRequestCard.tsx:201) and ending its turn instead of doing the work.
  4. Expected: The agent fans out delegate_task calls with target.environmentId set for each linked machine, does the work in parallel, and reports back in the current thread.

Why #49075 Didn't Cover Already-Linked Fleets

flowchart LR
    A["User asks for work on other machine(s)"] --> B{"Link card accepted\nin this thread?"}

    B -->|"Yes (#49066 path)"| C["t3_environment_link card accepted"]
    C --> D["PeerLinkRequests.ts:465 wake notice:\nuse delegate_task with target.environmentId;\nt3_thread_handoff only when moving"]
    D --> E["Calls delegate_task (Fixed)"]

    B -->|"No (Already-linked fleet)"| F["Calls t3_environment_links\n(or reuses known environmentIds)"]
    F --> G["Post-link wake notice is not emitted"]
    G --> H["Model relies on shared prompt,\ntool descriptions, and context chips"]
    H --> I["Calls t3_thread_handoff (Still broken)"]

How Model-Facing Signals Bias Toward t3_thread_handoff

flowchart TD
    U["User: 'Update X on all computers in the fleet'"] --> P1

    subgraph Surfaces["Surfaces seen on an already-linked fleet (main @ 67bcb9f534)"]
        P1["System prompt (orchestrationInstructions.ts:10-21)\n- Native-subagent bullet omits 'another machine' from delegate_task exceptions\n- 'Another machine' bullet only names t3_thread_handoff\n  ('Continuing this thread there: t3_thread_handoff, not a delegate')"]
        P2["delegate_task description (tools.ts:92-95)\n- Top-level description omits remote execution / target.environmentId\n  (documented in nested OrchestratorMcpTarget & t3_environment_links)"]
        P3["t3_thread_handoff description (tools.ts:328-337)\n- 'Call this even if destination is unlinked or unknown'\n- 'Call this instead of asking in chat, then end your turn'\n- No instruction contrasting remote tasks vs continuing this thread"]
        P4["Composer chip, when @-mentioned (composerContextReferences.ts:449)\n- Leads with: 'To move this thread, pass this environmentId\n  to t3_thread_handoff.'"]
        P5["t3_environment_links result (PeerForwarding.ts:289-308)\n- Returns environmentId, links[], and notListed\n  (no delegation vs handoff reminder in payload)"]
    end

    P1 --> M{"Model selects tool for\n'act on other machines'"}
    P2 --> M
    P3 --> M
    P4 --> M
    P5 --> M

    M -->|"High salience: 'other machine' + 'call instead of asking'"| BAD["Calls t3_thread_handoff\nShows move card & ends turn"]
    M -.->|"Weaker signal in shared prompt"| GOOD["Expected: Fan out delegate_task\nwith target.environmentId per machine"]

Contributing Factors in main (67bcb9f534)

(From static source review; relative weights across models have not been measured with live eval runs.)

  1. Shared system prompt omits remote machines from delegate_task and only names t3_thread_handoff for acting on another machine

    • packages/provider-core/src/server/orchestrationInstructions.ts:10-14 favors native subagents for same-provider work and lists exceptions that require delegate_task (another provider's model, user-asked settings, isolation:"worktree", background agent)—a task on another machine is omitted.
    • packages/provider-core/src/server/orchestrationInstructions.ts:21:
      • Another machine: t3_environment_links lists linked ones. Pass its environmentId and that machine's threadId to T3 tools. Continuing this thread there: t3_thread_handoff, not a delegate.
    • The threadId clause applies to acting on an existing remote thread, and the only concrete action tool named in that bullet is t3_thread_handoff (paired with "not a delegate"). There is no corresponding instruction for running a task on another machine and reporting back here via delegate_task with target.environmentId.
  2. delegate_task's top-level description omits remote execution; t3_thread_handoff is framed proactively

    • apps/server/src/mcp/toolkits/orchestrator/tools.ts:92-95 (delegate_task):

      "Start one child agent with only task. No parent history. Separate checkout or PR per child: isolation:'worktree'. Keep taskId for task_status and task_cancel. No secrets in task."

      • target.environmentId is documented inside the nested OrchestratorMcpTarget schema (packages/contracts/src/orchestratorMcp.ts:118-123) and in t3_environment_links's description (tools.ts:344), but not in delegate_task's own description.
    • apps/server/src/mcp/toolkits/orchestrator/tools.ts:328-337 (t3_thread_handoff):

      "Move THIS thread with its code and edits. Call this even if the destination is unlinked or unknown: the move card handles linking. Stop at a safe point when the user is leaving. environmentId suggests a machine. Call this instead of asking in chat, then end your turn. Put remaining work in continuationPrompt."

      • Scoped to moving "THIS thread", with no contrast pointing remote tasks to delegate_task.
  3. Deferred tool_search surfaces t3_thread_handoff on machine queries

    • apps/server/src/mcp/McpToolExposure.ts:54-67 scores tools by query-term overlap with name and description.
    • Although delegate_task is already listed directly in DIRECT_TOOLS (McpToolExposure.ts:8-16), searching "machine" or "linked" returns t3_thread_handoff alongside t3_environment_link* (score 1 each) while delegate_task scores 0, increasing handoff's salience in tool-search results.
  4. Composer @-mentioned environment chips lead with t3_thread_handoff (when attached)

    • Plain-text fleet prompts do not receive this text, but when a user attaches an environment chip, packages/shared/src/composerContextReferences.ts:449 (updated in #44774) puts handoff in the first sentence:

      "To move this thread, pass this environmentId to t3_thread_handoff. For other work, link it if needed with t3_environment_link. Pass environmentId, or target.environmentId for delegate_task."

  5. Eval coverage gap (not a runtime cause)

    • evals/mcp-tool-use/cases/orchestration.ndjson:49-54 (#44774) added 6 handoff cases (5 expect handoff, 1 forbids it).
    • Line 48 tests delegating to one of several linked machines by load, and explicitly uses the word "Delegate".
    • Lines 58-59 (#49075) both start from a post-link wake notice that explicitly names delegate_task and target.environmentId.
    • There is no eval case for a plain-text request to run a task across multiple already-linked machines without the word "delegate", without an environment chip, and without a link-accepted notice.

Suggested Fix

  1. packages/provider-core/src/server/orchestrationInstructions.ts:10-22 (highest priority):
    • Add "a task on another machine" to the delegate_task exceptions in the native-subagent bullet (lines 10–14).
    • In line 21, explicitly contrast the two intents: e.g., "For a task on a linked machine (or each linked machine), call delegate_task with target.environmentId. When the user wants to continue this conversation there, call t3_thread_handoff." Scope the threadId note to tools acting on an existing remote thread.
  2. apps/server/src/mcp/toolkits/orchestrator/tools.ts:
    • Add Another machine: target.environmentId. to delegate_task's description.
    • Tighten t3_thread_handoff's description with an intent-based scope (e.g., "Use when the user wants this conversation to continue on another machine."), preserving existing departure/unlinked-move evals without adding fleet-task keywords that would inflate tool_search matches.
  3. packages/shared/src/composerContextReferences.ts:449 (and update composerContextReferences.test.ts:338-345):
    • Lead with acting/delegating there (Pass environmentId, or target.environmentId for delegate_task. Link it if needed with t3_environment_link.), and place t3_thread_handoff second for moving/continuing this thread.
  4. evals/mcp-tool-use/cases/orchestration.ndjson:
    • Add a regression case with 2 reachable already-linked machines and a plain-text prompt like "Update pnpm on both of my linked computers" (no "delegate", no environment chip, no link-accepted notice), expecting delegate_task once per distinct target.environmentId and notCalls: ["t3_thread_handoff", "t3_thread_launch", "t3_environment_link"].

Investigated and drafted with Gemini 4 Neon (Medium) via the Antigravity harness, and independently fact-checked and reviewed with GPT-6.2 Astra (Medium) via the Codex harness in T3 Code; both models agree on the diagnosis and suggested fixes.

  1. tanstack-source added labelsbug

  2. @dylan1020 Which provider and model (e.g. Claude Code with Opus, Codex with GPT-6.1 Sol, Antigravity with Gemini 4 Neon) were the agents running when they raised the 'Move this thread to another machine?' card instead of delegating, and did you @-mention the machines as chips or just type the request?

  3. juliusmarminge added labelsneeds more info

  4. @juliusmarminge Checked my local sessions — all 3 handoff occurrences were Codex with gpt-6.2-sol (reasoningEffort: high, selected on all 3 and confirmed executed on the Dec 3 run), and all of them were plain-text prompts (no @-mentioned environment chips).

    There's also a really clear before/after split on the exact same model (Codex / gpt-6.2-sol high) around #44774 (Nov 29):

    Raised t3_thread_handoff instead of delegating (after #44774, no "subagent"/"delegate" in prompt)

    #Date (UTC)Provider & ModelPrompt@-Chip?What Happened
    12026-12-03Codex / gpt-6.2-sol (high)"Install this skill across the fleet please. <url>"NoFinished local machine; SSH to second machine failed → t3_environment_links → t3_project_list (plus thread search/read) → t3_thread_handoff
    22026-12-06Codex / gpt-6.2-sol (high)"Install on Desktop now please." (same thread, later run)Not3_environment_links → t3_thread_handoff; after I replied "Yes delegate.", delegate_task succeeded
    32026-12-06Codex / gpt-6.2-sol (high)Run 1: "Upgrade Antigravity on both computers please." / Run 2: "It's online now, try again."NoSSH to second machine failed → t3_environment_links → t3_thread_handoff; after I replied "Use a subagent instead please.", delegate_task succeeded

    Delegated correctly (for comparison)

    • Before #44774 (Nov 21–25): The same Codex / gpt-6.2-sol (high) delegated automatically on plain-text prompts without saying "subagent" or "delegate" — e.g. "Yes, please copy it over and launch it on the other desktop.", "And push to main and then pull it in the desktop as well.", and "Rebuild and restart the running app on Desktop as well please." (4/4 runs, no @-chips).
    • After #44774 (Dec 3–4): Every session that delegated directly to the linked machine explicitly included "subagent" or "delegate" in my prompt — e.g. "Spin up a T3 subagent on the Desktop computer and download this and run it" (2 runs on gpt-6.2-sol high) and "Use a subagent on the desktop..." / "...T3-managed delegate limit..." (3 runs on gpt-6.1-terra high).

    Researched and written with Gemini 4 Neon (Medium) in the Antigravity harness through T3 Code (session data verified with GPT-6.2 Astra via Codex).

  5. juliusmarminge removed labelsneeds more info

Sign in to join this conversation.