Terminal tool no longer inherits environment settings (venv, direnv)

Where does the bug appear (feature/product)?

Cursor IDE

Describe the Bug

After the latest Cursor update, the terminal tool called by the agent no longer inherits environment settings such as venv or direnv.

In previous versions, the terminal was executed directly in the project root with bash or zsh. This allowed the terminal tool to automatically load environment variables if direnv or similar tools were properly configured.

However, in the current version, the terminal seems to be launched in a different way, and now it requires explicitly activating venv or other environments. This breaks the expected workflow and reduces usability.

Steps to Reproduce

  1. Update Cursor to the latest version.
  2. Configure a project with venv or direnv.
  3. Use the agent to call the terminal tool.
  4. Observe that environment variables are not inherited.

Expected Behavior

The terminal tool should inherit the same environment settings as the default Cursor terminal, automatically recognizing venv, direnv, and other configurations without requiring explicit activation.

Operating System

Linux

Current Cursor Version (Menu → About Cursor → Copy)

バージョン: 1.6.27 (user setup)
コミット: 1.99.3
日付: d750e54bba5cffada6d7b3d18e5688ba5e944ad0
Electron: 2025-09-17T20:21:17.042Z
ElectronBuildId: 34.5.8
Chromium: undefined
Node.js: 132.0.6834.210
V8: 20.19.1
OS: 13.2.152.41-electron.0

Does this stop you from using Cursor

No - Cursor works, but with this issue

I’ve identified the root cause and the solution.

After the Cursor update, the shell launched by the command tool is now started as a non-interactive shell. In this mode, TERM=dump is set, and unlike before, zshrc is not sourced. Instead, only zshenv is loaded for non-interactive shells.

To resolve the issue, it needed to add:


eval "$(direnv hook zsh)"

to zshenv (not zshrc), so that environment variables are properly loaded even in non-interactive mode.

When running echo "Current PID: $$"; ps -p $$ -f via command tool, I got the following result:


/usr/bin/zsh -c snap=$(cat <&3); unsetopt aliases 2>/dev/null; unalias -m '*' 2>/dev/null || true; eval "$snap" && { export PWD="$(pwd)"; setopt aliases 2>/dev/null; eval "$1" < /dev/null; }; COMMAND_EXIT_CODE=$?; dump_zsh_state >&4; exit $COMMAND_EXIT_CODE -- echo "Current PID: $$"; ps -p $$ -f

This shows that the Cursor command tool is (rather intrusively) executing the specified command inside special command-wrapper. While this design likely improves security, it also interferes with features such as enabling a venv via direnv.

Because of this limitation, it may be necessary to downgrade to a Cursor version that doesn’t have this issue.

This topic was automatically closed 22 days after the last reply. New replies are no longer allowed.