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

[Bug] Inconsistent passing of local file context #24

Open
garrmark opened this issue Jan 31, 2025 · 9 comments
Open

[Bug] Inconsistent passing of local file context #24

garrmark opened this issue Jan 31, 2025 · 9 comments
Labels
bug Something isn't working github team Feedback for the GitHub team for any issues across all extensions

Comments

@garrmark
Copy link

Describe the bug
When I run the copilot-extensions/rag-extension example and capture the request coming from copilot chat running in vscode, it properly shows my current file and selection. When I switch my vscode to another repo (private in this case), if doesn't pass the current file or selection.

To Reproduce
Steps to reproduce the behavior:

  1. run the rag-extension go repo ( https://github.com/copilot-extensions/rag-extension ) locally
  2. open the repo in vscode, open chat, select my @cl-rag-extension extension and make sure a file shows in the context, send a test message
  3. dump the request that comes into the extension
  4. see that it works correctly
  5. switch vscode to a java repo, make sure a java source file is selected and send another test message
  6. see that no file is sent

Expected behavior
I'm expecting all source files to be sent to my extension.

I have the correct permissions set and there are no files excluded in github.

Desktop (please complete the following information):

  • OS: Ubuntu 22.04.5 LTS - running on wsl2 on windows 11
  • VSCode 1.96.4
  • github.copilot plugin 1.261.0
  • github.copilot-chat plugin 0.23.2

Additional context
Message payload for step 4 (file sent):

{
    "messages": [
        {
            "role": "user",
            "content": "test",
            "copilot_references": [
                {
                    "data": {
                        "content": "my setup.sh content",
                        "language": "shellscript"
                    },
                    "id": "setup.sh",
                    "is_implicit": true,
                    "metadata": {
                        "display_icon": "",
                        "display_name": "",
                        "display_url": ""
                    },
                    "type": "client.file"
                },
                {
                    "data": {
                        "content": "my selection",
                        "end": {
                            "col": 0,
                            "line": 8
                        },
                        "start": {
                            "col": 0,
                            "line": 7
                        }
                    },
                    "id": "setup.sh",
                    "is_implicit": true,
                    "metadata": {
                        "display_icon": "",
                        "display_name": "",
                        "display_url": ""
                    },
                    "type": "client.selection"
                },
                {
                    "data": {
                        "id": 846765777,
                        "name": "rag-extension",
                        "ownerLogin": "copilot-extensions",
                        "refInfo": {
                            "name": "",
                            "type": ""
                        },
                        "type": "repository"
                    },
                    "id": "copilot-extensions/rag-extension",
                    "is_implicit": false,
                    "metadata": {
                        "display_icon": "",
                        "display_name": "",
                        "display_url": ""
                    },
                    "type": "github.repository"
                }
            ]
        }
    ],
    "model": "gpt-3.5-turbo",
    "stream": true
}

Message payload for step 6 (no file sent):

{
    "messages": [
        {
            "role": "user",
            "content": "test",
            "copilot_references": [
                {
                    "data": {
                        "type": "github.repository"
                    },
                    "id": "9001220f-416b-46f3-a466-6a7db40f267c",
                    "is_implicit": false,
                    "metadata": {
                        "display_icon": "",
                        "display_name": "",
                        "display_url": ""
                    },
                    "type": "github.redacted"
                }
            ]
        }
    ],
    "model": "gpt-3.5-turbo",
    "stream": true
}
@garrmark garrmark added the bug Something isn't working label Jan 31, 2025
@garrmark garrmark changed the title [Bug] Inconsistent passing of local file context [Bug] [github team] Inconsistent passing of local file context Jan 31, 2025
@garrmark garrmark changed the title [Bug] [github team] Inconsistent passing of local file context [Bug] Inconsistent passing of local file context Jan 31, 2025
@garrmark
Copy link
Author

Removing and re-adding the extension in our org and logging out and back into vscode fixed the issue, not idea why.

@garrmark
Copy link
Author

garrmark commented Feb 6, 2025

I'm re-opening this issue, my workaround above doesn't seem to reliably work. It's frustrating because there's no indication that the file content isn't being sent and no re-prompting for permissions.

@garrmark garrmark reopened this Feb 6, 2025
@garrmark
Copy link
Author

garrmark commented Feb 6, 2025

I think this is similar to #22 and:

For posterity, it seems like it was a permissions issue with VS Code. I somehow got it to trigger the "allow workspace access to extension" by forcing an error in the extension?

Image

And here's the additional information VS Code provided - code.visualstudio.com/docs/copilot/copilot-chat#_extensioncontributed-chat-participants

Still no idea how to reliably trigger the VS Code prompt though... 😅

I filed this instead:

@garrmark
Copy link
Author

garrmark commented Feb 6, 2025

@D1M1TR10S and @nhu-do I see you contributed to the https://github.com/copilot-extensions/user-feedback#feedback-to-the-github-product-team instructions.

I'm unable to add the "github team" label but think this needs to be seen by the team. Thank you.

@nhu-do nhu-do added the github team Feedback for the GitHub team for any issues across all extensions label Feb 6, 2025
@nhu-do
Copy link
Contributor

nhu-do commented Feb 6, 2025

Hi @garrmark, thanks for reaching out. Can you confirm whether you've provided the @cl-rag-extension extension with the permissions to access your private repo? By design, extensions are only able to access repos that you (or your org admin) have provided explicit permissions for.

@garrmark
Copy link
Author

yes @nhu-do I have. I have gotten it to pass the file in both vscode and visual studio, but it isn't consistent. Sometimes it works until I open a new chat and then stops working. Sometimes I can get it to work again by some combo of removing/reinstalling the extension and logout/login. Sometimes nothing I do seems to work.

@nhu-do
Copy link
Contributor

nhu-do commented Feb 12, 2025

Thanks for verifying @garrmark! Based on the missing information in message payload 6, this might be an issue with how VS Code is identifying your repository. Rather than sending your repo as the id, it is sending some UUID which prevents the platform from doing proper hydration of the repo data. This may also explain your inconsistent experience as well.

@isidorn, can you look into this issue?

@isidorn
Copy link
Collaborator

isidorn commented Feb 13, 2025

Maybe @roblourens has an idea. Though it might be best to just file this issue here (or move it) https://github.com/microsoft/vscode-copilot-release

And then we can investigate on the vscode side.

@garrmark
Copy link
Author

Thanks @isidorn I filed a bug over there too microsoft/vscode-copilot-release#5166

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working github team Feedback for the GitHub team for any issues across all extensions
Projects
None yet
Development

No branches or pull requests

3 participants