Possible memory leak with test command?

Where does the bug appear (feature/product)?

Cursor IDE

Describe the Bug

The agent ran tests across many conversations after implementing my requirements. Turns out, the node processes that seemingly ran the tests are kept alive even if the conversation was over, resulting in an unnecessary memory consumption.

Steps to Reproduce

I just did what anyone might usually do. Start a new agent conversation, generate a plan, build. The AI will implement things and it will run Vitest tests and build scripts to ensure nothing broke.

It seems though that the terminal used by the agent to test is not terminated properly as seen in my screenshot.

Expected Behavior

There shouldn’t be any alive processes for tests that should’ve been finished.

Screenshots / Screen Recordings

Operating System

MacOS

Current Cursor Version (Menu → About Cursor → Copy)

Version: 2.2.44
VSCode Version: 1.105.1
Commit: 20adc1003928b0f1b99305dbaf845656ff81f5d0
Date: 2025-12-24T21:41:47.598Z
Electron: 37.7.0
Chromium: 138.0.7204.251
Node.js: 22.20.0
V8: 13.8.258.32-electron.0
OS: Darwin arm64 25.1.0

For AI issues: which model did you use?

Opus 4.5 Thinking high effort

Does this stop you from using Cursor

No - Cursor works, but with this issue

Hey, thanks for the report.

This is a known issue. The agent’s background terminal processes don’t shut down properly after a session ends. The team is aware and is working on a fix.

For now, as a workaround, please quit the vitest processes manually in Activity Monitor after using the agent, or restart Cursor when memory usage gets critical.

try legacy terminal in Cursor Settings / Agents if it starts up

Hi Dean, thanks for the reply.

I ended up creating another npm command called testOnce that doesn’t watch for changes and made the agent use that command when it needs to run test. Since then I have had no vitest processes kept alive. :slightly_smiling_face:

Hey Jerry, mind sharing the actual command you wrote for testOnce in the package.json? I have this problem as well, and would love to help my team and I avoid it until it’s fixed proper in Cursor IDE.

Thanks!