refactor(auth): share OAuth session setup shell - #777
Closed
beruro wants to merge 1 commit into
Closed
Conversation
Collaborator
Author
|
Superseded by #780, which preserves this change as an independent commit and has passed the consolidated CI suite. The source branch is retained for recovery. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Claude Code and Codex session setup duplicated the same OAuth WebView workflow and UI: local browser intent, delayed native start, success collapse, external close handling, retry, loading/error/success surfaces, progress indicators, alerts, and debug chrome. Provider fixes could drift even though only token response mapping and copy differ.
Solution
Introduce one OAuth session setup shell and a render-only view. Provider adapters keep their existing typed capture hooks and credential mapping, then supply normalized capture state and localized copy to the shell. The shared lifecycle preserves idle → requested → starting/loading → open → success/error → retry/close behavior, preserves Codex auto-start, coalesces duplicate retry clicks, and keeps timer/native WebView cleanup at the owning boundary. Add localized names for icon-only refresh/close controls, status/alert semantics, and
aria-currentfor the active step.Potential risks
A shared shell means a lifecycle regression could affect both providers. The extracted transition predicates, parent render gates, OAuth parsing, and WebView position lifecycle are covered by focused tests; provider-specific response mapping remains unchanged and typechecked. The actual native WebView plus live OAuth exchange was not manually exercised in this environment, so desktop-runtime integration remains the main unverified path. Rollback is a single-commit revert.
Lifecycle and ownership
Architecture and UI audit
docs/frontend-ui-audit-2026-08-11/OAuthSessionSetup.md.Verification
pnpm exec vitest run src/features/SessionSetup/components/OAuthSessionSetupShell.test.ts src/hooks/workStation/sessionCapture/__tests__/useOAuthCapture.test.ts src/hooks/workStation/sessionCapture/__tests__/useWebviewPositionSync.test.ts— 3 files, 43 tests passed.pnpm exec eslint src/features/SessionSetup/components/OAuthSessionSetupShell.tsx src/features/SessionSetup/components/OAuthSessionSetupShell.test.ts src/features/SessionSetup/components/ClaudeCodeSessionSetup/index.tsx src/features/SessionSetup/components/CodexSessionSetup/index.tsx— passed.pnpm exec prettier --check ...for the four source/test files and audit report — passed.pnpm typecheck— full TypeScript check executed and passed.git diff --check— passed.verify:quickorverify:final, so focused tests/lint plus the full typecheck entry point were used.