You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
terminalprogress causes thousands of iTerm2 alerts #13896
Using pytest 9.0.0 with iTerm2 3.6.5, my test suite caused thousands of alerts like this:
I understand I can disable this with -p no:terminalprogress, but it was alarming and others might not read through the detailed (thank you!) release notes. iTerm2 sets two environment variables:
I was aware of such a possibility but I thought it was fixed in iTerm, but looks like 3.6.5 is the latest version.
I think we can start with turning it off if ITERM_SESSION_ID is set (seems better than ITERM_PROFILE). We also discussed that if we get more reports like this then we'll disable the feature by default. But maybe we can get away with only special casing iTerm.
Reacted by Ned Batchelder and 🇺🇦 Sviatoslav Sydorenko (Святослав Сидоренко)
Do you have the ITERM_SESSION_ID environment variable set in your terminal? Are you running tests inside tox? If so, by default it doesn't pass through all the environment variables, you might need to set passenv for your test environment.
Ah great, I was going nuts with all these notifications popping up while running tests.
I tested with pytest==9.0.1 and I still get these notifications when running tests via docker, as I think, docker doesn't copy the ITERM_SESSION_ID env inside the containers.
When I do this:
ITERM_SESSION_ID=stop && py.test
then the notifications don't happen anymore.
I don't know whether this is an iTerm bug or pytest bug, I can only say that I find it strange to add an ITERM_SESSION_ID env to stop notifications when running tests. I'd advocate for an opt-in instead of an opt-out.
I wonder if looking at $TERM would be more useful, given that this is the "proper" (or at least originally intended) way to find out what terminal is running.
That would at least be passed through by tox by default, but I have no idea what Docker will do with it.
If that doesn't work out, my vote would still be for adding a config option and disabling this by default, maybe except on Windows (given that most users probably won't run a terminal emulator that supports it).
Okay, so TERM is not useful in this case, and the others are probably not passed through by tox/Docker (and possibly others). It's basically browser user agents all over again!
That being said, it looks like iTerm did fully implement support for the progress reporting two weeks ago, which already has a pre-release with v3.6.6beta2 (and beta 3 was released yesterday).
I don't know how iTerm's release roadmap looks like, but I'd be guessing that a v3.6.6 is around the corner. Then we'll need to think about either removing the disabling workaround again entirely, or making it conditional based on TERM_PROGRAM_VERSION maybe.
Alternatively we can try detecting iTerm2 by querying it directly. I found that iTerm2 supports a custom "DSR 1337" query sequence: https://iterm2.com/utilities/it2check. But dealing with terminals this way is messy (need to set tty mode and read from stdin etc.).
you see that conemu progress sequence is a subset of the "post a notification":
So kitty (or other terminal emulator are 'oh this is message' with content of 4;12..., instead of "this is a specific message that should just update progress"
Fwiw, there's a bit more context here from gnachman (iTerm's creator) - rust-lang/cargo#16506 - regarding a similar issue when we added OSC 9;4 support to Cargo.
Activity
bluetech commentedon Nov 8, 2025
I was aware of such a possibility but I thought it was fixed in iTerm, but looks like 3.6.5 is the latest version.
I think we can start with turning it off if
ITERM_SESSION_IDis set (seems better thanITERM_PROFILE). We also discussed that if we get more reports like this then we'll disable the feature by default. But maybe we can get away with only special casing iTerm.terminal: disable terminal progress plugin on iTerm2
terminal: disable terminal progress plugin on iTerm2
daneah commentedon Nov 12, 2025
I believe this is still occurring in the 9.0.1 release.
nedbat commentedon Nov 12, 2025
Do you have the ITERM_SESSION_ID environment variable set in your terminal? Are you running tests inside tox? If so, by default it doesn't pass through all the environment variables, you might need to set
passenvfor your test environment.daneah commentedon Nov 12, 2025
Aha! Of course, using
toxhere. Thanks @nedbat.ideallical commentedon Nov 13, 2025
Ah great, I was going nuts with all these notifications popping up while running tests.
I tested with
pytest==9.0.1and I still get these notifications when running tests via docker, as I think, docker doesn't copy the ITERM_SESSION_ID env inside the containers.When I do this:
then the notifications don't happen anymore.
I don't know whether this is an iTerm bug or pytest bug, I can only say that I find it strange to add an ITERM_SESSION_ID env to stop notifications when running tests. I'd advocate for an opt-in instead of an opt-out.
The-Compiler commentedon Nov 13, 2025
I wonder if looking at
$TERMwould be more useful, given that this is the "proper" (or at least originally intended) way to find out what terminal is running.That would at least be passed through by tox by default, but I have no idea what Docker will do with it.
If that doesn't work out, my vote would still be for adding a config option and disabling this by default, maybe except on Windows (given that most users probably won't run a terminal emulator that supports it).
nedbat commentedon Nov 13, 2025
I can see this is getting messy, sorry. If we are exploring other environment variables, these are what I see that might be relevant:
The-Compiler commentedon Nov 13, 2025
Okay, so
TERMis not useful in this case, and the others are probably not passed through by tox/Docker (and possibly others). It's basically browser user agents all over again!That being said, it looks like iTerm did fully implement support for the progress reporting two weeks ago, which already has a pre-release with v3.6.6beta2 (and beta 3 was released yesterday).
I don't know how iTerm's release roadmap looks like, but I'd be guessing that a v3.6.6 is around the corner. Then we'll need to think about either removing the disabling workaround again entirely, or making it conditional based on
TERM_PROGRAM_VERSIONmaybe.bluetech commentedon Nov 13, 2025
I'm thinking maybe we entirely disable it on macos for now, but probably it won't help @ideallical case which is using docker.
So I think we should disable it by default for now and reconsider in a year or two once iterm is updated.
I'll send a PR doing so for the 9.0.2.
bluetech commentedon Nov 13, 2025
Alternatively we can try detecting iTerm2 by querying it directly. I found that iTerm2 supports a custom "DSR 1337" query sequence: https://iterm2.com/utilities/it2check. But dealing with terminals this way is messy (need to set tty mode and read from stdin etc.).
nedbat commentedon Nov 13, 2025
One of the stranger aspects of this whole thing is that I've gotten used to this as a progress bar meaning the test suite is 88% done! :D
6 remaining items
terminal: disable OSC 9;4; terminal progress by default, except on Wi…
Carreau commentedon Dec 1, 2025
I think this is fixed in ITerm 3.6.6
4censord commentedon Dec 5, 2025
heya, i've been having the same problem with kitty.
setting the iterm variable does indeed fix this.
Is this something pytest needs to fix, or is on kitty?
If on kitty, what should I report to the kitty devs?
(i'm running pytest 9.0.1)
Carreau commentedon Dec 5, 2025
I belive if you look at https://iterm2.com/documentation-escape-codes.html
and conemu,
https://conemu.github.io/en/AnsiEscapeCodes.html#OSC_Operating_system_commands
you see that conemu progress sequence is a subset of the "post a notification":
So kitty (or other terminal emulator are 'oh this is message' with content of
4;12..., instead of "this is a specific message that should just update progress"ghostty-org/ghostty#3119 another example of this for another term emulator.
The-Compiler commentedon Dec 5, 2025
Kitty has this implemented properly since v0.39.0 (which is almost a year old now): kovidgoyal/kitty@9b9b313
4censord commentedon Dec 5, 2025
hmm, according to my distro packages, i'm running kitty 0.44.0-1
though kitty --version reports 0.20.3
ah f.... i found the issue, i still had a dev version of kitty in my path taking priority aa
ok, thanks for the help finding this!
case commentedon Jan 24, 2026
Fwiw, there's a bit more context here from
gnachman(iTerm's creator) - rust-lang/cargo#16506 - regarding a similar issue when we added OSC 9;4 support to Cargo.webknjaz commentedon Jan 26, 2026
@case I imagine you mean this comment rust-lang/cargo#16506 (comment)?
case commentedon Jan 26, 2026
Yes but the specific issue about the behavior in earlier iTerm versions (lots of single notifications) was discussed in the thread as well.
chore(deps): update pytest (major)
Merge branch 'renovate/pytest-9.x' into 'main'
🔒️ Update dependency pytest to v9 [SECURITY] (#16)
[SECURITY] Update dependency pytest to v9 [SECURITY] (#2)
Update dependency pytest to v9 (#35)