Skip to content

cli: configure and launch with a custom OAuth app - #518

Draft
andy-xu-db wants to merge 1 commit into
andy-xu_data/stack/oauth-auth-token-flagfrom
andy-xu_data/stack/oauth-configure-client-id
Draft

cli: configure and launch with a custom OAuth app#518
andy-xu-db wants to merge 1 commit into
andy-xu_data/stack/oauth-auth-token-flagfrom
andy-xu_data/stack/oauth-configure-client-id

Conversation

@andy-xu-db

@andy-xu-db andy-xu-db commented Sep 8, 2026

Copy link
Copy Markdown
Collaborator

What this does

Makes the flag usable end to end: ug claude --oauth-client-id <id> — also ug codex, bare ug, and ug configure — signs in through a custom OAuth app, and every agent config it writes keeps minting from that same app.

  • Persist first, then authenticate. The login and gateway probe both read the id from state, so it's saved before they run. None inherits (like use_pat), so re-launches can drop the flag; --oauth-client-id "" reverts to the built-in app.
  • Configs pin the id rather than resolving at run time, because an agent runs its token helper as a bare command line: Claude's apiKeyHelper, Codex's auth.args (current + legacy overlay), opencode's plugin, the ucode mcp-proxy argv, both smart-routing hooks.
  • Cache guard. An --oauth-client-id that disagrees with the cached config forces a reconfigure instead of launching with a helper pointed at the other app.

No change needed in doctor.py or smart_routing/v2.py.

Rollout: the flag only picks the app — the integration itself still needs refresh_token_ttl_in_minutes = 129600, since new ones default to 10080 (7 days).

Jira: AIGTWY-4550

Testing

uv run pytest 2,349 passed (+27, same 21 pre-existing failures; 2,249 → 2,349 across the stack); ruff check, ruff format --check, ty check src/ clean. New tests cover persist-before-auth, inheritance, "" clearing, the cached-config rejection, flag forwarding for claude/codex, and the pinned id in every generated config.

🥞 Stacked PR


This pull request and its description were written by Isaac.

Persist a custom OAuth client ID per workspace, use it during configure, and pin it in Claude's apiKeyHelper. Keep other agents on host-based saved-state resolution.
@andy-xu-db
andy-xu-db force-pushed the andy-xu_data/stack/oauth-auth-token-flag branch from 82d4a9d to b66c32d Compare September 8, 2026 20:34
@andy-xu-db
andy-xu-db force-pushed the andy-xu_data/stack/oauth-configure-client-id branch from e67b5d7 to c4babd1 Compare September 8, 2026 20:35
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