Skip to content
Source
Sign inSign up
pingdotgg/t3code

[Bug]: Unbound scheduled tasks created via the `schedule_task` MCP tool always use «Create a new worktree» and ignore the project's default workspace #32491

ClosedSKCarlsson(GitHub profile, opens in a new tab) opened this issue 0 comments

Version: T3 Code (Beta) 0.1.6, macOS

What happens

  • A scheduled task created through the schedule_task MCP tool with bindToCurrentThread: false is always saved with workspaceStrategy: {"type":"worktree","baseRef":"main","startFromOrigin":true}.
  • The tool has no workspaceStrategy parameter, so an agent can't choose «Use the project checkout».
  • Updating the task with bindToCurrentThread: false resets it to worktree again, even after it was switched to «Use the project checkout» in Settings.
  • When the task fires, the run uses the saved strategy and never reads the project's defaultThreadEnvMode. That stays true when the project is set to «local».

Why it matters

Every run of a recurring task makes a full new worktree. Our repo is large (about 1.5 GB per checkout). Hourly agent tasks across a few projects made 33 worktrees in about 3½ hours and filled the disk. Also, because the run is in a worktree, its commits land on a throwaway t3/* branch instead of the checkout the task was meant to work in.

Where in the code (server 0.1.6, from the bundled build)

function scheduledTaskWorkspaceStrategy(boundToThread) {
  return boundToThread ? { type: "root" } : { type: "worktree", baseRef: "main", startFromOrigin: true };
}
// create: workspaceStrategy: scheduledTaskWorkspaceStrategy(bindToCurrentThread)
// update: input.bindToCurrentThread === undefined ? existing.workspaceStrategy
//                                                 : scheduledTaskWorkspaceStrategy(input.bindToCurrentThread)

Steps to reproduce

  1. Set a project's default workspace to «Local».
  2. From an agent in that project, call schedule_task with bindToCurrentThread: false (any schedule).
  3. In Settings → Scheduled tasks, the task shows Workspace «Create a new worktree». When it runs, a new worktree is created.

Expected

Either of these would fix it:

  • an optional workspaceStrategy (or workspace: "root" | "worktree") parameter on schedule_task; or
  • unbound tasks with no explicit strategy follow the project's default workspace.

Separately, an update that passes bindToCurrentThread: false should keep a strategy that was already saved, not reset it.

Workaround today

Edit each task in Settings → Scheduled tasks → Workspace «Use the project checkout». This survives later agent updates only if they don't pass bindToCurrentThread.

  1. juliusmarminge closed this

Sign in to join this conversation.