Conversation
|
@xai I created this draft PR to share what I have done so far. Since yesterday the authentication somehow fails, but I can't figure out why. Maybe you have some hints where to look at. But I think it is better if you can see what I have done so you can give me some suggestions to improve it. |
|
Thanks a lot @fipro78! I'll take a look! |
|
I just tested this branch (on linux). For me it works when using device code authentication! After starting the tool the first time, I ran Next, I tested the browser oauth flow and it seems that copilot picks a random port for the callback (as opposed to e.g. codex' |
|
Regarding the browser oauth flow: I found no (documented or undocumented) way to make it use a fixed port, so we can't do the I was still able to authenticate by following the flow until i get the "Firefox can’t connect to the server at 127.0.0.1:" problem in my browser, copied the full url from its location bar and then just ran One annoying thing is that copilot still asks whether to trust a directory on each start, but I'm sure there's a way around that. |
|
So regarding your authentication problem: Have you tried deleting the credentials from If that fixes it, I wonder wether parallel sessions, especially long running ones could be the problem. We had a lot of trouble with this for Claude in the past. |
EclipseSourceAI
left a comment
There was a problem hiding this comment.
Note
Autonomous AI review.
This review was done by an AI agent and therefore may contain mistakes. Feel free to ignore any comment you disagree with. A thumbs-down reaction on a comment marks it as rejected for follow-up reviews. Noting why in a reply helps, since replies are read too.
Resolving all AI comments does not lead to an automatic approval. A maintainer still needs to review and sign off on the overall architecture and design.
To get an updated review after pushing changes, a maintainer may re-request a review from this account.
Running in Eclipse Enclave, submitted via review-guard-mcp
Adds a copilot tool extension (draft, WIP). It installs @github/copilot through the shared npm helper and declares COPILOT_GITHUB_TOKEN as a gateway-injected credential for api.github.com and *.githubcopilot.com. It treats ~/.copilot/config.json as the shared auth file and adds a settings template, an allowlist and an enclave-help skill. Everything is spec-only except a no-op Go handler.
Main points for maintainers:
- Auth failures: Copilot CLI falls back to
GH_TOKEN/GITHUB_TOKEN. With the default github-cli feature, those env vars hold a placeholder that is never released to*.githubcopilot.com. That would also explain why device-code OAuth worked in the maintainer test. See the inline comment oncredentials. - Auth file scope:
config.jsonlikely holds more than auth. Because it is the shared auth file, any state Copilot writes there is shared across projects, and thefile_existssession check will pass after the first start even without a login. The planned folder-trust support depends on getting this right. Codex handles trust in itsentrypoint.d/setup.shbehindENCLAVE_YOLO. - Failing test:
go test ./internal/config/fails because the golden snapshots for copilot are missing. The README and thedocs/tools.mdentry are also missing. - Default image: maintainers should decide whether this ships in the default set or stays
defaultIncluded: falselike mistral-vibe until auth and the random OAuth callback port are settled.
enclave validate-extensions and make check-license-headers pass.
|
|
||
| credentials: | ||
| sources: | ||
| copilot-github-token: { env: [COPILOT_GITHUB_TOKEN] } |
There was a problem hiding this comment.
Copilot CLI falls back to GH_TOKEN/GITHUB_TOKEN when COPILOT_GITHUB_TOKEN is unset. With the default-enabled github-cli feature those vars hold a placeholder the gateway only swaps on github.com hosts (spec), so requests to *.githubcopilot.com go out with the raw ENCLAVE_SECRET_... value and the stored OAuth login is ignored. That would explain the auth failures from the description, try with GH_TOKEN/GITHUB_TOKEN unset in the container.
| "*.individual.githubcopilot.com": copilot-github-token | ||
| "*.business.githubcopilot.com": copilot-github-token | ||
| "*.enterprise.githubcopilot.com": copilot-github-token |
There was a problem hiding this comment.
Redundant, *.githubcopilot.com already matches subdomains at any depth (MatchNormalizedHost).
| providers: | ||
| - name: github | ||
| credentials: [copilot-github-token] | ||
| authFiles: [config.json] |
There was a problem hiding this comment.
Is config.json auth only? If Copilot also keeps state there (trusted folders, model, first-launch flags), file_exists passes after the first start without any login, and all of that gets shared across projects via the auth store. A json_pointer check on the token key would be accurate, and this also matters for the folder trust you want to add.
| passthroughPaths: [ | ||
| agents/, | ||
| copilot-instructions.md, | ||
| extensions/, | ||
| hooks/, | ||
| instructions/, | ||
| lsp-config.json, | ||
| mcp-config.json, | ||
| providers.json, | ||
| settings.json, | ||
| skills/] |
There was a problem hiding this comment.
Nit: trailing whitespace on each of these lines, and most new files lack a final newline. A block list like pi/opencode use reads better here.
There was a problem hiding this comment.
Missing from the tool checklist: extensions/tools/copilot/README.md (required per AGENTS.md), a row in docs/tools.md, and the golden snapshots. go test ./internal/config/ currently fails with read golden tool-copilot ... no such file or directory, regenerate with -update-golden.
| address=/#/ | ||
|
|
||
| # Copilot | ||
| server=/githubcopilot.com/8.8.8.8 |
There was a problem hiding this comment.
Redundant, the github.conf fragment included below already has githubcopilot.com (fragment).
There was a problem hiding this comment.
This only embeds BaseHandler, which tools.Resolve already returns for unregistered tools (registry). Drop go/ like mistral-vibe and pi. As is, cmd/enclave/tool_imports.go wasn't regenerated, so the package isn't linked anyway.
| @@ -0,0 +1,9 @@ | |||
| { | |||
| // Keep sessions local; this also disables remote control. | |||
There was a problem hiding this comment.
No other JSON template has comments, and JSON patches are merged with strict json.Unmarshal on the copied template (readJSONValue). Any patches/copilot/settings.json will fail with invalid character '/', so drop the comment (move it to the README).
| --- | ||
| name: enclave-help | ||
| description: Answer questions about Enclave by reading the bundled documentation | ||
| allowed-tools: Read, Glob, Grep |
There was a problem hiding this comment.
These are Claude's tool names. The codex/opencode/pi copies drop this line (codex), do the same here.
| enclave-install-npm-tool @github/copilot copilot Copilot | ||
| copilot --version No newline at end of file |
I will try tomorrow. But I used the approach with the environment variable and not oauth. Tested today a BYOK setup which worked fine. |
Using the env (with a restrictively scoped token) is probably the safer way. I wonder what the scope of the oauth token really is. I am going to poke around with it a bit to see if it is actually safe for enclave users to authenticate via oauth flow in copilot or if that would mean that someone who snatches the auth token can do write stuff on github. Hopefully that poking around won't get me banned ;) |
Oh ffs!!! Don't use oauth flows with copilot. That token is quite powerful: Especially the We should document how users should use copilot in enclave, i.e., what it actually needs as a minimum scope to function and the recommend the env approach you are using. We should still allow the oauth login method of course, because if users want to do dangerous things they should be able to, but we should make them aware of it. I am really a bit shocked right now that they would issue such a broad token for a simple Edit: github/copilot-cli#953. January. What in the world is wrong with people? In github/copilot-cli#953 (comment), they recommend using |
|
@xai In the network logs I see several entries like this: To verify if there is an issue with the token itself I started the container and connected to the shell like this: enclave --tool copilot shellThen I checked if the agent@e161878e6c43:/home/<user>/<project_folder>$ echo $COPILOT_GITHUB_TOKEN
ENCLAVE_SECRET_cf9b7e5b20bcc533596aeb389085357a46786066453e2b53If I change this to the real token value and not the enclave secret one, I can call The folder I also checked the entries in Is it possible that the resolving of the enclave secret is not working correctly in the copilot tool as I have it configured at the moment? |
|
@xai |
|
Thanks a lot for the update! I'll look into the secret release problem and get back to you. |
|
I can reproduce it.
With only This is a bit annoying of course. I guess we just have to hack our way around the check. I could imagine doing something like this (as an enclave core change): The placeholder would then be |
What it does
This PR adds GitHub Copilot CLI as supported tool profile.
Note that this PR is work in progress. I actually need some support in finishing the contribution. I would like to add the folder trust configuration and need some additional testing from others. The setup worked for me two days ago but suddenly the authentication does not work anymore. My token is correct and freshly created, so not sure if the newest CLI version had some changes or the company guidelines changed.
How to test
Follow-ups
Breaking changes
Review checklist