Before submitting#
Related: #16183 tracks the MCP schedule_task path, and #34995 fixes it there. This issue covers the other way in: a task saved from Settings (web or mobile), or by any other caller of ScheduledTaskService.upsert, in a project whose folder is not a Git repository. #34995 does not reach that path.
Area#
apps/server
Steps to reproduce#
- Add a project whose folder is not a Git repository (a Perforce workspace, or any plain folder).
- Open Settings, Scheduled tasks, and create a task in that project. Leave Workspace at its default, "Create a new worktree".
- Set Thread to start a fresh session in a bound thread (any mode other than a new thread per run), and an interval of one minute.
- Run it now, then wait for the next occurrence.
The MCP route reaches the same state with schedule_task (bindToCurrentThread: false, freshSession: true, everyMs: 60000).
Expected behavior#
A worktree needs Git, so a task in a non-Git folder should run in the project folder, as Scratch tasks already do. ScheduledTaskService.upsert already saves Scratch tasks at the root for this reason.
Actual behavior#
The task is saved as { type: "worktree", baseRef: "main", startFromOrigin: true }. The editor defaults to that (apps/web/src/components/settings/ScheduledTasksSettings.tsx:182, mobile apps/mobile/src/features/settings/scheduledTaskDraft.ts:303), and nothing checks for Git before saving.
- Run 1 fails at workspace preparation:
resolveWorktreeBaseRemote ... Failed to resolve the VCS driver for this Git command.
- Because the task's runs share a bound thread, the failed worktree setup holds that thread's queue (
worktreeSetupPending). Run 2 stays queued with startedAt: null, and later occurrences are skipped as "previous occurrence still queued".
Impact#
Major degradation or frequent failure
Version or commit#
main at fcf50ffe3
Environment#
Reported on Windows 11 with a Perforce workspace project. Reproduced in a server test on macOS.
Workaround#
Pick "Use the project checkout" in the task's Workspace setting before the first run. A task that already failed stays stuck on its held thread; delete and recreate it.