Skip to content

copilot: readable model names in the session registry - #1219

Closed
xi-db wants to merge 11 commits into
mainfrom
xi-db/stack/copilot-readable-model-names
Closed

xi-db wants to merge 11 commits into
mainfrom
xi-db/stack/copilot-readable-model-names

Conversation

@xi-db

@xi-db xi-db commented Oct 21, 2026 •

Copy link
Copy Markdown
Collaborator

🥞 Stacked PR

Use this link to review incremental changes.


What did you change, and why?

Change: the Copilot session registry names each model with the same readable label Claude Code's picker uses (for example "GPT 5.4 Nano" or "Claude Sonnet 4.5") instead of the raw system.ai.* id, so /model and Copilot's footer are readable.

  • model_display_label moves from agents/claude.py (_picker_label) to databricks.py so Claude and Copilot share it; Claude's picker output is unchanged.
  • render_providers_config sets each model's name from it; id and wireModel stay the routable id, so --model and /model <id> are unaffected.

How is this tested?

  • tests/test_agent_copilot.py: registry entries carry the readable name.
  • Existing Claude picker tests pass unchanged.
  • Live (Copilot 1.0.98, dogfood): the footer showed "GPT 5.4 Nano" after /model dbx-responses/system.ai.gpt-5-4-nano.

Stacked on #1218.

This pull request and its description were written by Isaac.

xi-db and others added 11 commits October 20, 2026 09:47
Copilot CLI holds its provider credential for the whole session, so the
Databricks token ug passed at launch expired mid-session (the 30-minute
refresher only rewrote ~/.copilot/ucode.env, which Copilot never reads).
The token was also persisted in that file and its backup, and `ug revert`
restored it.

`ug copilot` now starts a per-session proxy on 127.0.0.1. Copilot gets the
proxy URL and a random session secret; the proxy accepts the secret only on
gateway model routes (/ai-gateway/{anthropic,mlflow/v1,openai/v1}/), swaps
it for a fresh Databricks token (CLI profile or custom OAuth), and adds the
ucode/copilot User-Agent, request tags and managed http_headers. A rejected
token is refreshed and the request retried; when refresh itself fails the
proxy answers with a "Databricks sign-in expired" error in the request's
dialect and logs to ~/.ucode/logs/copilot-proxy.log instead of the TUI.

- Configure and launch write no credential; earlier tokens are scrubbed
  from ucode.env, a token-bearing backup is dropped (also before revert),
  and ug no longer backs up its own file on reconfigure.
- The refresher thread is gone, so a running session no longer resets
  current_workspace or rewrites state.
- Ctrl-C no longer re-signals Copilot (send_signal(SIGINT) raised on
  Windows); ug waits for Copilot to exit and then stops the proxy.
- Inherited COPILOT_PROVIDER_API_KEY(_COMMAND) / _TRANSPORT are dropped so
  they can't bypass the proxy.

Tests: hermetic socket tests for the proxy (secret, path allowlist incl.
encoded traversal, header swap, refresh-and-retry, actionable 401), Copilot
unit tests, the Copilot e2e now runs through the proxy, and a new
non-blocking Copilot integration lane (Linux + Windows) with Claude and GPT
headless journeys that also assert no credential on disk.

Co-authored-by: Isaac <no-reply@databricks.com>
…fused connect

Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
… revert

Co-authored-by: Isaac <no-reply@databricks.com>
…oken

Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
….json

Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
@xi-db

xi-db commented Oct 21, 2026

Copy link
Copy Markdown
Collaborator Author

Closing: Copilot's model entries have no description field, so a readable name would replace the model id instead of sitting next to it. Keeping raw ids, as Codex does.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant