Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
4c96710
copilot: add a Databricks plugin module for the GitHub Copilot app
xi-db Nov 20, 2026
0f5d62a
copilot: give the plugin's models the picker rows' limits and vision
xi-db Nov 20, 2026
ab7ef35
copilot: unload the plugin before deleting it, and refresh a rejected…
xi-db Nov 20, 2026
c173e57
copilot: the plugin writes ug's rows to the app's model picker
xi-db Nov 20, 2026
4489814
copilot: address review of the Copilot app plugin
xi-db Nov 20, 2026
c5c0828
copilot: move the Copilot app plugin under agents/desktop
xi-db Nov 20, 2026
1c6a416
copilot: let the plugin finish a removal when the app starts
xi-db Nov 20, 2026
7388385
copilot: delete the settings file the plugin created when it's left e…
xi-db Nov 20, 2026
86eb7e8
copilot: restart the app once after the plugin changes its picker rows
xi-db Nov 20, 2026
450d625
copilot: run the Copilot app plugin's node tests in CI
xi-db Nov 20, 2026
2c83a12
copilot: name the Copilot app plugin unity-gateway@databricks-unity-g…
xi-db Nov 20, 2026
1f43107
copilot: send the app session's id as session-id on plugin model requ…
xi-db Nov 20, 2026
d745999
copilot: find the GitHub Copilot app's pid in app-owner.pid
xi-db Nov 20, 2026
4ef47c6
copilot: wait for idle in the detached restart helper
xi-db Nov 20, 2026
d31f44f
copilot: start the Copilot app restart through ug
xi-db Nov 20, 2026
549cbfc
copilot: address review of the Copilot app plugin
xi-db Nov 20, 2026
df24d51
copilot: address the second review of the Copilot app plugin
xi-db Nov 20, 2026
9aa8ea3
copilot: stage the Copilot app plugin before swapping it in
xi-db Nov 20, 2026
83ce6f7
copilot: stop a Copilot app row sync once ug marks the plugin for rem…
xi-db Nov 20, 2026
d2343e3
copilot: register the app's Databricks providers over its local API
xi-db Nov 20, 2026
451f73e
copilot: pass the app rows' limits and vision to the plugin's models
xi-db Nov 20, 2026
509df9b
copilot: hand the app rows to the plugin instead of registering them
xi-db Nov 20, 2026
c712d85
copilot: address review of the app row builder
xi-db Nov 20, 2026
010d10e
copilot: move the GitHub Copilot app client under agents/desktop
xi-db Nov 20, 2026
b1c0fad
copilot: keep the app's GPT and open-model row ids out of Copilot's c…
xi-db Nov 20, 2026
b079e4a
copilot: treat a GitHub Copilot app without the healthcheck as an unk…
xi-db Nov 20, 2026
0e8a23c
copilot: set up the GitHub Copilot app on configure
xi-db Nov 20, 2026
3814653
copilot: move the GitHub Copilot app setup into agents/desktop/setup.py
xi-db Nov 20, 2026
928b8c3
copilot: fix the GitHub Copilot app setup's wording after the move
xi-db Nov 20, 2026
1c3e258
copilot: leave the GitHub Copilot app's removal to the plugin when th…
xi-db Nov 20, 2026
8fb3cfd
copilot: expect revert to delete the settings file ug created
xi-db Nov 20, 2026
823ac5e
copilot: show a pending GitHub Copilot app removal in status after re…
xi-db Nov 20, 2026
27b2b3a
copilot: let the GitHub Copilot app send its own User-Agent
xi-db Nov 20, 2026
a63cd86
copilot: drop revert's note about open GitHub Copilot app chats
xi-db Nov 20, 2026
e0697cd
copilot: restart the GitHub Copilot app from ug copilot-app-restart
xi-db Nov 20, 2026
292b45f
copilot: keep ug status quick when the GitHub Copilot app hangs
xi-db Nov 20, 2026
52e2b6e
copilot: keep the GitHub Copilot app to the admin's expanded model list
xi-db Nov 20, 2026
1afa027
copilot: find the recorded Databricks CLI by its Windows name in the …
xi-db Nov 20, 2026
8b9f438
copilot: quiesce the GitHub Copilot app's row sync before revert unre…
xi-db Nov 20, 2026
de7c836
copilot: skip seat-subscription provider services in the GitHub Copil…
xi-db Nov 20, 2026
3d996f0
copilot: trace GitHub Copilot app turns with Copilot's own exporter
xi-db Nov 20, 2026
37877d0
copilot: gate the app's tracing on the app's own Copilot runtime
xi-db Nov 20, 2026
5026f7d
copilot: address review of the GitHub Copilot app's tracing
xi-db Nov 20, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,10 @@ jobs:
- run: npm ci --no-audit --no-fund
- run: npm run typecheck
- run: npm test
# The GitHub Copilot app plugin's extension runs on the app's Node runtime, which has a
# global WebSocket (Node 22 and later).
- name: GitHub Copilot app plugin tests
run: node --test ../tests/*.test.mjs
# ug packs the extension from these committed files, so they must match the sources.
- name: Check the committed bundle is up to date
run: |
Expand Down
51 changes: 51 additions & 0 deletions src/ucode/agents/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -780,6 +780,55 @@ def _remove_vscode_for_managed_config() -> None:
)


_copilot_app_with_copilot = True


def request_copilot_app_with_copilot(requested: bool = True) -> None:
"""Whether configuring Copilot in this run also sets up the GitHub Copilot desktop app
(``ug configure --no-copilot-app`` passes ``False``)."""
global _copilot_app_with_copilot
_copilot_app_with_copilot = requested


_copilot_app_windows_tracing: bool | None = None


def request_copilot_app_windows_tracing(requested: bool | None) -> None:
"""Whether the GitHub Copilot app's tracing may set user-wide environment variables on
Windows (``ug configure --copilot-app-windows-tracing``); None keeps the saved choice."""
global _copilot_app_windows_tracing
_copilot_app_windows_tracing = requested


def configure_copilot_app(state: dict, *, provider: str | None, parent_schema: str | None) -> None:
"""Install ug's plugin in the GitHub Copilot desktop app when it is installed, or remove it
when the workspace's managed config turns the app off."""
from ucode.agents.desktop import setup as desktop_setup

if not desktop_setup.copilot_app_enabled():
return
if desktop_setup.copilot_app_state(state).get("copilot_app_integration") is False:
try:
result = desktop_setup.revert_copilot_app()
except OSError as exc:
print_warning(f"Could not remove ug's plugin from the GitHub Copilot app: {exc}")
return
if result not in ("not set up", desktop_setup.COPILOT_APP_DRY_RUN):
print_note(
"This workspace's managed configuration turns off the GitHub Copilot app, so "
f"ug's plugin was removed from it ({result})."
)
return
if not _copilot_app_with_copilot:
return
if not desktop_setup.copilot_app_installed():
desktop_setup.disable_copilot_app_tracing()
return
if _copilot_app_windows_tracing is not None and not is_dry_run():
state[desktop_setup.COPILOT_APP_WINDOWS_TRACING_KEY] = _copilot_app_windows_tracing
desktop_setup.configure_copilot_app(state, provider=provider, location=parent_schema)


def configure_single_tool(
tool: str,
state: dict,
Expand All @@ -806,6 +855,7 @@ def configure_single_tool(
state = _configure_one(tool, state, provider, parent_schema=parent_schema)
if with_vscode and tool == AGENT_COPILOT:
configure_vscode(state, provider=provider, parent_schema=parent_schema)
configure_copilot_app(state, provider=provider, parent_schema=parent_schema)
available_tools = list(set((state.get("available_tools") or []) + [tool]))
state["available_tools"] = available_tools
save_state(state)
Expand Down Expand Up @@ -905,6 +955,7 @@ def configure_selected_tools(
# `ug configure` sets up Copilot Chat in VS Code along with the Copilot CLI.
if tool == AGENT_COPILOT:
configure_vscode(state, provider=provider, parent_schema=parent_schema)
configure_copilot_app(state, provider=provider, parent_schema=parent_schema)

existing = state.get("available_tools") or []
state["available_tools"] = sorted(set(existing) | set(configured))
Expand Down
22 changes: 20 additions & 2 deletions src/ucode/agents/copilot.py
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,12 @@ def model_labels(


def provider_service_catalog(
state: dict, service_name: str, requested: str | None, *, tool: str = "copilot"
state: dict,
service_name: str,
requested: str | None,
*,
tool: str = "copilot",
agent: str | None = None,
) -> list[CopilotModel]:
"""The models of Model Provider Service ``service_name`` that this launch registers.

Expand All @@ -447,7 +452,7 @@ def provider_service_catalog(
service, error = resolve_provider_service(tool, service_name, workspace, token)
if error or service is None:
raise RuntimeError(error or f"Model provider service '{service_name}' was not found.")
agent = "Copilot" if tool == "copilot" else "VS Code"
agent = agent or ("Copilot" if tool == "copilot" else "VS Code")
provider_type = service["provider_type"]
named = list(service.get("targets") or [])
listed: list[str] = []
Expand Down Expand Up @@ -839,6 +844,13 @@ def render_providers_config(
# Copilot always exports metrics, which the gateway doesn't take; the proxy drops them.
OTEL_METRICS_PATH = f"{OTEL_PATH}/v1/metrics"
_INHERITED_OTEL_PREFIXES = ("OTEL_EXPORTER_OTLP_", "COPILOT_OTEL_")
# What turns on the GitHub Copilot app's trace export to the gateway. The app's MCP servers inherit
# it, so ug's own servers get it blanked.
APP_OTEL_ENV_NAMES = (
"COPILOT_OTEL_ENABLED",
"OTEL_EXPORTER_OTLP_TRACES_ENDPOINT",
"OTEL_EXPORTER_OTLP_TRACES_PROTOCOL",
)


def otel_env(proxy_base_url: str, session_secret: str | None = None) -> dict[str, str]:
Expand Down Expand Up @@ -955,6 +967,11 @@ def _parse_version(value: str) -> tuple[int, int, int] | None:
return int(major), int(minor), int(patch)


def installed_version() -> tuple[int, int, int] | None:
"""The installed Copilot CLI's version, or None without one."""
return _parse_version(agent_version(SPEC["binary"]))


def minimum_version_error() -> str | None:
installed = agent_version(SPEC["binary"])
parsed = _parse_version(installed)
Expand All @@ -976,6 +993,7 @@ def build_mcp_server_entry(argv: list[str]) -> dict:
"command": argv[0],
"args": list(argv[1:]),
"tools": ["*"],
"env": dict.fromkeys(APP_OTEL_ENV_NAMES, ""),
}


Expand Down
Loading
Loading