runOn folderOpen tasks are not executed on startup

Where does the bug appear (feature/product)?

Cursor IDE

Describe the Bug

In the .vscode/tasks.json file, build tasks can have the “runOptions” section with the setting “runOn” with value “folderOpen”, which should execute the build task when the workspace folder is opened in the IDE. This works when opening a folder within an already running Cursor AI IDE instance, but when starting the IDE and it opens the most recently used folder, then the folderOpen tasks don’t get executed. They should also be executed when the folder is opened during startup.

Steps to Reproduce

Create a folder “.vscode” in your workspace folder and create a “tasks.json” in it with the following content. This should start the typescript watcher (auto-compile on changes) when the folder is opened. Then close the IDE and start it anew, which will open this last opened folder but will not execute the task.

{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "Auto-Compile",
            "type": "typescript",
            "tsconfig": "tsconfig.json",
            "option": "watch",
            "group": "build",
            "problemMatcher": [
                "$tsc-watch"
            ],
            "runOptions": {
                "runOn": "folderOpen"
            }
        }
    ]
}

Expected Behavior

The “runOn” “folderOpen” tasks should be executed on startup, too, when a folder is automatically opened.

Operating System

Windows 10/11

Current Cursor Version (Menu → About Cursor → Copy)

Version: 1.7.38 (user setup)
Commit: 1.99.3
Datum: fe5d1728063e86edeeda5bebd2c8e14bf4d0f960
Electron: 2025-10-06T18:18:58.523Z
ElectronBuildId: 34.5.8
Chromium: undefined
Node.js: 132.0.6834.210
V8: 20.19.1
Operating system: 13.2.152.41-electron.0

Does this stop you from using Cursor

No - Cursor works, but with this issue

Hey, thanks for the report. This is a known issue with how Cursor handles runOn: folderOpen tasks during startup vs when opening folders in an already running instance. The VS Code task system that Cursor inherits has some quirks around startup timing.

A couple of workarounds you can try:

  1. Use the Command Palette Ctrl+Shift+P and run Tasks: Run Task to manually trigger your Auto-Compile task after startup.
  2. Set up a keybinding to quickly run the task, add this to your keybindings.json:
   {
       "key": "ctrl+shift+t",
       "command": "workbench.action.tasks.runTask",
       "args": "Auto-Compile"
   }

You could also try adding the task to your workspace settings to make it more persistent, though that might not solve the startup timing issue.

This behavior should probably match VS Code’s implementation more closely, thanks for the detailed bug report with reproduction steps, that’s really helpful for the team to track down the root cause.

1 Like