Skip to content

fix: resume provider setup after successful ByteRover OAuth login#466

Merged
bao-byterover merged 1 commit intocampfirein:mainfrom
AmElmo:fix/resume-provider-setup-after-oauth-login
Apr 21, 2026
Merged

fix: resume provider setup after successful ByteRover OAuth login#466
bao-byterover merged 1 commit intocampfirein:mainfrom
AmElmo:fix/resume-provider-setup-after-oauth-login

Conversation

@AmElmo
Copy link
Copy Markdown
Contributor

@AmElmo AmElmo commented Apr 20, 2026

Summary

Fixes #464.

After a successful ByteRover OAuth login, the provider flow always returned the user to the provider selection list, instead of resuming the in-progress ByteRover setup. The OAuth callback succeeded and isAuthorized flipped to true, but the post-login state transition discarded the previously selected provider — so the user had to re-select ByteRover from the list to actually finish setup.

This PR makes the CLI auto-continue with the connect/activate flow once login succeeds, matching the standard pattern in gh auth login, vercel login, supabase login, etc.

Approach

  • New pure helper derivePostLoginAction (src/tui/features/provider/utils/derive-post-login-action.ts) — discriminated-union return type encoding the three transitions (connect ByteRover, return to selection with error, return to selection). Mirrors the existing deriveAppViewMode pattern in the onboarding feature.
  • 5 new unit tests for the helper using the same chai/mocha style as derive-app-view-mode.test.ts.
  • provider-flow.tsxhandleLoginComplete now delegates to the helper and runs the same connect → setActive → onComplete sequence used in handleSelect for fresh ByteRover connections.

The duplicated connect/activate sequence between handleSelect and handleLoginComplete is intentional in this PR — kept the diff narrow. Happy to extract a shared helper if you'd prefer.

Test plan

  • npm run lint — 0 errors (1 pre-existing warning on provider-flow.tsx complexity, unchanged by this diff)
  • npm run typecheck — clean
  • npm run build — clean
  • npm test — 6424 passing, 0 failing (incl. 5 new tests for derivePostLoginAction)
  • Manual verification on macOS ARM64: select ByteRover during onboarding → browser login → CLI auto-continues to "Connected to ByteRover" without showing the provider list again

Closes #464

After a successful OAuth login, the provider flow always returned the user
to the provider selection list, instead of resuming the in-progress
ByteRover setup. The login callback succeeded and isAuthorized flipped to
true, but the post-login state transition discarded the previously
selected provider.

Extract a pure derivePostLoginAction helper (mirrors the deriveAppViewMode
pattern) that decides the next transition: connect+activate ByteRover when
authorized, return to selection with an error otherwise. Wire it into
handleLoginComplete so the connect/activate path now runs automatically.

Closes campfirein#464
Copy link
Copy Markdown
Collaborator

@bao-byterover bao-byterover left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @AmElmo , will merge and ship in next release.

@bao-byterover bao-byterover merged commit 6878a58 into campfirein:main Apr 21, 2026
6 checks passed
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.

ByteRover onboarding does not resume provider setup after successful OAuth login

2 participants