Repository navigation
Conversation
While the daemon runs without its loopback proxy, the programs behind it used to remove their managed entries. For VS Code on GitHub's models that removes the CAPI override, so Copilot Chat talks to GitHub directly, past the gateway. llmGateway.whenProxyUnavailable now decides, for programs.copilot and programs.vscode (both chatLanguageModels.json and the settings.json override): - failClosed (default): the managed entries are left as they are, so the tools stay pointed at the closed loopback port and fail; the program is inactive with FAIL_CLOSED_REASON. - failOpen: the entries are removed as before (PROXY_ABSENT_REASON). Program removal, ownModels/githubModels switches, useLlmGateway: false and a missing proxyUrl remove as before. The next apply with the proxy writes the current entries. Older daemons and controllers reject the key (deny_unknown_fields), so it is set only after both are upgraded; the default needs no key. If the address could not be bound because another process holds it, that process keeps receiving the requests under failClosed; the README says so (single-user devices, as for the proxy). Also formats PROXY_ABSENT_REASON (left unformatted on the base, so the base fails cargo fmt --check). Tests (agent lib 297 -> 302): the three proxy-absent removal tests now set failOpen; new tests for failClosed in the Copilot CLI, chat language models and settings.json planners (bytes and sidecar kept, inactive reason, proxy back on another port, program removal still removes, no file created), and the config default/parse/serialize (5 new). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Owner
Author
|
Superseded: landed upstream in agentdesktop-dev#146 (llmGateway.whenProxyUnavailable). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on this fork so the diff is this PR only (base:
copilot/pr6-copilot-guide). A follow-up to the series; it goes to James with the next integration update.Why. While the daemon runs without its loopback proxy (
daemon.llmProxy.listenunset, or the address could not be bound), the programs behind it removed their managed entries. For VS Code on GitHub's models that removes the CAPI override, so Copilot Chat talks to GitHub directly, past the gateway. A company that routes Copilot through the gateway for identity, logging or guardrails may not want that silent fallback; another may prefer Copilot to keep working.What it does.
llmGateway.whenProxyUnavailable(controller-deliverable):failClosed, the default, orfailOpen. It coversprograms.copilotandprograms.vscode, in both modes.inactivewith a reason that names the policy.useLlmGateway: false, no gateway and noproxyUrlremove as before, whatever the policy. The next apply with the proxy writes the current entries. A stopped daemon changes no file, so the tools fail until it runs again.LlmGatewayConfigdenies unknown fields, so older controllers and daemons reject a configuration that carries the key. Set it only after both are upgraded; the default needs no key.cargo fmt --check.Tests. Agent lib 297 to 302. The three proxy-absent removal tests now set
failOpen. New failClosed tests cover the Copilot CLI, chat language models andsettings.jsonplanners: bytes and sidecar kept, the inactive reason, the proxy back on another port, program removal still removes, no file created. Config default, parse and serialize are covered too. Gate: fmt, clippy, agent 302, core 22, schema. VS Code and Copilot Docker tests: 6 of 6.Review. One review (Opus) found no blocker and no bypass. It raised a wording major (the port may belong to another process) and three stale doc sentences; all are fixed in this commit.
Lab (Linux VM, user mode, controller-pushed Copilot CLI and VS Code on GitHub's models). Run with
lab/checks/pr7-policy.sh: 11 of 11.settings.jsonandproviders.jsonkeep their bytes, and both programs areinactivewith the fail-closed reason.failOpenremoves the override and the providers.Not covered. macOS and Windows.
🤖 Generated with Claude Code