Terminal sessions do not reliably persist when switching between
projects using the workspace picker in the Agents Window sidebar.
After quitting and reopening Cursor, terminals opened in one
workspace are closed when I switch to another workspace and then
return. This affects any running process, including AI agents, test
scripts, and regular shell commands.
The behavior is intermittent. It usually occurs during approximately
the first 10 workspace switches after startup. After that, terminal
sessions may begin persisting normally.
Steps to Reproduce
Add multiple projects to the Agents Window sidebar.
Quit and reopen Cursor.
Select project A and open one or more terminals.
Start a process in a terminal.
Select project B from the sidebar.
Return to project A.
Observe that the previously opened terminal has been closed.
Repeat switching between workspaces.
Expected Behavior
Terminal sessions should remain open and running when switching
between workspaces in the Agents Window sidebar.
Hey, thanks for the detailed report, and especially for calling out the first ~10 switches after startup. That’s a really useful signal.
This is a known issue we’re tracking. What’s happening is: when you switch projects in the sidebar, the per-project terminal doesn’t rebind in time, so the pty host treats it as disconnected, and the normal 1-minute reconnection grace kills the process. So GC is working as intended, we’re missing the rebind on switch. I can’t share an exact ETA yet, but I’ll update the thread if there’s news.
A couple workarounds for now:
Fully restarting Cursor temporarily brings things back to a healthy state, terminals survive switches again.
For critical long-running processes, keep them in a terminal in the classic Editor Window. That path doesn’t use the Agents Window rebind flow. On macOS, for interactive sessions you can wrap the process in tmux or screen so you can reattach even if the panel drops.
You mentioned you can send logs, that would really help. If you catch it happening, send excerpts from ptyhost.log and main.log for a couple minutes around the project switch where the terminal disappears to [email protected] or post them here. Best case, include the switch timestamp so we can match it with the reconnection grace time of 1m has expired entry. Logs are in ~/Library/Application Support/Cursor/logs/.
Hi thanks for your solution, I will use tmux to bypass this issue.
I have attached the log, sorry for that I didn’t record the switch timestamp, but I was in that trouble every time when I switched workspaces before catching this log.
Thanks, these logs are exactly what we needed. No need to hunt for a timestamp. In main.log you can clearly see the key signature: The reconnection grace time of 1m has expired, shutting down pid, along with Couldn't get layout info, a terminal was probably disconnected... Could not find pty N on pty host. This is the exact mechanism I described above. The terminal doesn’t rebind fast enough when switching workspaces, the pty host treats it as disconnected, and after a 1-minute grace period it kills the process. So your logs confirm this specific issue, not something in your setup.
I’ll pass this to the team together with your note about the first ~10 switches after startup. That’s a helpful signal. I don’t have an exact ETA yet, but I’ll reply in the thread when there’s an update.
tmux is a good choice. It’ll survive workspace switches regardless of what’s happening with the panel. If the issue starts getting in the way again after startup, a full Cursor restart temporarily brings everything back to a healthy state. Let me know if anything else comes up.