Skip to content

[Bug]: Scheduled tasks saved before #36821 in a non-Git project still launch a worktree and fail #45543

Done

Description

@SchloTech

Before submitting

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

Follow-up to #36813 and #36821. That PR saves a non-Git task at the root on every save. It lists "Tasks saved before this change keep their worktree strategy until they're saved again" as out of scope. Nothing tracks that part, and it still fails runs.

Area

apps/server

Steps to reproduce

  1. On a server older than fix(server): scheduled tasks in a non-Git project run in its folder instead of failing #36821, create a scheduled task through MCP schedule_task in a project whose folder isn't a Git repository. Use bindToCurrentThread: false and a once schedule a few days out. The row saves workspace_strategy_json as {"type":"worktree","baseRef":"main","startFromOrigin":true}.
  2. Update the server to a build that has fix(server): scheduled tasks in a non-Git project run in its folder instead of failing #36821. Don't edit the task.
  3. Let the task fire.

Expected behavior

The run starts in the project folder, the same as a task saved after #36821.

Actual behavior

The run fails before the provider starts:

Workspace preparation failed during provision worktree: Git command failed in GitWorkflowService.resolveWorktreeBaseRemote (<project root>): Failed to resolve the VCS driver for this Git command.

The fallback only runs in ScheduledTaskService.upsert (apps/server/src/scheduledTasks/ScheduledTaskService.ts:1591). At fire time the task passes active.workspaceStrategy to threadLaunch.launch unchanged (ScheduledTaskService.ts:1136). No migration rewrites old rows either. A once task never gets saved again, so it can never pick up the fix.

Same server, same non-Git project: two tasks saved on 2026-11-25 have {"type":"root"} and run fine. The one saved on 2026-11-16 still has worktree and failed.

Possible fixes:

  • Apply the isNonGitProject check at launch for scheduled runs too, so stale rows fall back to the root.
  • Or add a one-time migration that rewrites worktree rows in non-Git projects to root.

The launch-time check also covers a project folder that stops being a Git repo after the task is saved.

Related, already noted in #36821: a message sent to the failed thread afterwards stays queued and never starts.

Impact

Major degradation or frequent failure

Version or commit

0.1.12-nightly.20261124.5178. Code unchanged on main @ 219c7be.

Environment

Linux (Ubuntu), t3 serve, Claude provider.

Workaround

Re-save the task so upsert rewrites its strategy. Or delete it and create it again. A task that already fired needs a new thread.

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