Skip to content

copilot: build the GitHub Copilot app's Databricks rows and plugin providers from one catalog - #1790

Draft
xi-db wants to merge 26 commits into
mainfrom
xi-db/stack/copilot-plugin-registration
Draft

xi-db wants to merge 26 commits into
mainfrom
xi-db/stack/copilot-plugin-registration

Conversation

@xi-db

@xi-db xi-db commented Nov 20, 2026 •

Copy link
Copy Markdown
Collaborator

🥞 Stacked PR

Use this link to review incremental changes.


Summary

  • Adds ucode.agents.desktop.copilot_app. Its desired_providers() builds, from one model catalog, both the GitHub Copilot app's provider and model rows and the plugin input of the parent PR, with identical provider ids, model ids and wire models:
    • .plugin: the providers and models the extension serves, with the rows' names, token limits and vision, and reasoning_effort off for Chat Completions models;
    • .plugin_app plus OWNED_PROVIDER_IDS: the rows the extension writes to the app's model picker, and every provider id ug may have written there.
  • There are three providers: Databricks Claude (Anthropic, with a placeholder key the app requires), Databricks GPT (Responses) and Databricks Open Models (Chat Completions). A wire with no models gets no provider. The rows point at the AI Gateway (/ai-gateway/anthropic, and /ai-gateway/mlflow/v1, or /ai-gateway/openai/v1 plus the routing header for a Model Provider Service), not at a local port.
  • state_providers() feeds it the same catalog VS Code uses (now vscode.copilot_models).
  • A client for the app's local WebSocket API (the port and token the app publishes in ~/.copilot/run/) gives unregister(), for revert, and status(). Replies are matched by their echoed request_id; an error without one answers the pending request (the app omits it on format errors). The app closing the connection counts as not running. Unverified app versions get a warning.
  • Provider and model ids are fixed uuid5 values, so writing them again updates in place and revert needs no state.
  • Model ids: a Claude row's model id is Copilot's catalog id for the model behind it, so the app applies Claude's request settings. GPT and open-model rows use the gateway's full id, or databricks.<id> for a bare Model Provider Service target. That keeps them out of Copilot's catalog: the app applies its own settings to a catalog id over the row's (a Kimi K3 row with id kimi-k3 got reasoning_effort).
  • Not yet wired into ug configure, ug revert or ug status.

Review fixes: an app that refuses get_healthcheck counts as an unknown version, which only warns, instead of failing unregister and status.

Test plan

  • uv run pytest tests/test_copilot_app.py tests/test_copilot_app_plugin.py tests/test_agent_vscode.py:
    • the app rows, the plugin's providers and the plugin's app rows carry the same ids, names, limits and vision;
    • the three wires, the Model Provider Service route and header, reasoning effort, and de-duplication;
    • against a fake of the app's WebSocket API: unregister, status, the retry on a busy app, refusals, request_id matching, a closed or quitting app, a rejected token and the version warning.
  • just lint (ruff check, ruff format check, ty).

This pull request and its description were written by Isaac.

Comment thread src/ucode/agents/desktop/copilot_app.py Resolved
Comment thread src/ucode/agents/desktop/copilot_app.py Resolved
Comment thread src/ucode/agents/desktop/copilot_app.py Resolved
Comment thread tests/test_copilot_app.py Resolved
@github-actions

Copy link
Copy Markdown
Contributor

UG review recommendation

RECOMMENDATION: REJECT (request changes)

Reasons:

  • Finding 1 (__init__.py 87-91) is a reproducible behavioral bug with credential impact. The copied token argv drops --use-pat, so users configured for a PAT would get OAuth tokens or failures. It also skips the host rstrip("/") normalization. The fix is to reuse `databricks.build_auth_token_arg
  • Finding 3 (copilot_app.py 454-458) is a cross-workspace issue. After a user switches from workspace A to B, status still reports registered while baseUrl points at A. The check should also compare settings and row fields.
  • Finding 2 (__init__.py 216-219) is a reproducible bug that leaves partial state behind. If enabledPlugins or extraKnownMarketplaces is not an object, the plugin directory gets written and then enable raises, leaving ~/.ucode/copilot-app-plugin on disk. Both keys should be validated before
  • Finding 4 (copilot_app.py 345-349) is an unsafe rollout assumption. If a newer app removes or renames get_healthcheck, register, unregister and status all hard-fail, even though the version check only exists to warn. That error should be treated as an unknown version.
  • Finding 5 is minor: status() shows a spurious warning on unverified app versions. It is not blocking on its own.
  • Finding 6 is a non-blocking process and maintainability suggestion: split the ~1,700-line change into a stack, and note the overlapping test coverage.

Findings considered: 6 (severities: low: 2, medium: 4); see the inline review comments.

Advisory only: this recommendation never approves or merges the pull request. The ready-to-approve label tracks it.

@github-actions

Copy link
Copy Markdown
Contributor

Polly AI Review

Blocking issues

  • P1 — src/ucode/copilot_app.py:132: can we use model.catalog_name? Claude-backed services with opaque names are skipped, so registration can delete their existing provider.
  • P2 — src/ucode/copilot_app.py:455: can status compare settings and model contents? checking workspace B after registering A returns registered because their IDs match, despite A’s stored URL.

Security vulnerabilities

No confirmed vulnerabilities found. Actual Copilot authentication, workspace-header transmission and gateway inference remain unverified.

Non-blocking notes

  • src/ucode/copilot_app_plugin/__init__.py:88: can we preserve PAT/custom OAuth modes? explicit --host skips saved auth choices, so a PAT-only profile without an inherited bearer reaches OAuth and fails.
  • src/ucode/copilot_app_plugin/extension.mjs:10: can we add an SDK component case in tests/copilot_app_plugin.test.mjs checking requests and completed responses for all three wires? the fake app only proves CRUD.
  • tests/test_copilot_app_plugin.py: can we remove test_syntax[ug-plugin.mjs]? test_node_unit_tests already imports and parses that module.

Approach

Native registration plus a token-provider plugin avoids another proxy. Reuse build_auth_token_argv and build_custom_auth_token_argv instead of separately assembling authentication commands.

Summary

Diff size (computed): 8 files; +1688 / -3 lines (1691 changed text lines); 0 binary files.

Category Files Added Deleted Share of changed text lines
Tests and test support 3 856 0 50.6%
Documentation 0 0 0 0.0%
Dependencies and lockfiles 0 0 0 0.0%
Implementation / other 5 832 3 49.4%

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.

Changes

Adds local WebSocket registration, removal and status checks; a token-refresh plugin; shared app/plugin provider catalogs; and a reusable VS Code catalog entry point.

The diff contains implementation, Python/Node tests and test fixtures. It changes no documentation, dependencies or generated files. Its breadth generally matches the registration and plugin boundaries. Reusing the existing authentication-command builders would reduce duplicated behavior and preserve supported authentication modes.

Tests

Test-by-test assessment

Assessment is static: tests, lint and typecheck were not run, and the reported passing results are unverified. All three changed test files are new; no existing tests were removed or weakened.

Existing CLI coverage establishes support for Claude-backed services with opaque names, but does not protect this new builder. Existing VS Code and CLI tests likewise do not establish desktop SDK compatibility. The fake WebSocket server checks transport messages and resulting registration state, not the real app’s protocol, native model picker or completed inference. Usage attribution and telemetry delivery remain unverified.

Test / case Behavior protected Layer Needed? Action / rationale
tests/copilot_app_plugin.test.mjs::config, tests/copilot_app_plugin.test.mjs::jwt Explicit provider inputs and expiry-bearing token inputs Test data/helpers keep Small deterministic setup without real credentials or environment provisioning.
tests/copilot_app_plugin.test.mjs::jwtExpiryMs reads exp and tolerates opaque tokens JWT expiry parsing and malformed/opaque-token fallback Unit keep Distinct input boundaries with direct assertions.
tests/copilot_app_plugin.test.mjs::childEnv puts the configured dirs ahead of PATH Executable lookup order and unrelated environment preservation Unit keep Smallest reliable layer for environment composition.
tests/copilot_app_plugin.test.mjs::createTokenSource caches until shortly before expiry Token reuse, command arguments and refresh boundary Unit keep Injected time tests both sides of the boundary without sleeps.
tests/copilot_app_plugin.test.mjs::createTokenSource gives opaque tokens a default lifetime Cache lifetime when no JWT expiry exists Unit keep Protects a separate fallback branch.
tests/copilot_app_plugin.test.mjs::concurrent requests share one mint, and a failure is not cached Single-flight authentication and recovery after failure Unit keep Exercises concurrency and pending-promise cleanup.
tests/copilot_app_plugin.test.mjs::withLoginHint shows the hint once per run of failures Hint deduplication and reset after successful authentication Unit keep Protects a meaningful failure–success transition.
tests/copilot_app_plugin.test.mjs::withLoginHint still throws the token error when the hint fails Secondary logging failure preserves the authentication error Unit keep Distinct error-isolation boundary.
tests/copilot_app_plugin.test.mjs::buildProviders attaches the token provider to every provider Token callback attachment without mutating configuration Unit keep Protects configuration construction, but not SDK requests or responses.
tests/test_copilot_app.py::WORKSPACE, tests/test_copilot_app.py::CATALOG, tests/test_copilot_app.py::_app_providers Representative mixed-wire inputs Test data/helpers keep Compact shared inputs cover the three provider families.
tests/test_copilot_app.py::FakeApp, tests/test_copilot_app.py::app Socket lifecycle, handshake validation, recorded CRUD and injected failures Component fixture keep A real local socket is justified by transport behavior; the fake is not independent native-protocol evidence.
tests/test_copilot_app.py::_by_name, tests/test_copilot_app.py::_healthcheck State lookup and explicit stray-message inputs Test helpers keep Small helpers leave scenario assertions in the tests.
tests/test_copilot_app.py::TestDesiredProviders::test_the_plugin_gets_the_app_rows_ids App/plugin identifiers, wire models and labels agree Unit keep Directly protects the shared-catalog invariant.
tests/test_copilot_app.py::TestDesiredProviders::test_the_plugin_config_names_the_app_providers Shared identifiers survive final plugin serialization Unit keep Exercises the serialization seam beyond catalog construction.
tests/test_copilot_app.py::TestDesiredProviders::test_the_three_wires Provider kinds, routes, wire settings and placeholder secret Unit keep Protects the output contract. Extend with an opaque Claude service whose served_model supplies its catalog identity.
tests/test_copilot_app.py::TestDesiredProviders::test_a_model_provider_service_uses_the_openai_route_and_its_header MPS routing, headers and wire-model names Unit keep Distinct routing branch; directly checks configuration output.
tests/test_copilot_app.py::TestDesiredProviders::test_a_wire_without_models_gets_no_provider Empty provider families are omitted Unit keep Covers an important catalog boundary.
tests/test_copilot_app.py::TestDesiredProviders::test_two_models_with_one_copilot_id_keep_the_first Deterministic handling of duplicate Copilot model IDs Unit keep Establishes the stated deduplication behavior and ordering.
tests/test_copilot_app.py::TestDesiredProviders::test_state_providers_use_the_vscode_catalog Shared catalog selection and MPS propagation Unit seam keep Focused wrapper coverage complements existing catalog-discovery tests.
tests/test_copilot_app.py::test_registers_the_three_providers_with_their_models Registration payloads, resulting state, placeholder secret and absent Origin WebSocket component keep Main transport scenario verifies observable fake-server state.
tests/test_copilot_app.py::test_registering_again_updates_in_place_without_resending_the_key Stable IDs, workspace replacement and secret reuse WebSocket component keep Protects a distinct repeated-run transition.
tests/test_copilot_app.py::test_a_catalog_change_drops_ugs_stale_providers_and_models Stale-state cleanup preserves foreign providers WebSocket component keep Exercises catalog transitions and ownership together.
tests/test_copilot_app.py::test_a_row_the_user_added_to_ugs_provider_is_replaced Reserved providers own their complete model collection WebSocket component keep Makes the destructive ownership boundary explicit.
tests/test_copilot_app.py::test_unregister_deletes_only_ugs_providers ID-based cleanup, foreign same-name preservation and repeated removal WebSocket component keep Meaningful destructive-operation coverage.
tests/test_copilot_app.py::TestStatus::test_registered_outdated_and_not_registered Registration-state classification WebSocket component keep Extend with unchanged IDs but changed workspace, MPS settings or model contents; these currently produce a false registered result.
tests/test_copilot_app.py::TestStatus::test_a_closed_app_is_not_running Status handles absent runtime discovery Component keep Protects the public status result rather than a mutation exception.
tests/test_copilot_app.py::TestStatus::test_an_app_that_quits_mid_check_is_not_running Status handles disconnect after connection succeeds WebSocket component keep Distinct mid-operation failure boundary.
tests/test_copilot_app.py::test_retries_while_the_app_applies_another_change Recovery from transient busy errors WebSocket component keep Tests retry behavior. The fake attaches request_id, so this is correlated-error evidence only.
tests/test_copilot_app.py::test_a_refusal_stops_the_registration A rejected model update surfaces as an app error WebSocket component keep Covers a material mutation failure, though not full partial-state recovery.
tests/test_copilot_app.py::test_every_request_carries_a_request_id Nonempty, unique correlation IDs WebSocket component keep Protects a cross-request protocol invariant.
tests/test_copilot_app.py::test_a_reply_not_for_this_request_is_skipped[another-request-id], tests/test_copilot_app.py::test_a_reply_not_for_this_request_is_skipped[no-request-id] Foreign and uncorrelated success frames cannot satisfy a request WebSocket component keep Both cases protect reply matching with useful boundary distinctions.
tests/test_copilot_app.py::test_an_error_for_another_request_is_skipped Another request’s error cannot abort the pending request WebSocket component keep Error-path counterpart to success-frame matching.
tests/test_copilot_app.py::test_an_error_without_a_request_id_answers_the_pending_request ID-less format errors terminate the pending request WebSocket component keep Directly protects the intentional exception to strict correlation.
tests/test_copilot_app.py::test_an_app_that_quits_mid_registration_is_not_running Mutation-time disconnect classification WebSocket component keep Distinct public failure behavior from status checks.
tests/test_copilot_app.py::test_a_listed_model_without_an_id_is_left_alone Malformed rows cannot become deletion targets WebSocket component keep Protects conservative mutation behavior.
tests/test_copilot_app.py::test_an_unknown_app_version_warns_and_still_registers Unknown versions warn without hard-blocking WebSocket component keep Protects compatibility fallback.
tests/test_copilot_app.py::test_a_verified_app_version_registers_quietly Verified versions avoid a warning WebSocket component keep Protects the other side of the version-warning boundary.
tests/test_copilot_app.py::test_a_closed_app_is_not_running Register/unregister handle missing files and a stale closed port Component keep Covers discovery failures for the mutation APIs.
tests/test_copilot_app.py::test_a_rejected_token_is_an_app_error Handshake authentication refusal differs from app absence WebSocket component keep Uses an actual fake-server HTTP rejection.
tests/test_copilot_app_plugin.py::NODE, tests/test_copilot_app_plugin.py::PLUGIN_SOURCE Node availability and bundled source location Harness data keep Makes the optional runtime boundary explicit.
tests/test_copilot_app_plugin.py::_config, tests/test_copilot_app_plugin.py::home, tests/test_copilot_app_plugin.py::_settings Representative inputs and isolated settings writes Test helpers/fixture keep Shared setup is small and avoids modifying real user settings.
tests/test_copilot_app_plugin.py::TestExtensionConfig::test_providers_keep_ids_wires_and_headers Provider serialization and caller-header preservation Unit keep Protects the serializer independently of app catalog construction.
tests/test_copilot_app_plugin.py::TestExtensionConfig::test_models_match_the_picker_rows Model/provider IDs, wire names and display names Unit keep Direct serialization contract assertions.
tests/test_copilot_app_plugin.py::TestExtensionConfig::test_token_command_and_hint_name_the_workspace_and_profile Authentication arguments, login guidance and executable paths Unit keep Extend with selected PAT/custom OAuth modes when preserving those modes in the API.
tests/test_copilot_app_plugin.py::TestExtensionConfig::test_without_profile Optional profile is omitted correctly Unit keep Small optional-input boundary.
tests/test_copilot_app_plugin.py::TestExtensionConfig::test_trailing_slash_on_workspace URL construction avoids duplicate separators Unit keep Low-cost input-normalization coverage.
tests/test_copilot_app_plugin.py::TestWritePlugin::test_layout Marketplace, manifest, bundled sources and configuration layout Filesystem component keep Packaging is a separate consumer boundary; this does not prove native loading.
tests/test_copilot_app_plugin.py::TestWritePlugin::test_rewrite_replaces_config Regeneration replaces changed configuration Filesystem component keep Distinct from repeating an unchanged installation.
tests/test_copilot_app_plugin.py::TestSettings::test_install_merges_only_ug_keys Installation preserves foreign settings and plugins Filesystem component keep Important ownership assertions.
tests/test_copilot_app_plugin.py::TestSettings::test_install_creates_settings First installation creates the intended settings Filesystem component keep Covers the absent-file path.
tests/test_copilot_app_plugin.py::TestSettings::test_install_is_idempotent Repeated installation produces stable settings Filesystem component keep Protects repeated public operations.
tests/test_copilot_app_plugin.py::TestSettings::test_invalid_settings_are_left_alone — malformed JSON, commented JSON, array root Unsupported settings remain untouched Filesystem component keep The parameterized cases share preservation assertions across distinct invalid inputs.
tests/test_copilot_app_plugin.py::TestSettings::test_non_object_plugin_keys_are_left_alone Wrong-type nested settings remain untouched Filesystem component keep Distinct from an invalid root document.
tests/test_copilot_app_plugin.py::TestSettings::test_copilot_home Custom Copilot home is respected Filesystem component keep Supported environment-override boundary.
tests/test_copilot_app_plugin.py::TestSettings::test_remove_leaves_no_ug_state Removal preserves foreign state and is repeatable Filesystem component keep Protects destructive ownership and idempotence.
tests/test_copilot_app_plugin.py::TestSettings::test_remove_drops_empty_keys Cleanup removes empty owned containers Filesystem component keep Complements preservation of nonempty foreign containers.
tests/test_copilot_app_plugin.py::TestSettings::test_remove_with_invalid_settings_changes_nothing Settings validation precedes plugin-directory deletion Filesystem component keep Important failure ordering across files.
tests/test_copilot_app_plugin.py::TestStatus::test_not_installed Missing settings/source reports absence Filesystem component keep Baseline installation status.
tests/test_copilot_app_plugin.py::TestStatus::test_installed Completed installation is recognized Filesystem component keep Protects the public status result.
tests/test_copilot_app_plugin.py::TestStatus::test_disabled Disabled differs from absent Filesystem component keep Distinct user-controlled state.
tests/test_copilot_app_plugin.py::TestStatus::test_missing_directory_is_not_installed Settings alone do not establish installation Filesystem component keep Partial-installation boundary.
tests/test_copilot_app_plugin.py::TestExtensionSource::test_syntax[extension.mjs] Native entry-point JavaScript parses Static subprocess keep The Node unit suite does not import this entry point.
tests/test_copilot_app_plugin.py::TestExtensionSource::test_syntax[ug-plugin.mjs] Helper JavaScript parses Static subprocess remove Parsing is already required when the behavioral suite imports this module.
tests/test_copilot_app_plugin.py::TestExtensionSource::test_node_unit_tests JavaScript behavior is exercised through pytest Test-runner bridge keep Necessary discovery bridge unless CI runs Node separately; skips when Node is unavailable.

Missing API evidence should be covered at the smallest independently runnable SDK component boundary: assert outgoing URL, wire model, authentication and routing headers, then response status and completed payload/events. Registration-state assertions alone cannot establish that contract.

After normal authorization, run uv run pytest tests/test_copilot_app.py tests/test_copilot_app_plugin.py tests/test_agent_vscode.py and just lint. For the status regression, register workspace A, then check workspace B with the same catalog; expect outdated. Once wired, manually select each Databricks provider in Copilot and require a completed response, not merely a visible model.

Scope

All changed files support the stated desktop registration and plugin outcome, including the stacked parent plugin changes. No clearly unrelated changes were found. Keeping configure, revert and CLI-status wiring out of this PR matches its stated scope; it does not resolve the catalog-loss or false-status bugs above.


Automated review by Polly · workflow run

@xi-db
xi-db force-pushed the xi-db/stack/copilot-plugin-registration branch 3 times, most recently from a311d55 to 3bc8507 Compare November 20, 2026 08:52
@xi-db xi-db changed the title copilot: register the GitHub Copilot app's Databricks providers over its local API copilot: build the GitHub Copilot app's Databricks rows and plugin providers from one catalog Nov 20, 2026
@xi-db
xi-db force-pushed the xi-db/stack/copilot-plugin-registration branch 3 times, most recently from c01c4af to aa17b6f Compare November 20, 2026 10:01
xi-db and others added 12 commits November 20, 2026 10:46
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>
@xi-db
xi-db force-pushed the xi-db/stack/copilot-plugin-registration branch from aa17b6f to ca12c6c Compare November 20, 2026 11:10
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>
@xi-db
xi-db force-pushed the xi-db/stack/copilot-plugin-registration branch from ca12c6c to 18c7403 Compare November 20, 2026 11:18
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>
@xi-db
xi-db force-pushed the xi-db/stack/copilot-plugin-registration branch from 18c7403 to 8c06e97 Compare November 20, 2026 11:38
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>
@xi-db
xi-db force-pushed the xi-db/stack/copilot-plugin-registration branch from 8c06e97 to 4c8c88f Compare November 20, 2026 12:01
- 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>
@xi-db
xi-db force-pushed the xi-db/stack/copilot-plugin-registration branch from 4c8c88f to 8fb0469 Compare November 20, 2026 12:23
- 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>
@xi-db
xi-db force-pushed the xi-db/stack/copilot-plugin-registration branch from 8fb0469 to ccb6930 Compare November 20, 2026 12:47
xi-db and others added 9 commits November 20, 2026 13:04
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>
@xi-db
xi-db force-pushed the xi-db/stack/copilot-plugin-registration branch from ccb6930 to b079e4a Compare November 20, 2026 13:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ug-review Run the automated UG review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant