[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
Version: T3 Code (Beta) 0.1.6, macOS
What happens
- A scheduled task created through the
schedule_taskMCP tool withbindToCurrentThread: falseis always saved withworkspaceStrategy: {"type":"worktree","baseRef":"main","startFromOrigin":true}. - The tool has no
workspaceStrategyparameter, so an agent can't choose «Use the project checkout». - Updating the task with
bindToCurrentThread: falseresets it toworktreeagain, 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
- Set a project's default workspace to «Local».
- From an agent in that project, call
schedule_taskwithbindToCurrentThread: false(any schedule). - 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(orworkspace: "root" | "worktree") parameter onschedule_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.
juliusmarminge closed this
Sign in to join this conversation.