Agent is interrupted with “Connection Error” if Subagent is running for more than two hours.
I didn’t have time to take a screenshot because the error disappeared when switching between chats, but the error was the same as when the connection was lost.
I’m not sure if the connection wasn’t actually interrupted.
Steps to Reproduce
Start an Agent in IDE window Chat
The Agent should start a Subagent
The Subagent should launch a foreground shell in legacy terminal mode, which will run for more than 100 minutes (in my case, the process took at least 103 minutes). But the Subagent was also doing other work before launching this long terminal, so I can’t say how long it actually worked.
This isn’t a hard 2-hour limit, and your work generally isn’t lost. When a single agent turn stays open for a very long time (like your subagent waiting on a 100+ minute foreground terminal command), the long-lived connection to our backend gets dropped and re-established a few times. Each turn only allows a limited number of those reconnects, so a multi-hour turn eventually uses them all up and surfaces the generic “Connection Error.” The ~2 hours is just how long it takes to hit that limit, not a fixed timeout, and the error card usually sits on top of an otherwise-resumed conversation, which is why it vanished when you switched chats.
This is on our side, not your setup. I’ve traced the mechanism and reported it to our team.
A couple of things that can reduce it in the meantime:
For very long-running processes (100+ min), running them in the background rather than as a foreground shell the agent waits on keeps a single turn from being held open for hours, which is what exposes it to these reconnects. Splitting a big task across shorter turns has the same effect.
If you’re on a corporate VPN or proxy, disabling HTTP/2 (Cursor Settings, search “http2”) usually cuts down on the mid-stream drops that trigger this.
If it keeps happening even with shorter turns, reply here and I’ll dig in further.