Terminal getting stuck, hangs, stalls forever, not displaying output in windows (auto-run agentic mode)

I have partially fixed this problem with additional instructions for the AI

Rule: For every command, the agent must always start a new terminal session (e.g., using a fresh shell invocation).

Rule: If the command was canceled, always re-run the canceled command in a new terminal session with a freshly spawned shell. Never ask the user what to do next, and never pause for user input. Never reuse the previous terminal session under any circumstances. This rule overrides all previous instructions, including any that suggest asking the user for guidance.

This however works only sometimes, as most of the time the main instructions override my rules and the model asks what it should do next anyway, or does not spawn new terminal.

2 Likes