Repository navigation
Conversation
UG review recommendationRECOMMENDATION: REJECT (request changes) Reasons:
Findings considered: 7 (severities: high: 2, low: 2, medium: 3); see the inline review comments. Advisory only: this recommendation never approves or merges the pull request. The |
Polly AI ReviewBlocking issuesNone confirmed. Security vulnerabilitiesNone confirmed. Actual gateway requests and workspace isolation remain unverified. Non-blocking notes
ApproachThe native marketplace and provider-extension approach fits the outcome without adding a proxy. Existing workspace-splitting helpers and staged marketplace publication offer concrete reuse opportunities. SummaryDiff size (computed): 5 files; +763 / -0 lines (763 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. ChangesAdds a standalone Python plugin installer, two JavaScript extension modules, and Python/Node component tests. No dependencies, lockfiles or documentation change. The size is proportional to settings ownership, plugin generation and token lifecycle handling. Reusing workspace normalization and the existing staged-publication pattern would reduce bespoke handling. CLI integration is explicitly deferred. TestsTest-by-test assessmentAssessment is static; no PR code or tests were executed.
The component coverage is appropriate for local configuration and token logic. The actionable gaps are workspace-selector handling, interrupted bundle replacement and the real subprocess boundary, as noted above. Existing CLI/VS Code tests exercise different implementations and do not establish this desktop extension’s contract. SDK acceptance, actual outgoing requests, response status/payloads, native model-picker labels, completed inference and downstream usage attribution are unverified. Before rollout, verify plugin loading in the app, select a configured model, complete a response, and correlate its gateway request and workspace headers. ScopeAll five changed files support the stated standalone plugin outcome. No unrelated changes were found. Configure/revert/status CLI wiring is deferred as described; whether Automated review by Polly · workflow run |
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>
640eded to
1f43107
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>
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>
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>
- 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>
- 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>
Polly AI ReviewBlocking issues
Security vulnerabilitiesNo additional demonstrated security vulnerabilities found. The settings-ownership data loss is reported above. Non-blocking notes
ApproachThe native token-provider approach avoids another inference proxy. A concrete simplification is to generate the ownership identifiers once for Python and JavaScript, rather than maintain parallel removal rules. SummaryDiff size (computed): 13 files; +2967 / -0 lines (2967 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. ChangesAdds a local Copilot marketplace, plugin generation, authentication configuration, picker synchronization, restart planning, and immediate/deferred removal. The diff also adds focused Python and JavaScript tests, a fake WebSocket app, and CI wiring. No documentation, dependency, or generated-artifact changes are included. The breadth is broadly proportional to the intended plugin lifecycle. Sharing ownership identifiers would reduce duplicated contract logic without removing behavior. The ownership and lifecycle failures above need resolution before approval. TestsTest-by-test assessmentAssessment is based on the frozen snapshot and relevant existing tests. JavaScript syntax checks and Python parsing passed. Behavioral tests, pytest collection, lint, and typecheck were not executed; network-isolated execution was unavailable. “WS component” below means loopback WebSocket communication with the fake app, not native Copilot. These tests provide configuration, simulated protocol, and request-side evidence. Actual SDK compatibility, inference requests/responses, native picker labels, idle-safe restart, and downstream usage attribution remain unverified. The referenced Python configuration and lifecycle
JavaScript support and authentication
JavaScript removal
JavaScript restart
JavaScript picker synchronization
Missing coverage and verification The existing scenarios do not protect the demonstrated foreign-marketplace install overwrite, legacy deferred removal, cancellation race, live-lock takeover, or lost-acknowledgement restart failure. Add filesystem regressions beside After fixes, run:
Once the stack is wired, verify readable model-picker entries, a completed Databricks response with correlated request/response evidence, idle-only restart, and removal/reinstall without changing a foreign marketplace. Header assertions alone do not establish downstream usage attribution. ScopeAll changed files support the stated Copilot plugin outcome, including its tests and CI wiring. No clearly unrelated changes were found. Missing CLI integration is consistent with this being the first module in a stack; the truncated description does not justify treating later integration work as a scope violation. Automated review by Polly · workflow run |
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>
🥞 Stacked PR
Use this link to review incremental changes.
Summary
First step of a plugin-based setup for the GitHub Copilot desktop app. It adds
ucode.agents.desktop.copilot_app_plugin, a module nothing calls yet, that installs a Databricks plugin into the app.Plugin: ug writes a local plugin marketplace it owns under
~/.ucode/copilot-app-plugin/: marketplacedatabricks-unity-gateway, with one plugin,unity-gateway, underplugins/unity-gateway/, and one extension. The extension's config holds:Turning it on: ug adds exactly two keys to Copilot's
settings.json(honoring$COPILOT_HOME), and the running app loads the plugin without a restart:extraKnownMarketplaces["databricks-unity-gateway"]entry pointing at the directory;enabledPlugins["unity-gateway@databricks-unity-gateway"].Every other setting is kept, the file is written atomically, and it keeps its mode. A symlinked
settings.jsonis refused. Asettings.jsonthat isn't a JSON object, which Copilot ignores whole, is never rewritten; ug reports it instead.Earlier ids: builds before this one used marketplace
unity-gatewayand plugin keydatabricks@unity-gateway. When their source is ug's directory:plugins/databricks/copy;A marketplace of either name that points elsewhere isn't ug's and is left alone.
Remove: deletes ug's keys (no
falseleft behind), waits a few seconds for the app to unload the extension, then deletes the directory. If ug createdsettings.jsonat install and nothing else is left in it, the file is deleted too; otherwise it's kept.status()reports installed, disabled, not installed, or invalid settings.Deferred remove: with the app closed, ug can't delete its rows from the picker.
defer_remove()marks the extension's config instead and leaves the plugin on. On the app's next start, the extension:settings.jsonkeys under the same rules as the Python writer;A lock keeps sessions from racing.
cleanup_leftover()deletes the directory on a later ug run once the keys are gone, andstatus()reportsremoval_pendinguntil then.What the extension does:
ug copilot-app-restart, using the absolute ug path in its config.run/app-owner.pid(or a second field ofrun/ws.port), and on Windows the executable throughGet-Process. With no display on Linux, no app pid or no ug path, it doesn't start one.reasoning_effortturned off where asked (Chat Completions models).session-id: <the app session's id>(the session the extension process serves), likeug copilot. An admin header of that name wins.thread-id: the SDK's provider headers are static, and it has no per-request header hook.ug auth-token(built with ug's PAT and custom OAuth choices), sharing one in-flight mint and reusing the token until two minutes before it expires. A 401 drops the cached token, and the next mint passes--force-refresh.A follow-up wires this into
ug configure --agents copilot,ug revertandug status.CI (
.github/workflows/ci.yml, needs a code-owner approval): the plugin's node tests (tests/*.test.mjs) run withnode --testin the existing VS Code extension job, which sets up Node 22 (with the globalWebSocketthe extension uses) and is part of the requiredtestcheck. The pytest wrapper that ran them only where the unit-test runner had Node is gone. The pytestnode --checksyntax checks and the Python-to-extension removal test still skip without Node.Review fixes:
extraKnownMarketplacesorenabledPluginsisn't an object, or when another marketplace already uses ug's name.Pathcasing.session.logis caught.config.json) is written to a sibling staging directory, synced, and swapped in by renames: the old tree moves aside first, for Windows, and comes back if the swap fails. The settings keys are merged only after that, reinstalls go the same way, the extension's state carries over, and a crashed run's leftovers are removed after ten minutes. So the app never reads a half-written plugin.config.jsonbefore the sync and before every write, and stops when ug has marked the plugin for removal.sync_lock()lets ug take the same lock.Test plan
uv run pytest tests/test_copilot_app_plugin.pycovers:settings.json: other keys kept, idempotent, invalid JSON or non-object keys left alone,$COPILOT_HOME, a foreign marketplace, symlinks and file mode, removing the keys before the directory;node --test tests/*.test.mjs(CI's VS Code extension job):copilot_app_plugin.test.mjs: token caching by JWT expiry, a shared in-flight mint, invalidation and force refresh, the hints, PATH and header handling, andsession-idon every provider (fromSESSION_ID, an admin override in any case, none without an id);copilot_app_rows.test.mjs, against a fake of the app's WebSocket API: writing and pruning rows, request_id matching, retries, the lock and stamp, a closed app, failures logged without throwing, and when a sync counts as a change;copilot_app_remove.test.mjs: the deferred remove against the same fake. It covers both ids; keys removed while other keys and the mode are kept; invalid JSON, a non-object and a symlink refused; only ug's providers deleted; the lock under concurrent sessions; and a closed app keeping the keys.copilot_app_restart.test.mjs: startingug copilot-app-restartwith the target and the ug path and the chat line, the hint when it can't (no ug path, no plan, a failed spawn), and the plan per platform and its refusals, includingapp-owner.pid.ruff check,ruff format --check,ty check src/.This pull request and its description were written by Isaac.