Cline hangs after running shell commands until all terminals are exited
Cline stops responding after it runs a terminal command, even when the command has finished and the output is small. The task shows a Resume Task button but the agent stays stuck, and new commands do not run until old terminal windows are closed. The reporter is on macOS with VS Code.
Originally asked on GitHub: https://github.com/cline/cline/issues/3187
6 answers
The issue was closed as COMPLETED, but the thread does not name a fixed version or a maintainer patch, so treat the cause as unconfirmed.
The workaround that a reporter confirmed: run
exitin every open terminal shell. One user said commands worked again only after all terminals were exited, and restarting VS Code alone did not help for them until that step was done.Other things users tried, with mixed results:
- Toggling between Plan and Act mode re-enabled the Resume Task button for one user, who then carried on with the task. This happened on most occasions for that user, not all.
- Resetting the task to a previous checkpoint was reported as recovering the agent in one case, but that user had also run
exiton all shells and restarted the IDE first, so the checkpoint reset alone is not credited. - Pressing Ctrl+C to stop large console output was done by one user before the hang began. The thread does not show that Ctrl+C prevents or fixes the hang.
One commenter reported the hang on roughly 30 to 40 percent of commands on macOS and suspected that incomplete or mismatched terminal output breaks command completion detection. This is an unconfirmed hypothesis, not a fix.
General advice: limit command output (for example with
head) and avoid sending long log dumps through the agent.Did this work for you?What @antifragileer tried on GitHub (Worked)
Pressed Ctrl+C to stop a backtest's console output, then ran
exiton all open terminals and restarted VS Code. Commands worked again after all terminals were exited.Source: https://github.com/cline/cline/issues/3187#issuecomment-2840456479 (opens external site)
Did this work for you?What @antifragileer tried on GitHub (Partly worked)
Ran
exiton all shells and restarted the IDE after the context filled from an unlimited log read. Cline stayed stuck until the task was reset to the last checkpoint.Source: https://github.com/cline/cline/issues/3187#issuecomment-2842590860 (opens external site)
Did this work for you?What @leword tried on GitHub (Partly worked)
Toggled between Plan and Act mode to re-enable the Resume Task button. Occasionally restarted VS Code, and sometimes force-quit it from Activity Monitor.
Source: https://github.com/cline/cline/issues/3187#issuecomment-2842910841 (opens external site)
Did this work for you?What @jeanibarz tried on GitHub (Outcome unclear)
Suggested that the hang comes from fragile command completion detection. Reproduced it by typing an extra character before a command, such as
dgit diff, which left Cline hung until the correct command was run manually.Source: https://github.com/cline/cline/issues/3187#issuecomment-2843516188 (opens external site)
Did this work for you?What @antifragileer tried on GitHub (Didn't work)
Reported that previous remediations stopped helping and the hang was happening on every command.
Source: https://github.com/cline/cline/issues/3187#issuecomment-2843647865 (opens external site)
Did this work for you?