Skip to content

[Bug]: t3_thread_launch runs in the shared checkout when its HEAD check fails, despite the worktree default #38454

Closed

Description

@yaacovcorcos

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. Set new threads to start in a worktree (the setting, or defaultThreadEnvMode: "worktree" in t3.json).
  2. Have an agent call t3_thread_launch for that project without a workspaceStrategy.
  3. Make the HEAD check in defaultWorktreeStrategy (apps/server/src/mcp/toolkits/project/handlers.ts) fail for a reason other than "no commit": Git times out on a busy or slow disk, Git cannot be spawned, or Git refuses the checkout (for example fatal: detected dubious ownership).

defaultWorktreeStrategy reads any failure of resolveCommit(HEAD) as "the repository has no commit" and returns no strategy, so the launch falls back to the shared checkout. #38261 already refuses the launch when the branch read fails, but this earlier check still falls back.

Expected behavior

Only Git's own answer that HEAD has no commit (an unborn branch) or that the folder is not a repository keeps the shared fallback. Any other failure refuses the launch with a message to retry or pass workspaceStrategy, as the branch read already does.

Actual behavior

The thread is created in the shared checkout, and its first prompt runs there instead of in a new worktree, so anything it changes lands in the user's working copy.

Impact

Minor bug or occasional failure

Version or commit

main at c488253

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