If I start a fresh chat and ask to run echo $CI, I see it has value 1.
This affects my code as I rely on a CI env var (but I don’t set it anywhere in my env files). CI is a common env var name used by CI systems, hence why I consider this a bug.
I checked an older version of Cursor, and that’s not the case, the CI variable is not set. Here is that version which doesn’t have that issue:
In a normal terminal in Cursor, echo $CI prints nothing.
I don’t have CI set in my shell profile .zshrc. Running env -u CI zsh -i -c ‘echo CI=$CI’ prints CI= (unset var), whether I run this myself or ask the Cursor chat to run it for me. (This command confirms I’m not setting CI anywhere in my shell profile or any files imported by it)
Can confirm, I am also seeing this in recent builds of Cursor for macOS. It’s annoying for me because my team has special, CI-specific configuration in our test suite that only activates when the CI env var is present. Because Cursor now sets that var in its environment, when it runs its tests, it often gets tripped up because the test suite now believes it is being run in CI, when really it’s being run locally, and so it doesn’t have access to the rest of the environment that is only present in CI.
This is also causing problematic beahvior for me as well. I added a workaround by creating a cursor rule to always include unset CI in the problematic commands, but it feels like setting the CI env var will cause a lot of unexpected issues.
I would really love it if cursor provided more transparency and user control over which env vars are set by the cursor agent (ideally via settings.json so it can be source controlled for a repo). In many cases I’ve found that cursor is behaving very differently in the agent vs when I just run commands locally in my own shell. Having visibility into what env vars might be causing those problems feels very important and like low-hanging fruit.