Skip to content

Point the Windows Codex VS Code extension at Unity Gateway - #963

Draft
masonc08 wants to merge 2 commits into
masonc08/windows-vscode-claudefrom
masonc08/windows-vscode-codex
Draft

masonc08 wants to merge 2 commits into
masonc08/windows-vscode-claudefrom
masonc08/windows-vscode-codex

Conversation

@masonc08

@masonc08 masonc08 commented Oct 2, 2026

Copy link
Copy Markdown
Collaborator

What changed, and why?

On Windows, the Codex VS Code extension launches its bundled Codex without the ug codex profile, so it otherwise falls back to ChatGPT sign-in. When the extension is installed, ug configure now writes the gateway provider and managed default model to ~/.codex/config.toml.

The extension keeps provider-service routing headers, gets a longer auth-helper timeout, and uses an ownership record so ug revert restores only values that ug still owns. Existing user settings and alternate providers are preserved. macOS and Linux behavior is unchanged.

This is stacked on #961 for Windows-only VS Code discovery. It was extracted from #874, and the original commit authorship remains Girish Shankar.

How do you know it works?

648 focused VS Code, Codex, wrapper, and CLI tests pass. Ruff check/format, ty check src/, and git diff --check pass.

Coverage includes Windows-only activation, provider-service routing, auth timeout, conflict handling, repeated configuration, and safe revert. No live VS Code GUI journey was run.


This PR was created with GitHub MCP.

GirishS2093 and others added 2 commits October 2, 2026 15:01
The extension starts Claude from VS Code's own settings, not through `ug claude`,
so it never sees ~/.claude/ucode-settings.json and signs in to Anthropic. It can
launch Claude through a claudeCode.claudeProcessWrapper executable, so:
- Add a stdlib-only `ug-claude-vscode` console script that runs the Claude binary
  the extension passes, adding ug's --settings.
- When `ug configure` sets up Claude Code, find every VS Code / VS Code Insiders
  profile with the extension (plus the VS Code Server's Machine settings) on
  Windows, macOS and Linux, and set claudeProcessWrapper, disableLoginPrompt and,
  if unset, initialPermissionMode. settings.json files with comments and
  wrappers that aren't ug's are left alone (with the lines to add printed), and
  --dry-run writes nothing.
- `ug revert` removes only what ug added (recorded in
  ~/.ucode/vscode-claude-extension.json).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The Codex extension runs its own bundled Codex, which reads only Codex's config files and
never the ucode.config.toml layer `ug codex` passes on the command line. On Linux and
macOS the machine-wide /etc/codex/managed_config.toml already carries ug's provider to it;
on Windows (and when that privileged write is skipped) nothing does, so it asked for a
ChatGPT sign-in.

When Codex is configured and any VS Code profile or the VS Code Server has the extension
(openai.chatgpt), write the keys ug puts in the machine-wide file (model_provider, the
admin's default model, [model_providers.Databricks]) into ~/.codex/config.toml, unless the
machine-wide file already points at this gateway:
- The copy waits 30 s for `ug auth-token`: the extension's Codex starts it while itself
  starting, and on Windows that took 8-9 s, so every request timed out at 5 s.
- The admin's default model is pinned; otherwise Codex starts on the catalog's first
  entry, which the gateway may reject.
- A foreign model_provider is left alone with a warning; identical hand-added keys are
  taken over; --dry-run writes nothing.
- `ug revert` removes only those keys and restores a previous model (recorded in
  ~/.ucode/vscode-codex-extension.json).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@masonc08
masonc08 force-pushed the masonc08/windows-vscode-claude branch from e96aee0 to e2be8d0 Compare October 12, 2026 12:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants