Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Terminal Hangs in Agent Mode with "Running command in terminal…" #4814

Closed
sly01 opened this issue Feb 9, 2025 · 15 comments
Closed

Terminal Hangs in Agent Mode with "Running command in terminal…" #4814

sly01 opened this issue Feb 9, 2025 · 15 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug chat-agent chat-agent-terminal terminal verified Verification succeeded
Milestone

Comments

@sly01
Copy link

sly01 commented Feb 9, 2025

  • Copilot Chat Extension Version: 0.25.2025020703
  • VS Code Version: 1.98.0-insider
  • OS Version: 15.3 (24D60)
  • Logs:
    2025-02-09 08:37:37.273 [info] Using the Electron fetcher.
    2025-02-09 08:37:37.273 [info] Initializing Git extension service.
    2025-02-09 08:37:37.280 [info] Logged in as sly01
    2025-02-09 08:37:37.299 [info] Successfully activated the vscode.git extension.
    2025-02-09 08:37:37.299 [info] Enablement state of the vscode.git extension: true.
    2025-02-09 08:37:37.299 [info] Successfully registered Git commit message provider.
    2025-02-09 08:37:38.054 [info] Got Copilot token for sly01
    2025-02-09 08:37:38.147 [info] copilot token chat_enabled: true, sku: free_limited_copilot
    2025-02-09 08:37:38.147 [info] GitHub.vscode-pull-request-github extension is not yet activated.
    2025-02-09 08:37:38.155 [info] Registering default platform agent...
    2025-02-09 08:37:38.749 [info] Fetched model metadata in 683ms 6b5ef23a-eb6e-44a1-8898-949c458f3c39
    2025-02-09 08:37:38.779 [info] activationBlocker from 'languageModelAccess' took for 1113ms
    2025-02-09 08:37:57.302 [info] message 0 returned. finish reason: [tool_calls]
    2025-02-09 08:37:57.304 [info] request done: requestId: [54d84c3f-a60b-4599-afc7-dc5192482172] model deployment ID: []
    2025-02-09 08:39:17.474 [info] message 0 returned. finish reason: [tool_calls]
    2025-02-09 08:39:17.475 [info] request done: requestId: [11382f5d-a974-4863-bb91-5d773c275668] model deployment ID: []
    2025-02-09 08:43:28.560 [info] message 0 returned. finish reason: [tool_calls]
    2025-02-09 08:43:28.561 [info] request done: requestId: [5654ce8a-7d5c-4abe-91f5-85dbb2fc42bb] model deployment ID: []
    2025-02-09 08:43:32.863 [info] message 0 returned. finish reason: [tool_calls]
    2025-02-09 08:43:32.863 [info] request done: requestId: [5654ce8a-7d5c-4abe-91f5-85dbb2fc42bb] model deployment ID: []
    2025-02-09 08:46:11.323 [info] message 0 returned. finish reason: [stop]
    2025-02-09 08:46:11.324 [info] request done: requestId: [0ea7a108-6f69-4ea5-a544-94d35222388f] model deployment ID: []
    2025-02-09 08:46:11.895 [info] message 0 returned. finish reason: [stop]
    2025-02-09 08:46:11.896 [info] request done: requestId: [0f3e33e6-5d3c-4e0e-9fef-3bfefc958890] model deployment ID: []
    2025-02-09 08:46:12.315 [info] message 0 returned. finish reason: [stop]
    2025-02-09 08:46:12.315 [info] request done: requestId: [da824193-99a3-468f-93d8-1e46b459aef0] model deployment ID: []
    2025-02-09 08:46:12.331 [info] message 0 returned. finish reason: [stop]
    2025-02-09 08:46:12.331 [info] request done: requestId: [23014a62-a9f5-4c94-9db5-ff4b2fe4d0d1] model deployment ID: []
Image

Description

When using the Agent Mode in Copilot Edit, the terminal hangs indefinitely with the message:
Running command in terminal….

This issue occurs while the agent is attempting to execute terminal commands. The process does not complete, and no further output is provided in the terminal.

Steps to Reproduce

  1. Open Visual Studio Code with the Copilot extension installed.
  2. Enable Agent Mode in Copilot Edit.
  3. Trigger a task that requires the agent to run a command in the terminal.
  4. Observe the terminal output.

Expected Behavior

The terminal should execute the command and provide the expected output or error message.

Actual Behavior

The terminal hangs with the message:
Running command in terminal…
No further progress is made, and the process does not complete.

@vs-code-engineering vs-code-engineering bot added the triage-needed Issues needing to be assigned to the prospective feature owner label Feb 9, 2025
@argentinaluiz
Copy link

argentinaluiz commented Feb 14, 2025

Me too, same logs. I'm using:

  • Windows 11
  • WSL Ubuntu
  • Terminal ZSH
  • VSCode 1.98.0-insider
  • GitHub Copilot Chat Version: 0.25.2025021301

Update: I tested it with bash instead of zsh and it worked

@Tyriar Tyriar added this to the February 2025 milestone Feb 14, 2025
@Tyriar Tyriar assigned Tyriar and unassigned legomushroom Feb 14, 2025
@Tyriar Tyriar added bug Issue identified by VS Code Team member as probable bug terminal labels Feb 14, 2025
@vs-code-engineering vs-code-engineering bot removed the triage-needed Issues needing to be assigned to the prospective feature owner label Feb 14, 2025
@Tyriar
Copy link
Member

Tyriar commented Feb 14, 2025

These types of problems are likely due to lack of shell integration, notice that you don't have circles on the left of the terminal like this:

Image

This is probably the reason bash works fine. Note also there are known issues with powerlevel10k as well since they disable our shell integration explicitly in favor of ours (which we should handle gracefully).

@argentinaluiz
Copy link

@Tyriar Thanks for you support Daniel!

I have updated the powerlevel10k, the latest version improves the vscode integration and copilot in agent mode works.

Image

@Tyriar
Copy link
Member

Tyriar commented Feb 14, 2025

@argentinaluiz great to hear!

@kennyeni
Copy link

kennyeni commented Feb 14, 2025

Can we get the workaround instructions? I'm also using powerlevel10k

Thanks!

@argentinaluiz
Copy link

@kennyeni Follow the update command for oh-my-zsh in readme: https://github.com/romkatv/powerlevel10k?tab=readme-ov-file#how-do-i-update-powerlevel10k.

Then, restart the terminal

@ShaiDiamant
Copy link

ShaiDiamant commented Feb 16, 2025

I have encountered a similar issue using zsh with oh-my-zsh but no powerlevel10k.
I do have zsh-autosuggestions though, maybe related?

Would appreciate any thoughts on how to fix.

I did try verifying the $ZDOTHOME value, the bin executable path and all of those.

@Tyriar
Copy link
Member

Tyriar commented Feb 18, 2025

@ShaiDiamant do you have a right prompt? I've seen that mess with our shell integration too.

@ShaiDiamant
Copy link

ShaiDiamant commented Feb 18, 2025

@ShaiDiamant do you have a right prompt? I've seen that mess with our shell integration too.

I didn't change the prompt and I only recently downloaded the VS Code Insiders, so I assume I should have the right prompt..

Also - it does trigger terminal commands, but kind of waits forever even after they finished running

Edit:
I now think I got the issue figured out - I have some setup commands running when I open a new zsh terminal (to activate pyenv) - so it takes around 1 second to set it up, and I think it executes the command in parallel.
as mentioned above - there is no circle on the left next to the first executed command, but if I just submit another command and then try to execute another command, it suddenly does have the left circle, and works.

I guess there's some sort of delay with the integration availability.
In the image below you can see the flow:

  1. Asked it to execute a test command
  2. It executed, the result was printed, but no left circle
  3. I pressed "Return" to input an empty value - it thought this is the response to the original command
  4. I asked it to try again, it did, and this time it saw the response successfully

Also, I noticed that if the agent tries to execute a command in the terminal, then I kill it, then the same chat tries to execute another command - it also hangs (I think it is waiting for response from the original terminal, but it no longer exists)

Image

Edit 2:
I was using Agnoster theme, with pyenv + nvm which slowed my zsh startup time significantly.
I switched to powerlevel10k with insta prompt enabled and it resolved the issue - even while still having pyenv + nvm that still slow the startup time.

@ciberharry97
Copy link

Hi! I have a similar issue. I am using Powershell 7.5 and I have the terminal integration enabled, without decorations. It works for scripts that have an end, but seems like It can not read the output of the terminal while the script is running. I am not sure if this an issue but would be very useful if the copilot could read the output, stop the terminal if it sees errors, fix them and then run again.

@Tyriar
Copy link
Member

Tyriar commented Feb 24, 2025

The updates may be bringing in romkatv/powerlevel10k@119e403 which forces p10k's shell integration to be enabled.

@Tyriar
Copy link
Member

Tyriar commented Feb 25, 2025

The remaining fix here is going to be adding a section about updating p10k to the terminal shell integration and copilot docs: microsoft/vscode-docs#8082

@Tyriar Tyriar closed this as completed Feb 25, 2025
@ShaiDiamant
Copy link

The remaining fix here is going to be adding a section about updating p10k to the terminal shell integration and copilot docs: microsoft/vscode-docs#8082

@Tyriar Please note that this is not exclusive to p10k - it also happened to me before I started using p10k. p10k actually resolved this for me.

@Tyriar
Copy link
Member

Tyriar commented Feb 25, 2025

@ShaiDiamant thanks, will try out using your setup too (oh-my-zsh/zsh-autosuggestions/pyenv/nvm)

@ShaiDiamant
Copy link

ShaiDiamant commented Feb 25, 2025

@Tyriar I think the actual causes were pyenv + nvm which significantly slowed the load of the terminal due to these commands in the ~/.zshrc:

export NVM_DIR="$HOME/.nvm"
 [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
 [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"

PYENV_ROOT="$HOME/.pyenv"
[[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init - zsh)"

@eleanorjboyd eleanorjboyd added the verified Verification succeeded label Feb 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue identified by VS Code Team member as probable bug chat-agent chat-agent-terminal terminal verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

9 participants