Repository navigation
[Bug]: "workspace preparation failed" on scheduled task for "no project" #17309
Description
Activity
- addedbugSomething is broken or behaving incorrectly.Something is broken or behaving incorrectly.needs-triageIssue needs maintainer review and initial categorization.Issue needs maintainer review and initial categorization.
on Oct 8, 2026 Note
Grok responding on behalf of Julius.
Thanks for the report — this looks real on current
main(580948708).What happens
A scheduled task stores
workspaceStrategyon the row and, when unbound, launches with that strategy as-is (ScheduledTaskService.runTask→threadLaunch.launch, ~L798–805). The schedule editor defaults new tasks to Create a new worktree (EMPTY_DRAFT.workspaceMode: "worktree",ScheduledTasksSettings.tsx~L127) and still lists the Scratch project titled No project as an ordinary project (ManagedProjectFoldersbootstraps it with that title). There is no UI or upsert guard that forbids worktree/checkout modes for Scratch.At run time,
type: "worktree"always callsgit.createWorktreeagainstproject.workspaceRoot(ThreadLaunchService.prepareInBackground, ~L321–404). Scratch is not a git repo (ManagedProjectFolders.tsheader: Scratch is a plain folder with per-thread subfolders). That most likely fails and surfaces as Workspace preparation failed (failureDetail,ThreadLaunchService.ts~L165–171).The path that does work for No project is
type: "root": launch remaps Scratch root launches into a fresh per-thread folder viamanagedFolders.folderForThread(ThreadLaunchService.ts~L746–763).Open PR #17257
Web-only: adds an explicit No project choice, hides workspace/base-branch/checkout controls for that choice, and on save forces
{ type: "root" }viaworkspaceStrategyFromDraft(draft, noProject). That should stop new UI saves (and a re-save of an existing Scratch task) from storing worktree mode.It does not fully close this on its own:
- no server coerce/ignore of a stored
worktreestrategy for Scratch / non-git cwd at upsert or run time - MCP
schedule_taskstill hard-codes unbound tasks to{ type: "worktree", baseRef: "main", startFromOrigin: true }(OrchestratorMcpService.scheduledTaskWorkspaceStrategy, ~L228–233) — same failure already noted on #16183
Suggested fix
- Land / extend #17257 for the UI.
- Server-side: when the target is Scratch (or cwd is not a git repo), coerce
worktree/ invalid checkout strategies toroot(or reject with a clear error) on upsert and at launch, so existing tasks and MCP don’t keep failing. - Teach MCP
schedule_taskto pickrootfor Scratch / non-git projects (overlaps #16183).
Workaround: edit the task → Workspace → Use the project checkout (root), then run again.
Related (same Scratch + git-worktree mismatch, different entry): #16183. Nearby No-project threads but different bugs: #17166, #17187.
I traced this on
mainonly — I did not run a scheduled task end-to-end.- no server coerce/ignore of a stored
- addedvia-triageFiled through npx t3 triageFiled through npx t3 triageand removedneeds-triageIssue needs maintainer review and initial categorization.Issue needs maintainer review and initial categorization.
on Oct 8, 2026 Confirmed end-to-end on T3 Code
0.0.46-nightly.20261008.2849, Windows x64, at 2026-10-09 03:14:17 UTC. This adds a live MCP reproduction to the source analysis above.Minimal reproduction
-
Start a conversation under No project (the managed Scratch project).
-
Call
schedule_taskfrom that conversation with:{ "title": "Repro: no-project scheduled fresh thread", "prompt": "Reply exactly SCHEDULER_REPRO_OK. Do not use tools or do any other work.", "schedule": { "type": "interval", "everyMs": 86400000 }, "bindToCurrentThread": false, "enabled": false } -
Call
run_scheduled_task_nowwith the returned task ID. The disabled schedule permits a manual run without leaving recurring work active. -
Inspect the newly created thread with
t3_thread_list/t3_thread_read, or open it in the app.
Expected
The scheduler opens a fresh Scratch conversation in its own folder and runs the prompt, without requiring a Git repository.
Observed
The task is accepted with
boundThreadId: null, but its new thread immediately fails with Workspace preparation failed:Workspace preparation failed during provision worktree: Git command failed in GitWorkflowService.remoteExists (C:\Users\<user>\.t3\scratch): Failed to resolve the VCS driver for this Git command.Durable run state confirms
status: "failed",startedAt: null, and no assistant response. The thread was created at03:14:17.205Zand failed at03:14:17.673Z; the provider never started. The user's screenshot also shows the same error in the No project conversation.run_scheduled_task_nowand the task list reportlastRunStatus: "succeeded"andrunCount: 1despite the failed thread. That result reflects successful dispatch/bookkeeping, as documented by the tool; it does not prove the provider ran.Source corroboration
Read-only inspection of local
mainat3143335fc3a568cbbb5174764961889272135cb9(distinct from the running release version) confirms:apps/server/src/mcp/OrchestratorMcpService.ts:230–235assigns every unbound MCP task{ type: "worktree", baseRef: "main", startFromOrigin: true }, without considering the Scratch target.apps/server/src/scheduledTasks/ScheduledTaskService.ts:797–805passes that stored strategy tothreadLaunch.launch.apps/server/src/orchestration-v2/ThreadLaunchService.ts:746–765allocates a per-thread Scratch folder only fortype: "root"launches.
This verifies the MCP entry path identified above. I did not exercise the settings editor or test the proposed root-mode workaround. PR #17257 is still open at the time of verification.
The temporary schedule was kept disabled throughout the reproduction and removed afterward; the failed thread was retained for inspection. No source changes were made.
Verification and report by GPT-6.1 Sol through the Codex harness in T3 Code.
-
Before submitting
Area
apps/server
Steps to reproduce
create a scheduled task for "no project", accidentally leave worktree creation enabled.
Expected behavior
worktree creation should probably be disabled for folders that aren't git repos
Actual behavior
error message on start
Impact
Minor bug or occasional failure
Version or commit
No response
Environment
No response
Logs or stack traces
Screenshots, recordings, or supporting files
No response
Workaround
No response