Agent mode hangs when executing shell commands in K8s container

Agent mode hangs when executing commands in K8s container (echo / python / ls)

Where does the bug appear (feature/product)?

Cursor IDE (K8s plugin, Agent mode)

Describe the Bug

Hi Cursor team,

I encountered an issue when using Agent mode in Cursor with a Kubernetes container via the K8s plugin.

When executing commands in Agent mode, the terminal hangs and never returns.

This issue only occurs in the K8s container environment. In the host environment, Agent mode works normally. Plans mode also works normally in the same container environment.

Additionally, when enabling Ask Any Time in Agent mode, no popup appears and there is no response.

Issue

When executing the following commands in Agent mode:

  • echo 123
  • python -c “print(‘123’)”
  • ls

The following happens:

  • Shows “Waiting for output”
  • The terminal never returns
  • No output is produced
  • No error message is shown

Steps to Reproduce

  1. Open Cursor IDE

  2. Using Remote SSH to connect (anysphere.remote-ssh, 1.0.46)

  3. Connect to a Kubernetes container using the K8s plugin ( anysphere.remote-containers, Version

    1.0.32) dev containers: attaching to running k8s container

  4. Enter Agent mode

  5. Let the Agent execute a command, e.g. echo 123

  6. Let the Agent execute a command,

python -c “import torch, time; x=torch.zeros((8*10243)).cuda(); exec('while True: print((x2).sum(), time.sleep(0.1))')”

Expected Behavior

  • Commands should execute normally
  • Output should be returned
  • Ask Any Time should show a popup
  • GPU workload should be triggered when running CUDA code (observable via nvidia-smi)

Actual Behavior

  • Stuck at “Waiting for output”
  • No output
  • No error
  • Ask Any Time does not appear
  • watch nvidia-smi, doesn’t change

Environment

Model

I tested with composer 2, composer 2 fast, and grok 4.2 — all show the same behavior. This issue does not appear to be model-related.

Curosr About Help

Version: 2.6.20 (system setup)
VSCode Version: 1.105.1
Commit: b29eb4ee5f9f6d1cb2afbc09070198d3ea6ad760
Date: 2026-03-17T01:50:02.404Z
Build Type: Stable
Release Track: Default
Electron: 39.8.1
Chromium: 142.0.7444.265
Node.js: 22.22.1
V8: 14.2.231.22-electron.0
OS: Windows_NT x64 10.0.26200

Remote Host machine

cat /etc/os-release
PRETTY_NAME=“Ubuntu 22.04.2 LTS”
NAME=“Ubuntu”
VERSION_ID=“22.04”
VERSION=“22.04.2 LTS (Jammy Jellyfish)”
VERSION_CODENAME=jammy
ID=ubuntu
ID_LIKE=debian
HOME_URL=“https://www.ubuntu.com/”
SUPPORT_URL=“https://help.ubuntu.com/”
BUG_REPORT_URL=“https://bugs.launchpad.net/ubuntu/”
PRIVACY_POLICY_URL=“https://www.ubuntu.com/legal/terms-and-policies/privacy-policy”
UBUNTU_CODENAME=jammy

Container

cat /etc/os-release
PRETTY_NAME=“Ubuntu 24.04.1 LTS”
NAME=“Ubuntu”
VERSION_ID=“24.04”
VERSION=“24.04.1 LTS (Noble Numbat)”
VERSION_CODENAME=noble
ID=ubuntu
ID_LIKE=debian
HOME_URL=“https://www.ubuntu.com/”
SUPPORT_URL=“https://help.ubuntu.com/”
BUG_REPORT_URL=“https://bugs.launchpad.net/ubuntu/”
PRIVACY_POLICY_URL=“https://www.ubuntu.com/legal/terms-and-policies/privacy-policy”
UBUNTU_CODENAME=noble
LOGO=ubuntu-logo

Container environment: Ubuntu 24.04.1 LTS
Shell: bash

System info:

cat /etc/os-release

PRETTY_NAME=“Ubuntu 24.04.1 LTS”
VERSION_ID=“24.04”

Shell info:

which sh
/usr/bin/sh

which bash
/usr/bin/bash

echo $SHELL
/bin/bash

Additional Notes

  • Commands run normally when executed directly inside the container terminal
  • Agent mode works normally on the host machine
  • Plans mode works normally in the container
  • The issue only occurs with Cursor Agent mode in the K8s container

Impact

This issue prevents Agent mode from executing any commands inside the Kubernetes container and blocks normal development workflows

Hi there!

We detected that this may be a bug report, so we’ve moved your post to the Bug Reports category.

To help us investigate and fix this faster, could you edit your original post to include the details from the template below?

Bug Report Template - Click to expand

Where does the bug appear (feature/product)?

  • Cursor IDE
  • Cursor CLI
  • Background Agent (GitHub, Slack, Web, Linear)
  • BugBot
  • Somewhere else…

Describe the Bug
A clear and concise description of what the bug is.


Steps to Reproduce
How can you reproduce this bug? We have a much better chance at fixing issues if we can reproduce them!


Expected Behavior
What is meant to happen here that isn’t working correctly?


Screenshots / Screen Recordings
If applicable, attach images or videos (.jpg, .png, .gif, .mp4, .mov)


Operating System

  • Windows 10/11
  • MacOS
  • Linux

Version Information

  • For Cursor IDE: Menu → About Cursor → Copy
  • For Cursor CLI: Run agent about in your terminal
IDE:
Version: 2.xx.x
VSCode Version: 1.105.1
Commit: ......

CLI:
CLI Version 2026.01.17-d239e66

For AI issues: which model did you use?
Model name (e.g., Sonnet 4, Tab…)


For AI issues: add Request ID with privacy disabled
Request ID: f9a7046a-279b-47e5-ab48-6e8dc12daba1
For Background Agent issues, also post the ID: bc-…


Additional Information
Add any other context about the problem here.


Does this stop you from using Cursor?

  • Yes - Cursor is unusable
  • Sometimes - I can sometimes use Cursor
  • No - Cursor works, but with this issue

The more details you provide, the easier it is for us to reproduce and fix the issue. Thanks!

Hey, thanks for the detailed report. This is a known type of issue. Agent terminal commands can hang on remote setups, especially with chained connections like SSH + a K8s container.

A few things to try:

  1. Enable Legacy Terminal Tool: Cursor Settings Ctrl+Shift+J > Agents > Inline Editing & Terminal > turn on Legacy Terminal Tool. Then run Ctrl+Shift+P > Terminal: Kill All Terminals and fully restart Cursor.

  2. Check shell availability in the container: In a similar setup, we’ve seen the agent fail with spawn zsh ENOENT because the container only has bash. Open Developer Tools Help > Toggle Developer Tools > Console while the command hangs and check for errors like that. If you see zsh ENOENT, set the terminal profile explicitly: Settings > search terminal.integrated.defaultProfile.linux > set to bash in the Remote scope.

  3. Check DevTools for errors: When the agent hangs on Waiting for output, open Help > Toggle Developer Tools > Console and share any red errors here. That’ll help narrow down the root cause.

The team is aware of this type of SSH and remote terminal hanging issue. Your report with the K8s container setup helps with prioritization since the double hop SSH + container is a less common path.

Related threads with similar symptoms:

Let me know how it goes with the Legacy Terminal Tool, and share the DevTools output if it still happens.

Hi Dean,

Thanks for the suggestions! After switching to the Legacy Terminal Tool, I did see some zsh-related errors in the console. Following your advice, I explicitly set the terminal profile to bash in the Remote scope, and now Agent mode works successfully in the K8s container.

Really appreciate the guidance!

1 Like