fix(shell): poll for the reboot result after reusing a gh account#109
Merged
Conversation
The gh-reuse success path fired restart_sidecar then did nothing — nothing re-drives auth status after the reboot (the unauthenticated state doesn't poll), so the row stayed stuck on 'Signing in…' forever. Now it polls auth-status until the rebooted sidecar reports its state: - authenticated → render it (success); - error, or back-up-but-unauthenticated → recover the row + explain (the account may lack Copilot on this host); - restart never fired (e.g. invoke swallowed by safeInvoke / a stale dev shell) → after ~20s, recover the row + 'the proxy may not have restarted'. A failed poll mid-reboot is expected and signals the restart actually happened (distinguishes 'rebooted but not signed in' from 'never rebooted'). Recovery avoids a full re-render so the message isn't cleared by loadGhAccounts. Verified separately: booting into an imported gho_ token authenticates (login + models), so the token/boot path is sound — this closes the UI gap.
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.
Fixes the stuck-UI you hit signing in as
bstucker_microsoftvia "Reuse a GitHub CLI account".Root cause (two things)
useGhAccountfiredrestart_sidecarthen did nothing. Nothing re-drives auth status after a reboot (the unauthenticated state doesn't poll), so the row stayed on "Signing in…" forever — even if the reboot had worked.app:dev: the shell process was stale relative to the rebuilt binary, so therestart_sidecarIPC silently failed (safeInvokeswallows it). The sidecar stayed on its pre-import boot; the freshly-written token sat unused. (A freshapp:devgets a clean shell with the command.)The fix
After the reboot, poll
auth-statusuntil the sidecar reports its new state, then resolve the UI:A failed poll mid-reboot is expected and signals the restart did happen — used to distinguish "rebooted but not signed in" from "never rebooted." The UI can no longer stay stuck.
Verified
tscclean.Note (separate, pre-existing)
Both this and #106's sign-out lean on
restart_sidecar; it's only ever been validated via the proxy-side--replacemechanism, not a live Tauri kill+respawn (macOS WKWebView has no WebDriver to drive it). Worth a manualapp:devconfirm thatrestart_sidecaractually bounces the sidecar — the stale-shell incident suggests we should also verify the real kill+respawn path.