Repository navigation
Conversation
40f5d13 to
e7eab8c
Compare
Polly AI ReviewBlocking issues
Security vulnerabilities
Non-blocking notes
ApproachNative provider and token hooks avoid another forwarding proxy. Reuse the caller’s expanded managed state and the existing SummaryDiff size (computed): 29 files; +3782 / -8 lines (3790 changed text lines); 0 binary files.
Shares use additions + deletions, including generated text and lockfiles. Binary files have no line count. Tests include fixtures/helpers under test paths and colocated test/spec files; categories are path-based, not coverage measurements. ChangesThe intended outcome is configure-time installation of an experimental Copilot desktop integration, with provider registration, authentication helpers, managed controls, status, and revert support. The full snapshot also includes the plugin and registration changes from earlier PRs in the stack. The implementation spans Python orchestration and a JavaScript runtime, which explains much of its size. The accompanying component tests cover distinct lifecycle and protocol boundaries. No documentation, dependency, lockfile, or generated-file changes contribute to this snapshot. Removing the second managed-model resolution would reduce implementation logic and eliminate the policy drift identified above. TestsTest-by-test assessmentStatic assessment only: no PR code or tests were executed. The reported pytest, lint, formatting, and typecheck results are unverified. Fake-app protocol tests do not establish compatibility with the native app, successful inference, or downstream usage attribution. The table accounts for the changed tests and support. Parameterized variants share a row only where their purpose and recommendation match.
Missing regression coverage is concentrated around the demonstrated bugs: expanded managed sources, foreign marketplace installation, wrapped filesystem failures, and registration concurrent with revert. These fit existing unit/component scenarios; separate E2E tests are unnecessary for those assertions. For native validation on an approved developer machine, configure while the app is closed and confirm it stays closed; open it and check readable picker names; complete a response on each supported wire; switch workspace selectors; then revert during startup and confirm the rows remain absent. Capture actual request/response status and relevant routing headers. Downstream usage attribution requires separate usage-data evidence. ScopeNo clearly unrelated changes were established. Plugin delivery, registration, managed controls, helper discovery, status, and cleanup support the stated outcome, including the earlier stack changes present in the full snapshot. The remaining scope question is Automated review by Polly · workflow run |
ec3d0b4 to
1aa0951
Compare
An unwired module that writes a ug-owned local plugin marketplace and turns it on in Copilot's settings.json. The plugin's extension registers ug's provider and model ids and serves them straight from the AI Gateway, minting a token with `ug auth-token` per request (cached until shortly before expiry). Co-authored-by: Isaac <no-reply@databricks.com>
The session uses the extension's model rows instead of the app's, so they repeat the rows' token limits and, for Claude, vision support. Co-authored-by: Isaac <no-reply@databricks.com>
… token remove() now drops the settings keys, waits for the app to unload the extension, then deletes the directory; deleting it first left running extensions serving open chats. The extension drops its cached token when a model call fails with a 401 and mints the next one with --force-refresh (untested live). Co-authored-by: Isaac <no-reply@databricks.com>
The extension now registers ug's providers and model rows over the app's local WebSocket API when it starts, from rows in its config, and deletes ug's providers and rows that the config no longer has. It syncs only when the rows or the app's launch token changed, one extension process at a time, and logs a failure without affecting the models it serves. Model rows also turn off reasoning_effort where asked (Chat Completions models), and never advertise an output limit below the 32K the runtime asks for. The Databricks CLI's directory goes on the token command's PATH. Co-authored-by: Isaac <no-reply@databricks.com>
- The token command comes from ug's own builders, so a PAT or custom OAuth setup keeps its mode: `ug auth-token --host` ignores the saved choices. The sign-in hint follows the mode. - A failed token command shows a hint only for an auth failure, or says ug wasn't found; a hint the session couldn't show yet doesn't count as shown. A 401 also logs the sign-in hint, since the app's own message names Copilot's API-key settings. - A mint running when the token is invalidated no longer caches its token. - remove() leaves a unity-gateway marketplace that points elsewhere. - settings.json: a symlink is refused, and rewrites keep the file's mode. - The row-sync node tests skip on a Node without a global WebSocket. Co-authored-by: Isaac <no-reply@databricks.com>
Desktop-app adapters live in agents/desktop/. The wheel keeps shipping the extension's .mjs files, since hatch includes every file in the package. Co-authored-by: Isaac <no-reply@databricks.com>
With the GitHub Copilot app closed, ug can't delete its rows from the app's picker. defer_remove marks the plugin's config, and on the app's next start the extension deletes ug's providers over the app's local API, then removes ug's two settings.json keys under the same rules as the Python writer, and serves nothing. A lock keeps sessions from racing. cleanup_leftover deletes the directory on a later ug run once the keys are gone. Not yet checked against the live app. Co-authored-by: Isaac <no-reply@databricks.com>
…mpty install() records when Copilot's settings.json didn't exist before. remove(), and cleanup_leftover() after a deferred remove, delete the file only if ug created it and nothing is left in it; otherwise they keep it. Co-authored-by: Isaac <no-reply@databricks.com>
The app's window loads the model picker's providers only when it starts, about 7 s before the first extension runs, so rows the plugin has just created or changed show a generic icon and no Databricks label until the next launch. After a sync that changed ug's rows, one extension process claims a restart under the sync lock, keyed by a hash of the rows, so a relaunch, another chat or an unchanged configure never restarts again. It waits until no chat in the app is running a turn (the app's session event stream, else its own session, plus a quiet window), posts a line in the chat, and a detached helper closes the app without forcing it, waits for it to exit and starts it again with the user's session environment. When it can't (no display on Linux, the app stays up, three minutes without idle), it asks the user to restart instead. Co-authored-by: Isaac <no-reply@databricks.com>
The pytest wrappers ran them only where the unit-test runner happened to have Node, so they could skip. They now run in the VS Code extension job, which sets up Node 22 (with the global WebSocket the extension uses) and is part of the required test check. The pytest syntax checks and the Python-to-extension removal test still skip without Node. Co-authored-by: Isaac <no-reply@databricks.com>
…ateway The plugin is now unity-gateway in the databricks-unity-gateway marketplace, under plugins/unity-gateway. Configure moves an earlier build's unity-gateway marketplace and databricks@unity-gateway key to the new id when their source is ug's plugin directory, and deletes the old plugin copy; status counts either as installed, and removal (also the extension's deferred one) takes out both. A marketplace of either name at another path is still left alone. Co-authored-by: Isaac <no-reply@databricks.com>
…ests Like ug copilot, every model request from the GitHub Copilot app now carries session-id, so the gateway's usage table groups an app chat's turns. It's the session the extension process serves (SESSION_ID, which joinSession resumes), not a random id; an admin header of that name wins. Subagent requests get no thread-id: the SDK's provider headers are static and it has no per-request header hook. Co-authored-by: Isaac <no-reply@databricks.com>
3ca34d8 to
efe50b7
Compare
App 1.4.2 writes only the port to run/ws.port and its own pid to run/app-owner.pid, so the restart never found the app and only posted the hint. The pid now comes from app-owner.pid, with ws.port's second field as a fallback. The restart stays one attempt per change: a launch after a failed one already loads the rows' labels, so it needs no retry. Co-authored-by: Isaac <no-reply@databricks.com>
efe50b7 to
79a7531
Compare
The app stops the extension process a few seconds after the sync that changed its rows, so the idle wait and restart inside it never ran. The extension now starts the detached helper as soon as the sync returns (before the session is joined) and posts one line saying the app restarts once no chat is busy. The helper opens its own watch of the app's session events, waits for idle plus the quiet window, then restarts the app. Without the session events, or when the app closes while it waits, it gives up and leaves the app as it is. Co-authored-by: Isaac <no-reply@databricks.com>
79a7531 to
e48e005
Compare
In the app, the extension's process.execPath is the Copilot runtime's own binary, which refuses to run a script, so the detached restart helper exited at once. The extension now passes the app's target to a detached `ug copilot-app-restart`, using the absolute ug path its config now carries; ug watches the app's session events, waits for idle and restarts the app. The JavaScript watch and restart code goes away. Co-authored-by: Isaac <no-reply@databricks.com>
e48e005 to
5b8a11b
Compare
- install checks that extraKnownMarketplaces and enabledPlugins are JSON objects before it writes the plugin, so a refusal leaves no orphan plugin directory behind; - the token command's environment keeps Windows' Path casing instead of adding a second PATH key; - a token the CLI hands out within two minutes of its expiry is reused for 30 s rather than minted again for every request; - the sync lock names its owner, so a process whose lock was taken over as stale can't release the new owner's, and only one process can take a stale lock over; - the first sync (or deferred remove) retries three times with a backoff when the app hasn't published its endpoint yet. Co-authored-by: Isaac <no-reply@databricks.com>
5b8a11b to
d6386d7
Compare
- A deferred remove on an earlier build's install marks that build's extension, under its own plugin directory, so the next app start still deletes the rows and keys; a pending removal is found there too. - install leaves another marketplace of ug's name alone instead of pointing it at ug's plugin, and refuses before writing anything. - The extension catches a rejected session.log, so a hint the chat can't show no longer ends the extension. - Tests take the lock file name and staleness from app-rows.mjs, and the file-mode test skips on Windows, which has no POSIX modes. Co-authored-by: Isaac <no-reply@databricks.com>
d6386d7 to
70ed5a0
Compare
write_plugin used to write the marketplace, manifests, extension files and config.json one by one in place, so an app reading the plugin during configure, or a failed copy during a reinstall, could see a half written plugin. It now writes the whole tree to a sibling staging directory, syncs the files, and swaps it in by renames: the old tree moves aside first, as Windows can't rename onto a directory, and comes back if the swap fails. The extension's sync stamp, restart marker and log, ug's created-settings marker and an earlier build's copy are carried over. Settings keys are merged only after the swap, and leftovers from a crashed run are removed after ten minutes. Co-authored-by: Isaac <no-reply@databricks.com>
…oval Before ug deletes its rows from a running app, it will mark the plugin for removal, the flag the deferred removal already uses. Under the sync lock, an extension now reads that flag from its config.json before the sync and before every write, and stops instead of writing ug's rows back. The plugin module also gets sync_lock(), which takes the extensions' lock file under the same protocol (an owner-named file, an atomic stale takeover), so ug can hold it while it unregisters. Co-authored-by: Isaac <no-reply@databricks.com>
An unwired module that adds ug's Claude, GPT and open-model providers and their models to the running GitHub Copilot app through its local WebSocket API, and deletes them again. One function builds both the app's provider and model rows and the Copilot plugin's providers from the model catalog VS Code uses, so their ids always match. The rows point at the AI Gateway; the plugin serves them with a fresh token. Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
The plugin's extension now writes the providers and model rows to the app, so desired_providers() also returns them as the plugin's input, with every provider id ug owns, and register() is gone. unregister() and status() stay for revert and status. Chat Completions models turn off reasoning_effort. Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
…atalog The app applies its own settings to a row whose id is a Copilot catalog model's, over the row's: a Kimi K3 row with id kimi-k3 got reasoning_effort high despite reasoningEffort false. GPT and open-model rows now use the gateway's full id, or databricks.<id> for a bare Model Provider Service target. Claude rows keep Copilot's catalog ids, which make the app apply Claude's request settings. Co-authored-by: Isaac <no-reply@databricks.com>
…nown version The app version only decides whether ug warns that it hasn't been verified, so an app that refuses get_healthcheck now gets that warning instead of failing unregister and status. Co-authored-by: Isaac <no-reply@databricks.com>
Behind UG_EXPERIMENTAL_COPILOT_APP=1, `ug configure --agents copilot` installs ug's Copilot plugin when the GitHub Copilot desktop app is installed. The plugin gets the providers and picker rows, the workspace's headers (the ones `ug copilot` sends, the Model Provider Service header and the workspace selector) and the absolute ug and databricks paths. The plugin writes the rows to the app's picker itself, so configure never talks to the app or starts it. - Unreadable settings.json: configure skips the app. User-level telemetry keys make the app ignore the whole file, so configure and `ug status` warn about them. - --no-copilot-app (hidden) skips the app for one run. The managed app_integration switch removes ug's plugin and providers. - `ug revert` unregisters ug's providers if the app is running (it never starts the app), then removes the plugin. With the app closed, it says the rows stay until revert runs again with the app open. - `ug status` gets a "GitHub Copilot app" row, and warns when the rows are registered but the plugin is missing, disabled or ignored. - Configure records the databricks CLI path. Helpers that the app starts with a short PATH (auth-token, otel-headers, mcp-proxy) fall back to it. mcp-proxy also drops the app runtime's OTEL_* environment. - Dry runs change nothing. - copilot_app.status() compares base URLs and doesn't print the version warning. The model listing's errors name the app. Co-authored-by: Isaac <no-reply@databricks.com>
CLI setup and cleanup of desktop apps lives in agents/desktop/setup.py, beside Claude Desktop's. Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
…e app is closed ug revert, and the managed off switch, unregister ug's providers when the app is running and then remove the plugin. With the app closed, they mark the plugin so its next start deletes the rows and ug's settings keys, and ug status shows the removal as pending. configure, status and revert delete the plugin's directory once the extension has removed the keys. Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
…vert A revert with the app closed leaves the removal to the plugin's next start. Once Copilot is no longer configured, ug status skipped the app, so it neither showed the pending removal nor deleted what the plugin left behind. Status now runs the leftover cleanup and shows the pending row when Copilot isn't configured. Co-authored-by: Isaac <no-reply@databricks.com>
The plugin's provider headers carried ug copilot's User-Agent, which names the Copilot CLI's version: empty or wrong on a machine with only the app, and indistinguishable from ug copilot at the gateway. Like Claude Desktop's profile, they now leave it out, so the app's runtime sends its own; the coding-agent mode, request tags, admin, provider service and workspace headers stay. The configure hint also drops the step for the stale picker labels, which the plugin now fixes by restarting the app once. Co-authored-by: Isaac <no-reply@databricks.com>
Also name the plugin's current databricks-unity-gateway entries in revert's failure message. Co-authored-by: Isaac <no-reply@databricks.com>
The plugin's extension starts this hidden command, detached, after it changed ug's rows in the app's picker. It watches the app's session events over the app's local API (with session channels on), waits until no chat has a turn open and none has sent anything for 15 s (at most 3 minutes), then closes the app without forcing it (SIGTERM on Linux, osascript quit on macOS, taskkill without /F on Windows), waits for it to exit and starts it again with only the user's session environment, retrying once. Without the session events, when the app closes during the wait or when it stays up, it leaves the app as it is. The outcome goes to the log file the extension names. Co-authored-by: Isaac <no-reply@databricks.com>
ug status reads the app's providers on every run, so it now waits at most 3 s for the app to open the connection and for each reply, instead of the 5 s and 15 s that configure, revert and the restart helper keep. Co-authored-by: Isaac <no-reply@databricks.com>
configure expands a managed list's <catalog>.<schema>.* sources, but the app's setup layered the raw managed config on again. A list of only wildcards then read as no list, so the app got every discovered model instead of the admin's. Its setup and status now replace each wildcard with what configure last expanded it to, and skip the app with a warning when a source was never expanded. Co-authored-by: Isaac <no-reply@databricks.com>
…test Windows finds executables by PATHEXT, so the test's fake CLI is databricks.exe there, and the paths are compared case-insensitively. Co-authored-by: Isaac <no-reply@databricks.com>
…gisters With the app running, an extension that had just started syncing could write ug's rows back between revert deleting them and the plugin going away. Revert (and the managed off switch) now first marks the plugin for removal, the flag the deferred removal uses, so no extension writes rows again; then deletes the rows over the app's local API while holding the extensions' sync lock; then removes the settings keys and the plugin. With the app closed, the same mark leaves the removal to the plugin's next start. A failed plugin write during configure now only warns. Co-authored-by: Isaac <no-reply@databricks.com>
70ed5a0 to
8b9f438
Compare
…ot app, and hint its default model A Model Provider Service that relays a GitHub Copilot seat needs a fresh swap header per request, which the app's fixed provider headers can't carry. Configure now skips the app for one, with a note pointing to ug copilot or VS Code, and ug status says why the app has no models from it. When the workspace's managed default model is one of the app's rows, configure prints how to make it the app's default. ug writes nothing to the app for it. Co-authored-by: Isaac <no-reply@databricks.com>
🥞 Stacked PR
Use this link to review incremental changes.
Summary
Behind
UG_EXPERIMENTAL_COPILOT_APP=1,ug configure --agents copilotnow also sets up the GitHub Copilot desktop app when it's installed. It does that by installing ug's Copilot plugin from the earlier PRs in this stack. Nothing of ug runs in the background. The setup lives inagents/desktop/setup.py, beside Claude Desktop's.Configure: when the app is installed (the macOS bundle, the Windows registry key, or
/usr/bin/githubon Linux), configure writes ug's plugin with:desired_providers();ug/databrickspaths;ug copilotsends, except its User-Agent: coding-agent mode, request tags, admin headers, the Model Provider Service header and the workspace selector (also from the saved workspace id).ug copilot's names the Copilot CLI's version, which is empty or wrong on a machine with only the app, and the gateway couldn't tell the app fromug copilot. Like Claude Desktop's profile, the plugin's headers leave it out, so the app's runtime sends its own.Managed config is layered in. The plugin writes the rows to the app's picker itself whenever the app runs, so configure never talks to the app or starts it. It prints one line: "Open (or restart) the GitHub Copilot app to load the Databricks models." The plugin restarts the app once itself, to show the rows' Databricks names and icons.
Invalid
settings.json: if Copilot'ssettings.jsonisn't valid JSON, configure warns and leaves the app unchanged. If the file has user-leveltelemetrykeys, the app's runtime rejects them and then ignores the whole file, plugin included; configure andug statuswarn about that.Opt-out: the hidden
--no-copilot-appflag skips the app for one run, like--no-vscode.Managed off switch: the copilot
app_integration.enabled: falsein managed config removes ug's plugin and providers, the same way revert does.ug revert:settings.jsonkeys (also an earlier build'sunity-gateway/databricks@unity-gatewayones);ug status: once Copilot is no longer configured, it still shows a pending removal and cleans up what the plugin left behind. Otherwise, a "GitHub Copilot app" row with:It warns when the rows are registered but the plugin is missing, disabled or ignored, because the app's turns fail without it.
databrickspath: configure records the absolutedatabricksCLI path in ug's state. Helpers the app starts with a short PATH (ug auth-token,ug otel-headers,ug mcp-proxy) fall back to it when PATH has no CLI.ug mcp-proxy: drops the app runtime'sOTEL_*/COPILOT_OTEL_*environment, so it and its children don't export without a token.ug copilot-app-restart(hidden): ug's plugin starts this detached after it changed ug's rows in the app's picker. The app's window loads them only when it starts, and the app stops the extension soon after the change.osascript quiton macOS,taskkillwithout/Fon Windows), waits for it to exit, and starts it again with only the user's session environment, retrying once.Dry runs: they change nothing in the app, its settings or the plugin.
Follow-ups from the registration PR:
copilot_app.status()no longer prints the version warning;Review fixes:
<catalog>.<schema>.*sources (what configure last expanded them to). Before, the raw sources were layered back on, so the app could get the whole discovered catalog. If a source was never expanded, the app is skipped with a warning.ug statuswaits at most 3 s per step for a hung app.ug copilotor VS Code for it.", andug statusshowsmodels skipped (seat subscription)with the same note.copilot_default_model, resolved like VS Code's) is one of the app's rows, configure prints "To start new chats on , pick it in the GitHub Copilot app; Settings -> Sessions -> Default model makes it stick." ug writes nothing to the app for it.Test plan
uv run pytest tests/test_copilot_app.py tests/test_copilot_app_plugin.py tests/test_copilot_app_setup.py tests/test_managed_config.py tests/test_managed_resolve.py tests/test_managed_setup.py tests/test_cli.py tests/test_agent_copilot.py tests/test_agent_vscode.py tests/test_databricks.py tests/test_state.py tests/test_mcp_proxy_cli.py tests/test_workspace_selection.py tests/test_desktop_setup.pyuv run ruff check src/ tests/,uv run ruff format --check src/ tests/,uv run ty check src/tests/test_copilot_app_setup.py. An autouse fixture keeps every test away from a real app,~/.copilotand~/.ucode, and fails a test that starts a process. It covers:User-Agent(in any case), and never talks to the app;ug statusafter revert;databrickspath;tests/test_copilot_app_restart.py:/F;session_channels=true.tests/integration/journey. The gate needs a maintainer decision.This pull request and its description were written by Isaac.