Agent terminal tool hangs forever on pwd with zero output (macOS zsh)

Where does the bug appear (feature/product)?

Cursor IDE

Describe the Bug

The Agent terminal tool never returns, even for pwd. The UI stays on Running with no stdout/stderr. I have to press Stop. Cursor’s integrated terminal (Ctrl+`) works normally.

This is not a long-running command problem. pwd should exit immediately.

Steps to Reproduce

  1. Open a local workspace on This Mac (not Cloud Agent)
  2. Start an Agent chat with High Fast
  3. Type pwd
  4. The agent replies, then shows Running Print current working directory with $ pwd
  5. No output appears. The tool stays Running until I stop it
    I reproduced this across several chats in the same hour.

Expected Behavior

Expected: pwd prints the cwd and the tool completes in milliseconds
Actual: empty output, infinite Running, Stop button stays active

Screenshots / Screen Recordings

Operating System

MacOS

Version Information

OS: macOS Darwin 25.6.0
Cursor: 3.18.25 stable (280eca2911f1774689696e5f1efa5a4f97a87af0)
VS Code: 1.128.0
Shell: zsh
Model: High Fast
Agent CLI: 2026.09.02-c22c1a3
When: 2026-09-03 19:45–19:49 CST

For AI issues: which model did you use?

This has nothing to do with the model, but I’m using Grok 4.6 High Fast.

For AI issues: add Request ID with privacy disabled

4e61c7a5-c823-4afa-b0a0-a2a5037b1d6e

Additional Information

~/.zshrc runs this on every non-VSCODE_RESOLVING_ENVIRONMENT shell:

eval “$(~/.local/bin/agent shell-integration zsh)”
A diagnostic that times zsh -il, zsh -i, and agent shell-integration zsh produced no output for 5+ minutes. That looks like a startup deadlock: Agent starts zsh → zshrc calls agent shell-integration → that never returns → pwd never runs.

Related: Guide: Fix Cursor Agent Terminal Hangs Caused by .zshrc. Those reports usually see command output but miss the completion signal. Here there is no output at all.

Does this stop you from using Cursor

Yes - Cursor is unusable

Every time it gets to the point of running the terminal tool, it just hangs. It has been stuck here waiting for a minute now.

After some analysis, I now know the cause:

After installing Cursor CLI (agent 2026.09.02-c22c1a3) and running agent install-shell-integration, the installer prepends this to ~/.zshrc:

eval "$(~/.local/bin/agent shell-integration zsh)"

That integration is meant for an interactive TTY (session recording, please-fix, Tab-to-agent). But the generated script also does this outside the [[ -t 0 ]] guard:

if [[ -z "$CURSOR_RECORD_SESSION" ]]; then
  export CURSOR_RECORD_SESSION=1
  exec ~/.local/bin/agent record
fi

The IDE Agent Shell tool starts a fresh zsh for every command. That zsh sources .zshrc, which synchronously runs agent shell-integration and can exec agent record. The Agent waits for the shell; the shell calls back into the Agent. Deadlock.

Repro

  1. Run agent install-shell-integration so the eval line is in ~/.zshrc
  2. Open a local workspace (This Mac, not Cloud Agent)
  3. In an Agent chat, run pwd
  4. The tool stays Running with no stdout/stderr until Stop. Sometimes it fails with Command failed to spawn: Aborted

Control: Cursor’s integrated terminal (Ctrl+) works. Only the Agent background shell hangs. pwd` should finish immediately.

Environment: macOS Darwin 25.6.0; Cursor 3.18.25 (280eca2911f1774689696e5f1efa5a4f97a87af0); VS Code 1.128.0; zsh; Agent CLI 2026.09.02-c22c1a3.

Ask

  1. Do not install shell integration on every zsh startup, or skip it in non-TTY / Agent shells (CURSOR_AGENT, COMPOSER_NO_INTERACTION)
  2. Keep exec agent record inside an interactive TTY check
  3. Time out and surface a clear error when Agent shell startup hangs, instead of infinite Running

Local workaround: return early at the top of .zshrc when those Agent env vars are set. The IDE Agent terminal works again; interactive terminals can keep CLI integration.