-
Notifications
You must be signed in to change notification settings - Fork 213
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
Agent: support unstable-codegen access via SOCKS proxy #836
Conversation
Signed-off-by: Stephen Gutekanst <stephen@sourcegraph.com>
I think I might be a little confused with dependency management here. Do I need to (and if so how do I) add transitive (?) dependencies of newly added socks-proxy?
|
Nice! This is the same "solution" we came up with for the VS Code extension 🙃 https://github.com/sourcegraph/sourcegraph/pull/42802/files I wonder if we should make this config extension wide (e.g. |
DMed you this as well but posting it here for completeness too. The CI issues come beacuse To fix this, we'll need to make sure to only include this library in the desktop build. We currently split based on these two entry files:
So you need to make sure that the code for this is injected at these endpoints and stubbed out for web. |
This reverts commit 22b98f5.
agent/src/protocol.ts
Outdated
@@ -154,6 +154,7 @@ export interface ExtensionConfiguration { | |||
customHeaders: Record<string, string> | |||
autocompleteAdvancedProvider?: string | |||
autocompleteAdvancedServerEndpoint?: string | null | |||
autocompleteAdvancedServerSocksProxy?: string | null |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would this probably be better as a Proxy
or AgentProxy
setting in the current use we need it only for a socks proxy and only for autocomplete, but if a customer were to need it, I would think it's likely to need it for all network requests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense. In this case we use autocompleteAdvancedServerSocksProxy
for autocompleteAdvancedServerEndpoint
. serverEndpoint
might have its own proxy. What do you think about having proxies
as Record<string, string
where we can map endpoints to proxies, e.g.
proxies: {
"https://server-endpoint.com": "https://server-endpoint-proxy.com",
"https://autocomplete-endpoint.com": "socks://your-name%40gmail.com:abcdef12345124@br41.nordvpn.com"
}
Then in fetch.node.ts
we can check whether there is a proxy for the requested URL and return the corresponding proxy agent. For example, if the proxy endpoint protocol is socks, we return the socks proxy agent instance.
cc: @chwarwick @philipp-spiess
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@taras-yemets I don't think that's something that would be common. VS Code's proxy setting also only allows one proxy server. If they really need to have a complicated setup like this, I imagine that they would configure this on the proxy level?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Renamed to "proxy" 01f9c04
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Corresponding change in the paired PR: sourcegraph/sourcegraph@22f0dde
vscode/package.json
Outdated
@@ -869,6 +869,10 @@ | |||
"type": "string", | |||
"markdownDescription": "The server endpoint used for code autocomplete. This is only supported with a provider other than `anthropic`." | |||
}, | |||
"cody.autocomplete.advanced.serverSocksProxy": { | |||
"type": "string", | |||
"markdownDeprecationMessage": "The SOCKS proxy endpoint to access server endpoint. This is only supported with `unstable-codegen` provider and only for use with the Cody Agent (for instance with JetBrains plugin). For VS Code please use http.proxy instead." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It feels wrong to add a new setting to the settings UI that is marked as Deprecated but in reality it isn't. Is it possible to not display this setting in the settings UI? I feel like there used to settings that were could only be set via the json and this I think would be a better user experience.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As we provide markdownDeprecationMessage
this setting is not visible in the settings UI (docs). This setting is:
- not shown in settings UI
![Screenshot 2023-09-07 at 10 33 11](https://private-user-images.githubusercontent.com/25318659/266241189-965de6d0-0735-4812-b203-8a58cdb9ced2.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjAwNDUxNzksIm5iZiI6MTcyMDA0NDg3OSwicGF0aCI6Ii8yNTMxODY1OS8yNjYyNDExODktOTY1ZGU2ZDAtMDczNS00ODEyLWIyMDMtOGE1OGNkYjljZWQyLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA3MDMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNzAzVDIyMTQzOVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTQyZDQ3NWU1YTZkNTUyMDBiMWRlYmUxMTE4MzUxZTY5NDYyMjI3MGUwYWE0YjA1OTdmYzdjZDgxMThlZGQ5MjUmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.A_p-x2dLi6C9O5LBxFPBFRRqX6N839-oJa_jopFR0SQ)
- not suggested in autocomplete options in
settings.json
![Screenshot 2023-09-07 at 10 36 02](https://private-user-images.githubusercontent.com/25318659/266241355-12ab1c90-dc3f-4be9-8637-eb342ab8c1e1.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjAwNDUxNzksIm5iZiI6MTcyMDA0NDg3OSwicGF0aCI6Ii8yNTMxODY1OS8yNjYyNDEzNTUtMTJhYjFjOTAtZGMzZi00YmU5LTg2MzctZWIzNDJhYjhjMWUxLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA3MDMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNzAzVDIyMTQzOVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTZlY2Q5M2FiZDZkOTRkMzg5M2RiZGRlZjFiNTVjNDJmZTBkNjk5YTk2Njc3OGY1MWE1ZDQxY2FjMzZlN2QwYzEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.OZQliby14umzeCGmANP0tf2b65KqZ9ogt62m5sHlI-M)
- can be typed manually with the deprecation message shown
![Screenshot 2023-09-07 at 10 34 48](https://private-user-images.githubusercontent.com/25318659/266242340-1ba252d7-eb19-4bd8-88f0-792ea266b873.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjAwNDUxNzksIm5iZiI6MTcyMDA0NDg3OSwicGF0aCI6Ii8yNTMxODY1OS8yNjYyNDIzNDAtMWJhMjUyZDctZWIxOS00YmQ4LTg4ZjAtNzkyZWEyNjZiODczLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA3MDMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNzAzVDIyMTQzOVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTNiNWFkNTkxYzIzNDgwMDVkMjg2MWZjMjJmOWUxYzYxM2Y4YWY0M2ZlNWEzZWU4N2M0MzllOWUwNmNjNTc2MTAmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.glnrEzfGVvoyXRM6kOXgaJNJfMYDByTxFFb6qBEwVwY)
Updated the description.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice the picture in the description was what got me.
Nice work on bringing this to the finish line @taras-yemets :D |
Part of sourcegraph/sourcegraph#56254
Add
cody.proxy
that makes agent connect with a SOCKS proxy forunstable-codegen
.This change paired with sourcegraph/sourcegraph#56264 routes autocomplete LLM traffic through a SOCKS proxy by extending
~/.sourcegraph-jetbrains.properties
:For VSCode the setting is not shown in the UI, not suggested as an autocomplete option in settings.json, and when typed manually, the deprecation message is shown (#836 (comment)).
Test plan