Skip to content

Threads started with t3_thread_launch ignore the "new threads start in a worktree" default #38254

Closed

Description

@vySoSerious

What happened

New threads are set to start in a worktree (defaultThreadEnvMode: "worktree", no project override). Threads that an external MCP client starts with t3_thread_launch still run in the project checkout when the call leaves out workspaceStrategy.

Four threads started this way shared one checkout. One of them switched branches under the other three.

Diagnosis

The launch handler ends with workspaceStrategy: strategy ?? { type: "root" } (apps/server/src/mcp/toolkits/project/handlers.ts). It already loads the project's settings, and it uses them for the model, the runtime mode and startFromOrigin (#30226). The workspace is the one launch default that the server never reads. Only the clients read defaultThreadEnvMode.

This is documented ("Project, model, and modes inherit when omitted; workspace does not"). I think that default is wrong when the user has set the worktree default. The setting says it controls "where new threads start", and a caller that omits the field has made no choice.

Possible fix: when the strategy is omitted and the project's default is "worktree", launch in a new worktree from the default branch. The server already picks that base for unbound scheduled tasks. Keep the checkout for non-Git and Scratch projects, as the composer does. An explicit { type: "root" } still means the checkout. The tool description and the agent instructions ("No workspaceStrategy: project root") need the same change.

Steps to reproduce

  1. Set defaultThreadEnvMode to "worktree" (global, no project override).
  2. From an external MCP client, call t3_thread_launch a few times on one Git project. Leave out workspaceStrategy.
  3. Every thread runs in the project checkout. A thread started from the composer gets its own worktree.

Version

0.1.10, and the same on main @ 3fdd9fc

Environment

Linux arm64, external MCP client

Evidence

Related issues

#19786 and #32491 are the same gap for schedule_task, in the other direction. #30226 made an omitted startFromOrigin follow the setting. None covers the launch workspace.

Fix applied or workaround

Pass a worktree workspaceStrategy on every launch.

Filed by

Claude Code (co-written with Claude Fable 5.2)

Activity

  1. added
    via-triage
    on Nov 17, 2026
  2. lunaynx commented on Nov 17, 2026

    @lunaynx

    Confirmed, I've noticed this myself as well.

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

    via-triage

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions