Skip to content
This repository was archived by the owner on Oct 30, 2025. It is now read-only.
This repository was archived by the owner on Oct 30, 2025. It is now read-only.

[BUG]: eval "$(gh copilot alias -- bash)" takes 0.5 second to load #88

Open

Description

@yermulnik

What happened?

What did you do? What happened? What did you expect to happen?

eval "$(gh copilot alias -- bash)" took 0.5 sec to load (I'm the "User is not authorized to use this Copilot feature"). I'd expect it to load much faster as 0.5 sec is a way too slow.

Versions

What versions of the relevant software are you running?
For example: gh v2.37.0, gh-copilot v0.5.2-beta

  • gh version 2.52.0 (2024-06-24)
  • version 1.0.3 (2024-05-08)

Relevant terminal output

Please copy and paste any relevant terminal output.
Please check your output before submission to ensure sensitive information is redacted.

> time eval "$(gh copilot alias -- bash)"

real    0m0,611s
user    0m0,210s
sys     0m0,053s

and another workstation:

> time eval "$(gh copilot alias -- bash)"

real    0m0,548s
user    0m0,156s
sys     0m0,037s

Ubuntu and Mint if it matters.

Activity

  1. jarrodldavis commented on Nov 20, 2024

    @jarrodldavis

    I have the same issue using eval "$(gh copilot alias -- zsh)" on macOS. Strangely, the entire script to be evaluated is emitted instantly, it's just that the gh command takes a long time to exit.

  2. BagToad commented on Nov 20, 2024

    @BagToad
    Member

    I suspect this actually has more to do with gh startup time than the gh-copilot extension - see cli/cli#9724

    @yermulnik @jarrodldavis, could you try setting TCELL_MINIMIZE=1 and let us know if that improves the performance?

  3. jarrodldavis commented on Nov 20, 2024

    @jarrodldavis

    @BagToad That helped performance a bit, but only reduced from 0.11s to 0.07s (according to time). As I noted initially, the issue is after the script is emitted, suggesting that it's an issue with the exit time, not the startup time. Additionally, I notice this slow exit consistently across all gh copilot commands (even gh copilot --help), but the root gh command is fast.

  4. yermulnik commented on Nov 20, 2024

    @yermulnik
    Author
    > export TCELL_MINIMIZE=1
    > time eval "$(gh copilot alias -- bash)"
    
    real    0m1,250s
    user    0m0,167s
    sys     0m0,080s
    
    # second run
    > time eval "$(gh copilot alias -- bash)"
    
    real    0m1,116s
    user    0m0,120s
    sys     0m0,037s

    🤔

  5. BagToad commented on Nov 20, 2024

    @BagToad
    Member

    Ah, thanks for trying that out! Sounds like we have more investigating to do 😁

  6. pmeheut commented on Jan 16, 2025

    @pmeheut

    Same problem here and even slower in my good old Macpro: 1.7 sec. Ok, it is only a 12 core 3.3 Ghz Xeon but still: nothing it that slow.

    In the meantime, I've decided to cache it each day, commenting the line out and adding this to my .bashrc:

    # Define the path to the .ghrc file
    GHRC_PATH="$HOME/.ghrc"
    
    # Check if the file exists and is older than 1 day
    if [[ ! -f "$GHRC_PATH" || $(find "$GHRC_PATH" -mtime +0 -print) ]]; then
      echo "Updating .ghrc file..."
      gh copilot alias -- bash > "$GHRC_PATH"
    fi
    
    # Evaluate the content of the .ghrc file
    if [[ -f "$GHRC_PATH" ]]; then
      echo "Evaluating .ghrc file..."
      source "$GHRC_PATH"
    else
      echo "Error: .ghrc file not found after update."
      exit 1
    fi
    
  7. GriwMF commented on Jan 18, 2025

    @GriwMF

    Have the same issue with bash in Arch under wsl

    ~ $ time eval "$(gh copilot alias -- bash)"
    
    real    0m1.267s
    user    0m0.052s
    sys     0m0.040s
    
    ~ $ export TCELL_MINIMIZE=1
    ~ $ time eval "$(gh copilot alias -- bash)"
    
    real    0m1.253s
    user    0m0.075s
    sys     0m0.028s
    ~ $
    

    As a temporary fix I did
    gh copilot alias -- bash > .bash_copilot_aliases
    and then loaded it in my .bashrc

    # load .bash_copilot_aliases if it exists
    if [ -f ~/.bash_copilot_aliases ]; then
        . ~/.bash_copilot_aliases
    fi
    
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 workingneeds-triageneeds to be reviewed

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions