Skip to content

terminalprogress causes thousands of iTerm2 alerts #13896

Description

@nedbat

Using pytest 9.0.0 with iTerm2 3.6.5, my test suite caused thousands of alerts like this:

Image

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:

ITERM_PROFILE=Main
ITERM_SESSION_ID=w0t1p0:3DB6DF06-FE11-40C3-9A66-9E10A193A632

Is it too ad-hoc to detect one of these variables and default the plugin to off?

Activity

  1. bluetech commented on Nov 8, 2025

    @bluetech
    Member

    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.

  2. added 2 commits that reference this issue on Nov 8, 2025
    f2316b3
    c37e687
  3. daneah commented on Nov 12, 2025

    @daneah

    I believe this is still occurring in the 9.0.1 release.

  4. nedbat commented on Nov 12, 2025

    @nedbat
    ContributorAuthor

    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.

  5. daneah commented on Nov 12, 2025

    @daneah

    Aha! Of course, using tox here. Thanks @nedbat.

  6. ideallical commented on Nov 13, 2025

    @ideallical

    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.

  7. The-Compiler commented on Nov 13, 2025

    @The-Compiler
    Member

    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).

  8. nedbat commented on Nov 13, 2025

    @nedbat
    ContributorAuthor

    I can see this is getting messy, sorry. If we are exploring other environment variables, these are what I see that might be relevant:

    ITERM_PROFILE=Main
    ITERM_SESSION_ID=w0t0p0:A94E39A1-E88C-4541-A8A0-622A9990987B
    LC_TERMINAL_VERSION=3.6.5
    LC_TERMINAL=iTerm2
    TERM_FEATURES=T3LrMSc7UUw9Ts3BFGsSyHNoSxF
    TERM_PROGRAM_VERSION=3.6.5
    TERM_PROGRAM=iTerm.app
    TERM_SESSION_ID=w0t0p0:A94E39A1-E88C-4541-A8A0-622A9990987B
    TERM=xterm-256color-italic
    TERMINFO_DIRS=/Applications/iTerm.app/Contents/Resources/terminfo:/usr/share/terminfo
    
  9. The-Compiler commented on Nov 13, 2025

    @The-Compiler
    Member

    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.

  10. bluetech commented on Nov 13, 2025

    @bluetech
    Member

    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.

  11. bluetech commented on Nov 13, 2025

    @bluetech
    Member

    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.).

  12. nedbat commented on Nov 13, 2025

    @nedbat
    ContributorAuthor

    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

    Image
  13. 6 remaining items

  14. added a commit that references this issue on Nov 20, 2025
    2ffef56
  15. Carreau commented on Dec 1, 2025

    @Carreau
    Contributor

    I think this is fixed in ITerm 3.6.6

  16. 4censord commented on Dec 5, 2025

    @4censord

    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)

  17. Carreau commented on Dec 5, 2025

    @Carreau
    Contributor

    I belive if you look at https://iterm2.com/documentation-escape-codes.html

    To post a notification:
    
    OSC 9 ; [Message content goes here] ST
    
    

    and conemu,
    https://conemu.github.io/en/AnsiEscapeCodes.html#OSC_Operating_system_commands

    OSC 9; <another number>; ...
    

    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.

  18. The-Compiler commented on Dec 5, 2025

    @The-Compiler
    Member

    Kitty has this implemented properly since v0.39.0 (which is almost a year old now): kovidgoyal/kitty@9b9b313

  19. 4censord commented on Dec 5, 2025

    @4censord

    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!

  20. case commented on Jan 24, 2026

    @case

    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.

  21. webknjaz commented on Jan 26, 2026

    @webknjaz
    Member

    @case I imagine you mean this comment rust-lang/cargo#16506 (comment)?

  22. case commented on Jan 26, 2026

    @case

    @case I imagine you mean this comment rust-lang/cargo#16506 (comment)?

    Yes but the specific issue about the behavior in earlier iTerm versions (lots of single notifications) was discussed in the thread as well.

  23. added a commit that references this issue on Aug 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions