Skip to content

[Bug]: Scheduled tasks saved from Settings in a non-Git project fail every run and hold their thread's queue #36813

Closed

Description

@moenzuel

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

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

  1. Add a project whose folder is not a Git repository (a Perforce workspace, or any plain folder).
  2. Open Settings, Scheduled tasks, and create a task in that project. Leave Workspace at its default, "Create a new worktree".
  3. 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.
  4. 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 fcf50ff

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.

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