Skip to content

copilot: set up the GitHub Copilot app on configure - #1791

Draft
xi-db wants to merge 40 commits into
mainfrom
xi-db/stack/copilot-plugin-configure
Draft

xi-db wants to merge 40 commits into
mainfrom
xi-db/stack/copilot-plugin-configure

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

Behind UG_EXPERIMENTAL_COPILOT_APP=1, ug configure --agents copilot now 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 in agents/desktop/setup.py, beside Claude Desktop's.

  • Configure: when the app is installed (the macOS bundle, the Windows registry key, or /usr/bin/github on Linux), configure writes ug's plugin with:

    • the providers and picker rows from desired_providers();
    • the workspace, profile and auth mode;
    • absolute ug / databricks paths;
    • the headers ug copilot sends, 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).
      • No User-Agent: 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 from ug 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's settings.json isn't valid JSON, configure warns and leaves the app unchanged. If the file has user-level telemetry keys, the app's runtime rejects them and then ignores the whole file, plugin included; configure and ug status warn about that.

  • Opt-out: the hidden --no-copilot-app flag skips the app for one run, like --no-vscode.

  • Managed off switch: the copilot app_integration.enabled: false in managed config removes ug's plugin and providers, the same way revert does.

  • ug revert:

    • with the app running, it unregisters ug's providers over the app's local API, then removes the plugin and its settings.json keys (also an earlier build's unity-gateway / databricks@unity-gateway ones);
    • with the app closed, it never starts the app. It marks the plugin so the plugin's next start deletes the rows and the keys, and says the models are removed the next time the app starts;
    • a later configure, status or revert deletes the plugin directory the extension left behind.
  • 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:

    • the plugin state: installed, disabled, invalid settings, removal pending or not installed;
    • the registration state, read over the app's local API when it's running;
    • or "off (workspace-managed)".

    It warns when the rows are registered but the plugin is missing, disabled or ignored, because the app's turns fail without it.

  • databricks path: configure records the absolute databricks CLI 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's OTEL_* / 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.

    • It watches the app's session events over the local API with session channels on, waiting until no chat has a turn open and nothing has arrived for 15 s (at most 3 minutes).
    • It 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 (for example in the Windows tray), it leaves the app as it is.
    • The outcome goes to the log file the extension names.
  • 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;
    • errors from the model listing name the app instead of VS Code.

Review fixes:

  • Managed model list: the app's setup and status keep a managed model list to the admin's expansion of its <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.
  • Status timeout: ug status waits at most 3 s per step for a hung app.
  • Quiesced revert (Polly): with the app running, revert and the managed off switch first mark the plugin for removal, so no extension writes the rows again. They then delete the rows over the local API while holding the extensions' sync lock, and only then remove the keys and the plugin. A test races the extension's real sync against a revert and checks that no rows come back. A failed plugin write during configure only warns.
  • Seat-subscription provider services: a Model Provider Service that relays a GitHub Copilot seat is skipped for the app. Its swap header needs a fresh value per request, and the app's provider headers are fixed. Configure prints " uses a seat subscription, which the GitHub Copilot app doesn't support yet; use ug copilot or VS Code for it.", and ug status shows models skipped (seat subscription) with the same note.
  • Default model hint: when the workspace's managed default model (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.py
  • uv run ruff check src/ tests/, uv run ruff format --check src/ tests/, uv run ty check src/
  • New tests/test_copilot_app_setup.py. An autouse fixture keeps every test away from a real app, ~/.copilot and ~/.ucode, and fails a test that starts a process. It covers:
    • configure writes the plugin with the app rows and the merged headers, including the workspace selector but no User-Agent (in any case), and never talks to the app;
    • unreadable settings are left alone, and telemetry keys get a warning;
    • opt-out, a missing app, the experiment flag and a dry run;
    • the managed off switch;
    • revert with the app running, with it closed (removal pending), and the leftover cleanup, also from ug status after revert;
    • every status state;
    • the recorded databricks path;
    • a seat-subscription provider service skipped in configure and noted in status, a failed lookup reading as unknown, and the default-model hint (and no hint for a model the app doesn't have).
  • New tests/test_copilot_app_restart.py:
    • the target parsing;
    • the idle wait: quiet, a turn in any chat, never-idle, steady events, the app closing, no session events;
    • the close and relaunch per platform with the retry, an app that stays up, and Windows without /F;
    • the session environment allowlist, the log, and the CLI command;
    • a real watch against the fake app with session_channels=true.
  • The user-journey gate: a real journey needs the GitHub Copilot desktop app installed and signed in, which CI doesn't have, so this PR adds no tests/integration/ journey. The gate needs a maintainer decision.

This pull request and its description were written by Isaac.

Comment thread src/ucode/agents/__init__.py Resolved
Comment thread src/ucode/agents/vscode.py Resolved
Comment thread src/ucode/copilot_app_setup.py Resolved
Comment thread src/ucode/copilot_app_setup.py Resolved
Comment thread src/ucode/agents/desktop/copilot_app.py Resolved
Comment thread tests/test_copilot_app_plugin.py Resolved
@xi-db
xi-db force-pushed the xi-db/stack/copilot-plugin-configure branch from 40f5d13 to e7eab8c Compare November 20, 2026 09:19
@github-actions

Copy link
Copy Markdown
Contributor

Polly AI Review

Blocking issues

  • [P1] Preserve foreign marketplace settings — src/ucode/copilot_app_plugin/__init__.py:310: can we check ownership before replacing unity-gateway? A foreign path and plugin flag are overwritten, then deleted on revert without restoration.

  • [P2] Keep filesystem failures best-effort — src/ucode/copilot_app_setup.py:151, src/ucode/copilot_app_setup.py:196: can we catch the writer’s RuntimeError? A denied settings write otherwise aborts configure or skips the remaining revert cleanup.

  • [P2] Quiesce registration before unregistering — src/ucode/copilot_app_setup.py:185: can we disable the row writer first? An in-flight startup sync can recreate providers after deletion, before plugin removal, leaving rows behind.

  • [P2] Fix Windows test assumptions — tests/test_copilot_app_plugin.py:377, tests/test_copilot_app_setup.py:370: can we make these fixtures platform-aware? Windows lacks exact POSIX mode semantics and discovers databricks through executable suffixes.

Security vulnerabilities

  • [P1] Preserve the expanded managed model list — src/ucode/copilot_app_setup.py:73: can we avoid reloading raw wildcard sources? This replaces the caller’s expanded allow-list, causing fallback to discovered models outside the admin list.

    Both configure paths already expand managed sources. Reapplying the stored policy restores entries such as main.allowed.*; catalog construction cannot classify them and falls back to discovery. This violates the client-side managed restriction; bypass of gateway ACLs is not established.

Non-blocking notes

  • src/ucode/mcp_proxy_runtime.py:290: is dropping every OTEL_* variable intended for all MCP clients? The stated motivation concerns the Copilot app, but this also changes other agents.

  • tests/test_copilot_app_plugin.py:309: can test_copilot_home call the real resolver? The autouse fixture replaces it with a lambda, so the test cannot detect broken product handling of COPILOT_HOME.

  • tests/test_copilot_app_plugin.py:422: can test_node_unit_tests reject all-skipped runs? The row suite silently skips without global WebSocket; native picker and completed-response evidence also remains unverified.

Approach

Native provider and token hooks avoid another forwarding proxy. Reuse the caller’s expanded managed state and the existing _owns_marketplace() check rather than introducing separate policy and ownership interpretations.

Summary

Diff size (computed): 29 files; +3782 / -8 lines (3790 changed text lines); 0 binary files.

Category Files Added Deleted Share of changed text lines
Tests and test support 12 2094 0 55.3%
Documentation 0 0 0 0.0%
Dependencies and lockfiles 0 0 0 0.0%
Implementation / other 17 1688 8 44.7%

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

The 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.

Tests

Test-by-test assessment

Static 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.

Test / case Behavior protected Layer Needed? Action / rationale
tests/conftest.py — _isolate_ucode_state additions Isolates app discovery, settings, plugin paths, and experimental state Fixture keep Retain isolation, but use a temporary COPILOT_HOME instead of replacing its product resolver.
tests/test_managed_setup.py — _full_manifest Managed app-switch serialization round-trip Fixture keep Existing TestRoundTrip.test_full_manifest_round_trips already checks the complete manifest.
tests/test_copilot_app.py — FakeApp, app, seed, _app_providers, _healthcheck Controllable Python-side app protocol, refusals, and disconnects Helper keep Necessary component boundary; separate from the JavaScript client’s fake.
tests/test_copilot_app.py — _by_name No exercised behavior Helper remove Unused in the snapshot.
tests/test_copilot_app_plugin.py — _config, home, _settings, NODE, PLUGIN_SOURCE Plugin inputs, temporary files, and Node invocation Helper keep Small shared setup; retain actual path-resolution behavior where possible.
tests/test_copilot_app_setup.py — _app_home, app, _settings_path, _settings, _extension_config, _out, _register Isolated setup and prohibition on background process creation Fixture/helper keep Explicit inputs and the process-spawn guard protect the configure contract.
tests/copilot_app_rows.test.mjs — encode, parser, FakeApp, providerRows, setup, ROWS, file-level skip JavaScript protocol boundary and temporary registration state Helper keep Require a compatible Node runtime in CI or fail when the suite entirely skips.
tests/copilot_app_plugin.test.mjs — config, jwt Token-command and expiry inputs Helper keep Minimal reusable inputs for token lifecycle cases.
tests/copilot_app_plugin.test.mjs — jwtExpiryMs reads exp and tolerates opaque tokens JWT expiry and opaque-token fallback Unit keep Protects both OAuth and PAT token lifetimes.
tests/copilot_app_plugin.test.mjs — childEnv puts the Databricks CLI's dir on PATH Recorded CLI directory precedence Unit consolidate Combine with childEnv puts the configured dirs ahead of PATH, retaining both directory sources.
tests/copilot_app_plugin.test.mjs — childEnv puts the configured dirs ahead of PATH Configured directory precedence and environment preservation Unit consolidate One input can protect both PATH ordering and preservation of unrelated variables.
tests/copilot_app_plugin.test.mjs — createTokenSource caches until shortly before expiry Token reuse and refresh margin Unit keep Distinct expiry-boundary behavior prevents unnecessary helper processes.
tests/copilot_app_plugin.test.mjs — createTokenSource gives opaque tokens a default lifetime Non-JWT token cache lifetime Unit keep Covers the separate opaque-token path.
tests/copilot_app_plugin.test.mjs — concurrent requests share one mint, and a failure is not cached Single-flight minting and retry after failure Unit keep Guards concurrency and sticky authentication failures.
tests/copilot_app_plugin.test.mjs — withLoginHint shows the hint once per run of failures Login-hint suppression and reset after success Unit keep Protects user-visible recovery behavior.
tests/copilot_app_plugin.test.mjs — withLoginHint still throws the token error when the hint fails Original authentication error survives hint failure Unit keep Meaningful failure-path assertion.
tests/copilot_app_plugin.test.mjs — withLoginHint tries again until a hint is shown Hint retry before a session exists Unit keep Distinct startup boundary from ordinary hint suppression.
tests/copilot_app_plugin.test.mjs — hintFor picks the hint by how ug auth-token failed Missing executable, command failure, and timeout classification Unit keep Protects actionable recovery messages.
tests/copilot_app_plugin.test.mjs — an invalidate during a mint keeps its token out of the cache In-flight invalidation race Unit keep Sequential invalidation does not cover this race.
tests/copilot_app_plugin.test.mjs — buildProviders attaches the token provider to every provider Provider authentication attachment without mutation Unit keep Required bearer-token contract; assert every provider, not only the first.
tests/copilot_app_plugin.test.mjs — invalidate drops the cached token and force-refreshes the next mint once One forced refresh after invalidation Unit keep Protects recovery without repeatedly forcing authentication.
tests/copilot_app_plugin.test.mjs — isAuthRejection matches only 401 errors and call failures Authentication-event classification Unit keep Distinguishes token rejection from unrelated failures; broader status semantics are unverified.
tests/copilot_app_rows.test.mjs — readEndpoint reads the first value of each run file and honours COPILOT_HOME Run-file parsing and home override Unit keep Exercises real JavaScript endpoint resolution.
tests/copilot_app_rows.test.mjs — syncOnce writes the rows, then does nothing until they or the app launch change Registration, request identity, and digest suppression Component keep Core registration path with observable protocol assertions.
tests/copilot_app_rows.test.mjs — syncOnce deletes ug's stale providers and rows but no one else's Ownership-scoped reconciliation Component keep Protects foreign providers and stale-row removal.
tests/copilot_app_rows.test.mjs — repeated syncs leave exactly one copy of each row Concurrent upsert idempotence Component keep Separate state directories distinguish this from lock coverage.
tests/copilot_app_rows.test.mjs — only one extension process syncs at a time; a stale lock is taken over Mutual exclusion and stale-lock recovery Component keep Extend with deterministic synchronization against revert to protect the demonstrated race.
tests/copilot_app_rows.test.mjs — a reply for another request is skipped Reply correlation Component keep JavaScript implementation needs its own protocol coverage.
tests/copilot_app_rows.test.mjs — an error without a request_id answers the pending request Uncorrelated protocol errors terminate the request Component keep Prevents waiting until timeout on format errors.
tests/copilot_app_rows.test.mjs — the sync retries while the app applies another change Busy-response recovery Component keep Distinct transient application failure.
tests/copilot_app_rows.test.mjs — failures are logged, never thrown, and the next run retries Nonfatal background failure and subsequent retry Component keep Protects extension startup and recovery.
tests/copilot_app_rows.test.mjs — a closed app or a stale token is not synced Missing endpoint, rejected token, and dead endpoint Component keep Material connection and authentication boundaries.
tests/copilot_app_rows.test.mjs — no app rows in the config means nothing to sync Empty or older configuration avoids connection Component keep Protects compatibility and no-work behavior.
tests/test_cli.py — TestStatus.test_status_shows_the_copilot_app_row_and_its_warnings Status rendering and warning propagation CLI keep Presentation boundary; also assert provider/location forwarding.
tests/test_cli.py — TestStatus.test_status_shows_the_copilot_app_turned_off_by_managed_config Managed-off state reaches CLI output CLI keep Crosses real managed layering into presentation.
tests/test_cli.py — TestRevert.test_reports_the_copilot_app variants removed, not set up, failed: x Revert result and open-chat message CLI keep Add an actual wrapped-writer failure and verify later cleanup continues.
tests/test_copilot_app.py — TestDesiredProviders.test_the_plugin_gets_the_app_rows_ids Plugin/picker identity and model-field parity Unit consolidate Move unique ID/base-URL assertions into TestPluginRows.test_the_plugin_rows_and_the_picker_rows_agree.
tests/test_copilot_app.py — TestDesiredProviders.test_the_plugin_config_names_the_app_providers Config provider/model pairs match picker rows Unit keep Setup coverage checks provider IDs, not every model pair.
tests/test_copilot_app.py — TestDesiredProviders.test_the_three_wires Routes, wire APIs, authentication kinds, and placeholder key Unit keep Distinct protocol contracts belong at this layer.
tests/test_copilot_app.py — TestDesiredProviders.test_a_model_provider_service_uses_the_openai_route_and_its_header Provider-service route and header Unit keep Separate provider-source behavior.
tests/test_copilot_app.py — TestDesiredProviders.test_a_wire_without_models_gets_no_provider Empty wire is omitted Unit keep Prevents unusable picker providers.
tests/test_copilot_app.py — TestDesiredProviders.test_two_models_with_one_copilot_id_keep_the_first Mapped model-ID collision Unit keep Different collision source from duplicate-region models.
tests/test_copilot_app.py — TestDesiredProviders.test_a_claude_service_gets_the_id_of_the_model_behind_it Served-model identity for custom services Unit keep Protects valid custom Claude services from omission.
tests/test_copilot_app.py — TestDesiredProviders.test_a_claude_route_model_without_a_claude_id_is_skipped_with_a_warning Unsupported Claude identity is skipped visibly Unit keep Meaningful classification failure path.
tests/test_copilot_app.py — TestDesiredProviders.test_a_duplicate_is_skipped_with_a_warning Duplicate IDs retain one model and explain omission Unit keep Covers a distinct catalog collision.
tests/test_copilot_app.py — TestDesiredProviders.test_state_providers_use_the_vscode_catalog Shared catalog source and provider forwarding Unit keep Protects reuse, but does not cover raw wildcard re-resolution.
tests/test_copilot_app.py — TestPluginRows.test_the_plugin_writes_the_app_rows Row identities and owned-provider set Unit keep Ownership IDs control reconciliation and deletion.
tests/test_copilot_app.py — TestPluginRows.test_the_plugin_rows_and_the_picker_rows_agree Model metadata, limits, and vision parity Unit keep Canonical parity test; absorb the overlapping identity assertions.
tests/test_copilot_app.py — TestPluginRows.test_only_chat_completions_models_turn_off_reasoning_effort Wire-specific capability flags Unit keep Guards incompatible request capabilities.
tests/test_copilot_app.py — test_unregister_deletes_only_ugs_providers Owned-only deletion and repeat unregister Component keep Required destructive-operation boundary.
tests/test_copilot_app.py — TestStatus.test_registered_outdated_and_not_registered Registration state classification Component keep Protects the status state machine.
tests/test_copilot_app.py — TestStatus.test_another_workspace_or_changed_rows_are_outdated Base-URL and row drift Component keep Meaningful registration comparisons.
tests/test_copilot_app.py — TestStatus.test_a_row_the_user_added_counts_as_outdated Unexpected row under an owned provider Component keep Distinct set-mismatch case.
tests/test_copilot_app.py — TestStatus.test_a_listed_model_without_an_id_is_ignored Malformed listed model tolerance Component keep Protects against incomplete app responses.
tests/test_copilot_app.py — TestStatus.test_a_closed_app_is_not_running Status returns a nonrunning result Component keep Return-value contract differs from unregister’s exception.
tests/test_copilot_app.py — TestStatus.test_an_app_that_quits_mid_check_is_not_running Status connection loss Component keep Distinct mid-operation failure.
tests/test_copilot_app.py — test_retries_while_the_app_applies_another_change Python-client busy-response retry Component keep Separate implementation from JavaScript retry handling.
tests/test_copilot_app.py — test_a_refusal_stops_the_unregister Explicit refusal propagates Component keep Prevents false successful cleanup.
tests/test_copilot_app.py — test_every_request_carries_a_request_id Unique request identity Component keep Necessary for reply correlation.
tests/test_copilot_app.py — test_a_reply_not_for_this_request_is_skipped variants another-request-id, no-request-id Stray reply rejection Component keep Both variants protect the same matching contract.
tests/test_copilot_app.py — test_an_error_for_another_request_is_skipped Unrelated error rejection Component keep Different from an error without a request ID.
tests/test_copilot_app.py — test_an_error_without_a_request_id_answers_the_pending_request Format error ends the pending request Component keep Protects against timeout stalls.
tests/test_copilot_app.py — test_an_app_that_quits_mid_unregister_is_not_running Disconnect during deletion Component keep Drives actionable retry reporting.
tests/test_copilot_app.py — test_an_unknown_app_version_warns_and_continues Version-warning behavior Component keep Protects compatibility without a hard failure.
tests/test_copilot_app.py — test_a_verified_app_version_is_quiet No warning for verified version Component keep Negative control for version warnings.
tests/test_copilot_app.py — test_a_closed_app_is_not_running Unregister raises for missing or stale endpoints Component keep Different public contract from status.
tests/test_copilot_app.py — test_a_port_file_of_an_exited_app_is_not_running PID validation prevents stale-port connection Component keep Important local endpoint boundary.
tests/test_copilot_app.py — test_the_token_is_url_encoded Endpoint token encoding Component keep Protects tokens containing query delimiters.
tests/test_copilot_app.py — test_a_rejected_token_is_an_app_error Handshake authentication refusal Component keep Distinguishes refusal from an absent app.
tests/test_copilot_app_plugin.py — TestExtensionConfig.test_providers_keep_ids_wires_and_headers Native-session provider serialization Unit keep Protects the provider API input contract.
tests/test_copilot_app_plugin.py — TestExtensionConfig.test_models_match_the_picker_rows Session model identities and provider order Unit keep Session models must agree with registered picker rows.
tests/test_copilot_app_plugin.py — TestExtensionConfig.test_models_repeat_the_rows_limits_and_vision Session capability serialization Unit keep Picker metadata alone does not configure session limits.
tests/test_copilot_app_plugin.py — TestExtensionConfig.test_a_small_output_limit_is_left_to_the_runtime Small output limits are not over-advertised Unit keep Guards a concrete runtime capability boundary.
tests/test_copilot_app_plugin.py — TestExtensionConfig.test_reasoning_effort_can_be_turned_off Reasoning capability serialization Unit keep Covers explicit false versus absent capability.
tests/test_copilot_app_plugin.py — TestExtensionConfig.test_app_rows_and_databricks_path Registration inputs and recorded CLI path Unit keep Inputs feed separate runtime components.
tests/test_copilot_app_plugin.py — TestExtensionConfig.test_a_pat_token_command_and_hint PAT helper arguments and recovery hint Unit keep Distinct authentication mode.
tests/test_copilot_app_plugin.py — TestExtensionConfig.test_a_custom_oauth_token_command_and_hint Custom OAuth arguments with/without profile Unit keep Distinct authentication configuration.
tests/test_copilot_app_plugin.py — TestExtensionConfig.test_a_missing_ug_hint_names_its_path Missing-helper diagnostic Unit keep Gives a concrete recovery target.
tests/test_copilot_app_plugin.py — TestExtensionConfig.test_token_command_and_hint_name_the_workspace_and_profile Absolute helper path, workspace, profile, and PATH inputs Unit keep Core authentication command contract.
tests/test_copilot_app_plugin.py — TestExtensionConfig.test_without_profile Profile omission Unit consolidate Add a no-profile variant to test_token_command_and_hint_name_the_workspace_and_profile.
tests/test_copilot_app_plugin.py — TestExtensionConfig.test_trailing_slash_on_workspace Provider URL normalization Unit keep This serializer performs its own normalization.
tests/test_copilot_app_plugin.py — TestWritePlugin.test_layout Discoverable marketplace/plugin/source layout Component keep Filesystem layout is an external app contract.
tests/test_copilot_app_plugin.py — TestWritePlugin.test_rewrite_replaces_config Reconfiguration replaces generated configuration Component keep Extend with a workspace A-to-B rewrite, including selectors.
tests/test_copilot_app_plugin.py — TestSettings.test_install_merges_only_ug_keys Settings ownership and preservation Component keep Add a foreign same-name marketplace collision; unrelated keys alone miss the bug.
tests/test_copilot_app_plugin.py — TestSettings.test_install_creates_settings First-run settings creation Component keep Separate from merging an existing file.
tests/test_copilot_app_plugin.py — TestSettings.test_install_is_idempotent Stable repeated installation Component keep Protects repeated configure behavior.
tests/test_copilot_app_plugin.py — TestSettings.test_invalid_settings_are_left_alone variants malformed JSON, commented JSON, non-object JSON Invalid settings and plugin files remain unchanged Component keep Appropriate lowest layer for the input matrix.
tests/test_copilot_app_plugin.py — TestSettings.test_non_object_plugin_keys_are_left_alone Invalid plugin-key shape is preserved Component keep Exercise install(), not only enable(), and assert no plugin directory is written.
tests/test_copilot_app_plugin.py — TestSettings.test_copilot_home Settings-directory override Component keep Fix isolation so this calls the actual product resolver.
tests/test_copilot_app_plugin.py — TestSettings.test_remove_leaves_no_ug_state Owned keys/files removed and repeat removal is harmless Component keep Core revert behavior.
tests/test_copilot_app_plugin.py — TestSettings.test_remove_drops_the_keys_before_the_directory Disable, unload wait, then file removal Component keep Protects removal ordering; provider deletion needs separate race coverage.
tests/test_copilot_app_plugin.py — TestSettings.test_remove_without_keys_deletes_the_directory_at_once No unnecessary unload delay Component keep Distinct no-registration path.
tests/test_copilot_app_plugin.py — TestSettings.test_remove_keeps_a_foreign_unity_gateway_marketplace Foreign marketplace preservation Component keep Retain and add the corresponding installation collision.
tests/test_copilot_app_plugin.py — TestSettings.test_a_symlinked_settings_file_is_refused Refuses linked settings without changing the target Component uncertain Security assertion is useful; verify Windows symlink privileges or skip only when unavailable.
tests/test_copilot_app_plugin.py — TestSettings.test_rewriting_settings_keeps_their_mode File mode preservation Component keep Compare the supported pre-write mode or restrict exact POSIX assertions to POSIX.
tests/test_copilot_app_plugin.py — TestSettings.test_remove_drops_empty_keys Empty owned containers are removed Component remove Already asserted by test_remove_drops_the_keys_before_the_directory.
tests/test_copilot_app_plugin.py — TestSettings.test_remove_with_invalid_settings_changes_nothing Failed settings cleanup preserves plugin files Component keep Avoids deleting files while enablement keys remain.
tests/test_copilot_app_plugin.py — TestStatus.test_not_installed Absent-plugin status Component keep Baseline status branch.
tests/test_copilot_app_plugin.py — TestStatus.test_installed Installed-plugin status Component keep Positive status branch.
tests/test_copilot_app_plugin.py — TestStatus.test_disabled User-disabled plugin status Component keep Drives a distinct actionable warning.
tests/test_copilot_app_plugin.py — TestStatus.test_missing_directory_is_not_installed Settings without plugin files Component keep Detects partial removal.
tests/test_copilot_app_plugin.py — TestExtensionSource.test_syntax variants extension.mjs, ug-plugin.mjs, app-rows.mjs Shipped JavaScript parses Smoke keep Syntax alone does not exercise extension.mjs session/event orchestration.
tests/test_copilot_app_plugin.py — TestExtensionSource.test_node_unit_tests variants copilot_app_plugin.test.mjs, copilot_app_rows.test.mjs Node suites participate in pytest Test bridge keep Require compatible Node in CI and detect entirely skipped suites.
tests/test_copilot_app_setup.py — TestConfigure.test_installs_the_plugin_with_the_app_rows Generated plugin contents, paths, and configure message Component keep Add raw wildcard policy with already-expanded caller state and wrapped-writer failure cases.
tests/test_copilot_app_setup.py — TestConfigure.test_never_talks_to_the_running_app Configure avoids app API calls Component keep Direct assertion of the no-contact contract.
tests/test_copilot_app_setup.py — TestConfigure.test_the_plugin_sends_ugs_copilot_headers Routing, admin, provider-service, and attribution header construction Component keep Proves configuration values, not actual outgoing requests or usage attribution.
tests/test_copilot_app_setup.py — TestConfigure.test_the_plugin_selects_the_saved_workspace_on_a_shared_host Saved workspace selector reaches plugin headers Component keep Meaningful selector coverage; add the required new-client case beside TestHelperArgv.
tests/test_copilot_app_setup.py — TestConfigure.test_an_admin_header_cant_select_another_workspace Workspace selectors override conflicting admin headers Component keep Protects the selected-workspace boundary.
tests/test_copilot_app_setup.py — TestConfigure.test_records_the_databricks_cli_for_helpers_without_it_on_path Absolute CLI path persistence Component keep Distinct from subsequent executable discovery.
tests/test_copilot_app_setup.py — TestConfigure.test_unreadable_settings_are_left_alone variants malformed/non-object JSON Configure warning and unchanged settings Component consolidate Retain one orchestration case; keep the full matrix in TestSettings.test_invalid_settings_are_left_alone.
tests/test_copilot_app_setup.py — TestConfigure.test_warns_about_telemetry_keys_that_disable_the_plugin Warning for app-rejected telemetry settings Component keep Explicit failure-mode requirement.
tests/test_copilot_app_setup.py — TestConfigure.test_no_models_skips_the_app Empty catalog skips optional integration Component keep Protects graceful setup behavior.
tests/test_copilot_app_setup.py — TestConfigureCopilotApp.test_sets_up_the_installed_app Dispatcher’s positive installation path Component consolidate Parameterize with test_opt_out_and_a_missing_app_skip_it, retaining this positive control.
tests/test_copilot_app_setup.py — TestConfigureCopilotApp.test_opt_out_and_a_missing_app_skip_it One-run opt-out and app absence Component keep Add the positive control from test_sets_up_the_installed_app.
tests/test_copilot_app_setup.py — TestConfigureCopilotApp.test_without_the_experiment_flag_nothing_changes Configure/status experimental gate Component keep Revert’s separate behavior is not established by this test.
tests/test_copilot_app_setup.py — TestConfigureCopilotApp.test_managed_off_switch_removes_the_plugin_and_providers Managed disablement performs cleanup Component keep Distinct state transition.
tests/test_copilot_app_setup.py — TestConfigureCopilotApp.test_managed_off_switch_reads_the_managed_config Persisted managed switch is honored Component keep Keep while preventing raw model-source re-resolution.
tests/test_copilot_app_setup.py — TestRemove.test_unregisters_the_running_app_and_removes_the_plugin Running-app cleanup Component keep Add wrapped settings-write failure and continuation assertions.
tests/test_copilot_app_setup.py — TestRemove.test_a_closed_app_keeps_its_rows_until_revert_runs_again Closed-app cleanup and stale-row guidance Component keep Explicit deferred-cleanup contract.
tests/test_copilot_app_setup.py — TestRemove.test_a_second_revert_after_opening_the_app_removes_the_rows Cleanup retry after plugin files are gone Component keep Distinct repeated-run transition.
tests/test_copilot_app_setup.py — TestRemove.test_nothing_set_up No-op removal Component keep Consider a flag-off, app-running counterpart to document cleanup scope.
tests/test_copilot_app_setup.py — TestStatus.test_installed_and_registered Healthy app status Component keep Baseline orchestration result.
tests/test_copilot_app_setup.py — TestStatus.test_registered_rows_without_the_plugin_fail Orphaned registration warning Component keep Detects rows that cannot authenticate turns.
tests/test_copilot_app_setup.py — TestStatus.test_a_disabled_plugin Disabled-plugin warning Component keep Distinct remediation from missing files.
tests/test_copilot_app_setup.py — TestStatus.test_invalid_settings Invalid-settings status Component keep User-visible failure classification.
tests/test_copilot_app_setup.py — TestStatus.test_telemetry_keys_are_reported Ignored-settings warning and unknown registration state Component keep Protects telemetry rejection reporting.
tests/test_copilot_app_setup.py — TestStatus.test_another_workspace_is_out_of_date Different workspace URL produces warning Component keep Adds presentation assertions beyond protocol-level drift detection.
tests/test_copilot_app_setup.py — TestStatus.test_status_prints_no_version_warning Quiet status on unverified versions Component keep Separate status compatibility behavior.
tests/test_copilot_app_setup.py — TestStatus.test_managed_off Managed-off status label Component keep Isolates label logic beneath CLI coverage.
tests/test_copilot_app_setup.py — TestStatus.test_not_installed_and_never_set_up No unnecessary app status row Component keep Protects users without the app.
tests/test_copilot_app_setup.py — test_ignored_settings_reason_names_only_rejected_telemetry_keys Only rejected keys are reported Unit keep Prevents false warnings about accepted settings.
tests/test_copilot_app_setup.py — test_a_recorded_databricks_cli_is_found_off_path Saved CLI path is used when absent from PATH Unit keep Reuse platform-aware executable setup; extensionless fixture fails Windows discovery.
tests/test_copilot_app_setup.py — test_configure_no_copilot_app_opts_out_for_the_run Hidden CLI option is accepted and forwarded CLI keep Complements dispatcher opt-out behavior.
tests/test_copilot_app_setup.py — test_a_missing_catalog_names_the_app Catalog error names the correct client Unit keep Covers the changed error-context parameter.
tests/test_copilot_app_setup.py — test_a_dry_run_changes_nothing No writes or app traffic during dry run Component keep Distinct safety contract across setup and removal.
tests/test_managed_config.py — test_copilot_app_integration_is_carried Wire switch normalizes into internal configuration Unit keep Correct layer for the managed API shape.
tests/test_managed_resolve.py — test_disabled_copilot_app_overrides_copilot_state False disables integration; true/unset preserve state Unit keep Focused managed-layering coverage.
tests/test_mcp_proxy_cli.py — test_proxy_drops_the_app_runtimes_trace_exporter_env Exporter environment filtering preserves unrelated variables Unit keep Clarify broad scope; register inherited matching variables with monkeypatch before product deletion so teardown restores them.
tests/test_system_cross_os.py — test_process_running Current, exited, and invalid PID handling OS component keep Real process boundary is appropriate; Windows execution remains unverified.

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.

Scope

No 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 src/ucode/mcp_proxy_runtime.py:290: environment filtering affects every MCP client, while the supplied motivation is app-specific. The truncated description may omit that connection; it needs clarification rather than a blocking unrelated-work conclusion.


Automated review by Polly · workflow run

@xi-db
xi-db force-pushed the xi-db/stack/copilot-plugin-configure branch 2 times, most recently from ec3d0b4 to 1aa0951 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-configure branch from 3ca34d8 to efe50b7 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-configure branch from efe50b7 to 79a7531 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-configure branch from 79a7531 to e48e005 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-configure branch from e48e005 to 5b8a11b 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-configure branch from 5b8a11b to d6386d7 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-configure branch from d6386d7 to 70ed5a0 Compare November 20, 2026 12:47
xi-db and others added 22 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>
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>
@xi-db
xi-db force-pushed the xi-db/stack/copilot-plugin-configure branch from 70ed5a0 to 8b9f438 Compare November 20, 2026 13:20
…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>
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