Skip to content

copilot: trace GitHub Copilot app turns with Copilot's own exporter - #1793

Draft
xi-db wants to merge 43 commits into
mainfrom
xi-db/stack/copilot-plugin-tracing
Draft

xi-db wants to merge 43 commits into
mainfrom
xi-db/stack/copilot-plugin-tracing

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

Traces GitHub Copilot desktop app turns with Copilot's own OTLP exporter, straight to the workspace's AI Gateway. Nothing of ug runs in the background: the app's runtime exports its spans itself and asks ug otel-headers for fresh headers.

It's on only when all of these hold: the experimental app flag is set, the app is set up by ug configure --agents copilot, and the workspace traces Copilot (the same copilot_otel_tracing state ug copilot uses).

What configure writes:

  • The runtime's environment: COPILOT_OTEL_ENABLED=true, OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=https://<workspace>/ai-gateway/otel/v1/traces and OTEL_EXPORTER_OTLP_TRACES_PROTOCOL=http/protobuf. The gateway ingests protobuf, and the runtime defaults to JSON. Only per-signal trace variables are set, never the generic OTEL_EXPORTER_OTLP_ENDPOINT, so metrics and logs stay off.
    • macOS and Linux: a marker-delimited block, guarded on COPILOT_RESOLVING_ENVIRONMENT, in the login profile. Only the app's environment probe exports it, not terminals.
      • bash uses the first existing of .bash_profile, .bash_login or .profile (creating .profile if none exists; never .bashrc);
      • zsh uses $ZDOTDIR/.zshenv or ~/.zshenv;
      • sh, dash and pwsh use ~/.profile (pwsh -Login sources it through /bin/sh -l);
      • fish gets a ug-owned conf.d/unity-gateway.fish;
      • any other shell gets a warning and nothing is written.
      • The block goes first in a profile that can return early. The files written, and the ones ug created, are recorded in ~/.ucode/copilot-app/tracing.json, so revert removes exactly those.
    • Windows: HKCU\Environment plus a WM_SETTINGCHANGE broadcast. That's user-wide, so every program the user runs sees it, and Windows is opt-in. It's skipped by default with a one-line hint, and turned on with a hidden ug configure --copilot-app-windows-tracing (off again with --no-copilot-app-windows-tracing). The choice is saved in the workspace's state, like other configure options, so later configures keep it. I used a hidden configure flag because ug's other opt-ins (for example --enable-server-side-web-search) are configure flags saved to state, and an environment switch would be lost on the next configure. A value the user set already is kept, with a warning.
  • ~/.copilot/settings.json: only telemetry.headersProvider = {"path": <absolute ug>, "args": ["otel-headers", "--host", <workspace>, "--profile", <profile>, "--workspace-id", <id>, "--use-pat"], "refreshIntervalMs": 1500000}, where --profile, --workspace-id and --use-pat appear only when they apply.
    • It's written through the plugin's settings writer: atomic, other keys kept, file mode kept, and an invalid file or a symlink refused.
    • The runtime ignores the WHOLE user settings file over any other user telemetry key (enabled, endpoint, filePath, protocol, resourceAttributes), which would also disable the plugin. So ug never writes those, and keeps a user's capture/captureContent.
    • A headersProvider of the user's own is left alone, and tracing stays off with a warning.
  • Headers: ug otel-headers prints Authorization: Bearer <fresh token> plus the workspace selector headers on a shared host. The trace table takes identity from the validated token and the agent from the span resource. So, like Claude's otelHeadersHelper, it needs no other ug headers. ug copilot's proxy additionally adds its User-Agent, coding-agent mode, request tags and admin headers to trace exports; those reach the gateway's request log, not the trace table.

Runtime compatibility: Copilot runtime 1.0.98 doesn't know telemetry.headersProvider. It ignores the whole settings file over it ("Unsupported local telemetry setting"), and the plugin stops loading; 1.0.104 and later accept it. Configure therefore sets tracing up only when both checks pass, and otherwise leaves it off with a warning, which ug status repeats:

  • The app's own runtime: the newest copilot-sdk-runtime-<version> the app has downloaded under the Copilot SDK's cache (github-copilot-sdk/cli/ in XDG_CACHE_HOME or ~/.cache, ~/Library/Caches, or %LOCALAPPDATA%) is 1.0.104 or later. Before the app has downloaded one, the version can't be told, so tracing waits for a configure after the app's first start.
  • An installed Copilot CLI, which shares ~/.copilot/settings.json, is 1.0.104 or later. With a current CLI, ug copilot sessions run the helper too: the session proxy accepts its session secret alongside the extra Authorization and replaces both, so nothing changes there. A user's own OTLP export from a bare copilot would also get the Databricks bearer, because the helper can't see the endpoint: it gets no OTEL_* variables.

Lifecycle:

  • Configure writes the profile block (or HKCU) and the headersProvider, then prints one line asking the user to restart the app when either changed.
  • Revert removes exactly what ug wrote (and its record directory), before the plugin, so a settings file ug created is deleted once empty. This happens immediately, even when the app is closed and the plugin's own removal is pending.
  • The same removal also runs when the workspace stops tracing Copilot, when the managed app switch is off, when the app is no longer installed, and when Windows is opted out.
  • ug status adds tracing on, tracing off (opt in with --copilot-app-windows-tracing) or tracing not set up (with a warning) to the app's row when the workspace traces Copilot.
  • Dry run changes nothing.

MCP servers: the app's MCP server children inherit the runtime's environment. ug's own ~/.copilot/mcp-config.json entries for Copilot now set the three variables to "" in their env (verified with the runtime: the server sees them empty), and ug mcp-proxy already strips OTEL_*/COPILOT_OTEL_*. Third-party MCP servers still inherit the traces variables. An OpenTelemetry-instrumented one would send its traces (not metrics or logs) to the gateway without a token and get a 401. Copilot has no Copilot-only endpoint variable to avoid this.

Code:

  • agents/desktop/shell_profile_env.py: the guarded profile block per shell.
  • os_compatibility/windows_user_env.py: HKCU values and the broadcast.
  • agents/desktop/copilot_app_tracing.py: on and off, and the record.
  • copilot_app_plugin: the headersProvider merge and removal.
  • agents/desktop/setup.py: the configure, revert and status wiring.
  • agents/copilot.py: the MCP entry env.
  • cli.py: the hidden flag.

Review fixes:

  • Windows values: a value the user had already set to ug's isn't recorded as ug's, so disable never deletes it.
  • Status: an opted-in Windows setup that isn't on reads "not set up", not the opt-in hint.
  • Revert: a failed profile write (RuntimeError) only warns, so revert continues with the other agents.

Test plan

  • uv run pytest: everything passes except the 2 test_e2e_user_agent tests, which also fail on main when run from inside an agent session. ruff check, ruff format --check and ty check src/ are clean.
  • New tests/test_copilot_app_tracing.py:
    • the profile file per shell (bash order, zsh ZDOTDIR, sh/dash/pwsh, fish conf.d, unsupported shells);
    • the block written idempotently, replaced, placed first before an early return, and removed byte for byte;
    • a real bash -l, sh -l and fish -l probe: the variables appear only with COPILOT_RESOLVING_ENVIRONMENT set;
    • the headersProvider merge and removal: other keys and capture/captureContent kept, no other telemetry key ever written, a foreign provider kept, invalid JSON and symlinks refused, the file mode kept;
    • on and off on Linux: per-shell writes, exact removal, a stale shell's block removed, a partial-write failure still revertible, an unsupported shell warning and writing nothing, the user's own headersProvider keeping tracing off;
    • the app runtime's version per OS (the newest one downloaded, or none yet), and no empty record directory left after disable;
    • a fake winreg: off by default with the hint, opt-in sets and removes, opt-out removes, a workspace change replaces ug's value, and the user's own value is kept.
  • tests/test_copilot_app_setup.py::TestTracing:
    • configure writes the env and the helper (--profile, --workspace-id, --use-pat), with the restart line only on a change;
    • tracing off, an older CLI, an unknown or older app runtime (with the status warning), revert with the app open and closed, the managed off switch and an uninstalled app all remove it;
    • status labels, dry run, and the Windows opt-in saved across runs plus the hidden flag.
  • tests/test_agent_copilot.py: the MCP entry carries the blanked env.
  • Local runtime check, outside CI: Copilot runtimes 1.0.104, 1.0.105 and 1.0.106 call the headersProvider and send its headers on the trace export to a local OTLP sink. 1.0.98 rejects the setting and ignores the whole file. An MCP server entry's env of "" reaches the server as empty.
  • Live in the app on Linux (app 1.4.2, runtime 1.0.106-8, zsh), on b3ccc58:
    • configure wrote the guarded ~/.zshenv block and only telemetry.headersProvider;
    • after a restart, a turn's spans landed with the model and turn ids, and the runtime logged no settings or export errors (379 spans, all distinct);
    • ug status showed tracing on;
    • ug's Copilot MCP entries and the running ug mcp-proxy processes had the 3 variables blank;
    • revert with the app open and closed, and tracing turned off, removed everything.

User-journey gate: a tests/integration/ journey isn't feasible within the suite's rules.

  • The app's setup runs only when the app is installed (/usr/bin/github, the macOS bundle or its Windows registration), and CI has no app.
  • Faking it would need a replacement executable or hand-written ug output: the profile block and the headersProvider in settings.json. Both are forbidden by tests/AGENTS.md, rules 1 and 3.
  • A bare-copilot journey would therefore test hand-written config, not ug. The trace export and table themselves are already covered by test_ug_copilot_tracing.py through ug copilot.
  • This needs the user-journey waiver for the app-only parts.

This pull request and its description were written by Isaac.

Comment thread src/ucode/agents/desktop/setup.py Resolved
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-tracing branch from b3ccc58 to 02783b4 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-tracing branch from 02783b4 to 9139c85 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-tracing branch from 9139c85 to 197775a 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-tracing branch from 197775a to c19d474 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-tracing branch from c19d474 to 5c44805 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-tracing branch from 5c44805 to 8e197b8 Compare November 20, 2026 12:47
xi-db and others added 2 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>
xi-db and others added 20 commits November 20, 2026 13:05
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-tracing branch from 8e197b8 to 1fd5655 Compare November 20, 2026 13:20
xi-db and others added 4 commits November 20, 2026 13:58
…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>
When the workspace traces Copilot, configure turns on the app runtime's
native OTLP export straight to the AI Gateway:
- COPILOT_OTEL_ENABLED and the per-signal traces endpoint and protobuf
  protocol, through a guarded login-profile block only the app's
  environment probe runs (bash, zsh, sh, dash, pwsh, fish), or on
  Windows, only on opt-in, the user environment;
- telemetry.headersProvider in ~/.copilot/settings.json, pointing at
  ug otel-headers, the only user telemetry key ug writes.

Revert, tracing turning off, the managed app switch and an uninstalled
app remove exactly what ug wrote. ug status shows the app's tracing.
ug's own Copilot MCP entries blank the variables their servers would
inherit. Tracing stays off with a Copilot CLI older than 1.0.104,
which ignores the whole shared settings file over headersProvider.

Co-authored-by: Isaac <no-reply@databricks.com>
The app reads ~/.copilot/settings.json with the Copilot runtime it
downloads itself, which can be older than the installed CLI, and a
runtime that rejects telemetry.headersProvider ignores the whole file,
ug's plugin included. Configure now also requires the newest runtime
the app has downloaded to be 1.0.104 or later, leaves tracing off with
a warning when it can't tell, and ug status names the reason. Disable
also removes its empty record directory.

Co-authored-by: Isaac <no-reply@databricks.com>
- On Windows, a variable the user had already set to ug's value is no
  longer recorded as ug's, so disable never deletes it; only values ug
  wrote, or recorded writing earlier, are.
- ug status tells an opted-in Windows setup that isn't on (kept values,
  another headers provider) apart from not having opted in.
- Removing the tracing setup also catches the RuntimeError a failed
  profile write raises, so ug revert and the managed off switch still
  revert everything else.

Co-authored-by: Isaac <no-reply@databricks.com>
@xi-db
xi-db force-pushed the xi-db/stack/copilot-plugin-tracing branch from 1fd5655 to 5026f7d Compare November 20, 2026 14:15
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