Skip to content

Scheduled tasks: let schedule_task choose the workspace (or honour the project's defaultThreadEnvMode) #19786

Closed as not planned

Description

@encelyte-llc

Today an unbound (fresh-thread-per-run) scheduled task always prepares a new worktree from origin/main
(scheduledTaskWorkspaceStrategy() returns {type: worktree, baseRef: "main", startFromOrigin: true}), and the
project's defaultThreadEnvMode is ignored. For frequent schedules that only read state and call tools
(every 10 min / hourly), each run pays a git fetch + a full checkout before it starts.

Measured on one workstation over 24 h: 141 new worktrees, 29 min of preparation wait in total, p90 prep 131 s
for a 10-minute schedule, and 3 runs lost when the fetch timed out during a short network outage.

Ask (either would do):

  1. A workspaceStrategy field on schedule_task / update_scheduled_task, the same shape as t3_thread_launch
    (root | worktree | existing_worktree), used for each fresh run; or
  2. Honour the project's defaultThreadEnvMode (local -> run in the project root) for unbound schedules.
    Also useful: clean up the run's worktree when the scheduled thread settles and the tree is clean.

Related: #16183 (hard-coded main baseRef for fresh-thread schedules), #16725.

Activity

  1. juliusmarminge commented on Oct 15, 2026

    @juliusmarminge
    Member

    Note

    Grok responding on behalf of Julius.

    Thanks for the numbers. This is a feature request, so it belongs in Ideas; we'll move it there. A fresh worktree per run for unbound schedules is the current intended behavior (see #16725). Until schedule_task can pick a workspace, a schedule created in Settings can use "Use the project checkout" to run in the project root, and the hard-coded main base ref is tracked in #16183.

  2. elkasab99 commented on Oct 16, 2026

    @elkasab99

    Adding a harder failure mode to this: for projects whose root is not a Git repository, unbound scheduled tasks don't just pay worktree prep — every run fails.

    T3 Code v0.1.0 (Linux, web). A task created via MCP schedule_task (webhook trigger, bindToCurrentThread: false) is stored with {"type":"worktree","baseRef":"main","startFromOrigin":true}, and each run ends with:

    Workspace preparation failed during provision worktree: Git command failed in GitWorkflowService.remoteExists (…): Failed to resolve the VCS driver for this Git command.

    Setting the project's defaultThreadEnvMode to local has no effect, and schedule_task / update_scheduled_task have no workspaceStrategy field, so MCP-created tasks can only be fixed in the web editor ("Use the project checkout" → {type:"root"}), which works. Normal threads fall back to local for non-Git projects (resolveSendEnvMode); the scheduler passes the stored strategy to threadLaunch.launch without that fallback.

    Either option from the issue would fix it; a non-Git fallback to root would at least stop the hard failure.

  3. t3dotgg commented on Oct 21, 2026

    @t3dotgg
    Member

    Note

    🤖 Claude Opus 5.5 responding on behalf of Theo

    Thanks for the report. This behavior is intended, so we will not change it. If you need different behavior, please post the idea in Ideas discussions so others can vote on it. If you see a different fault, please open a new issue with steps to reproduce it.

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

    enhancementRequested improvement or new capability.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions