microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
163.07k stars 28.8k forks source link

Chat API says message is too long in Codespaces #215590

Open burkeholland opened 3 months ago

burkeholland commented 3 months ago

Version: 1.91.0-insider Commit: 0da59bdde2339d6ba632524dc8f3fb6f4b8a2bcb Date: 2024-06-14T10:11:28.580Z Browser: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36 Edg/125.0.0.0

Steps to Reproduce:

  1. Create Codespace from https://github.com/burkeholland/chinook-pg-test
  2. Run ./install.sh to create and populate the chinook database
  3. Set the connection string for the @pg chat participant with @pg /conn postgres://postgres:postgres@localhost/chinook
  4. Ask the participant to show tables @pg /show - this will work - confirms connection string is set correctly.
  5. Ask the participant to list all artists @pg list all artists.

The participant will return the error message: "I can't find the schema for the database. Please check the connection string with /conn".

However, this doesn't appear to be the actual error. @brianrandell was able to narrow this down to the following error thrown in the @pg extension...

Image

Note that this works locally when run as a dev container.

isidorn commented 3 months ago

Thanks for opening this issue. This message is probably coming from the Copilot API endpoint, and it should not have an effect if you trigger the API locally or from a codespace. Are you sure the exact same request is sent? You could look at the logs to compare.

@jrieken also might have ideas.

jrieken commented 3 months ago

This is our message https://github.com/microsoft/vscode-copilot/blob/20820198e92136a74846aca82bde0c7d8f216367/src/extension/prompts/node/base/promptRenderer.ts#L53

fyi @joyceerhl

jrieken commented 3 months ago

Tho, it is odd that this only happens in codespaces. There are known issues with codespaces getting a bad auth token, maybe that's the actual issue and the error message is a misleading consequence

burkeholland commented 3 months ago

@isidorn oddly, I'm not seeing anything in the logs related to @pg. If I do a regular chat interaction, I do see the logs. But the @pg doesn't log anything anywhere as far as I can tell. Will speak to @robconery today about this.

pwang347 commented 3 months ago

For what it's worth, myself and a few others are seeing the same error from the latest samples: https://github.com/microsoft/vscode-extension-samples/issues/1046

I was able to repro it without using Codespaces, but just building the sample and running it locally. The same one was also working before I updated my Insiders to 1.91.0-insider.

roblourens commented 3 months ago

Doesn't this just mean that the pg participant sent the chat model a bad request?

isidorn commented 3 months ago

There are known issues with codespaces getting a bad auth token, maybe that's the actual issue and the error message is a misleading consequence

I hit this when I try to debug an extension inside a Codespace. For example:

  1. Open chat-sample in codespace
  2. Debug it -> new tab gets opened with my extension running
  3. Chat view wants to login but it can not 🐛

Should I open a separate issue for this? Or this might be what this issue is all about. @brianrandell is the scenario you are trying to achieve is develop and debug a local GH extension in a Codespace? Thanks!