Skip to content

Significant Zsh startup delay after adding gh copilot alias #9950

Open

Description

@aofei

Describe the bug

After adding eval "$(gh copilot alias -- zsh)" to my $HOME/.zshrc, I've noticed a significant slowdown in Zsh startup time. This severely impacts the terminal user experience, as every new session takes noticeably longer to become responsive.

Environment

  • gh --version: gh version 2.62.0 (2024-11-14)
  • Chip: Apple M4 Pro
  • Operating System: macOS 15.1.1 (24B2091)
  • Terminal Emulator: iTerm2 Build 3.5.10
  • Shell: zsh 5.9 (arm64-apple-darwin24.0)

Steps to reproduce the behavior

  1. Add eval "$(gh copilot alias -- zsh)" to $HOME/.zshrc.
  2. Observe the delay in shell startup time.

Expected vs actual behavior

recording.mov

Logs

N/A

Activity

  1. jtmcg commented on Nov 22, 2024

    @jtmcg
    Contributor

    Hey @aofei, thanks for bringing this up.

    To reproduce and get some insights, I modified the aliasing command a bit:

    eval "$(GH_DEBUG=api gh copilot alias -- zsh)" >> $HOME/.zshrc

    This showed me that, on startup, we are making an api call to https://api.github.com/repos/github/gh-copilot/releases/latest to check for the latest version of copilot. It looks like this call is happening at the beginning of every gh copliot command and is likely the cause of the latency. When there's a degraded api state, the booting of zsh, or any other terminal for that matter, will slow.

    Extension version checking is relatively new, and this is a known pain-point. The linked PR should provide a fix for this, I think 👍

    Relates to #9934

  2. added
    priority-2Affects more than a few users but doesn't prevent core functions
    gh-extensionrelating to the gh extension command
    and removed on Nov 22, 2024
  3. jtmcg commented on Nov 22, 2024

    @jtmcg
    Contributor

    Also, apparently we have a related issue in the gh-copilot repo

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

    bugSomething isn't workinggh-extensionrelating to the gh extension commandpriority-2Affects more than a few users but doesn't prevent core functions

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions