Skip to content

fix(bots): re-authenticate a server that is still signed in - #45488

Merged
AmoabaKelvin merged 2 commits into
stablyai:mainfrom
innocarpe:fix-45339-lapsed-server-sign-in
Nov 20, 2026
Merged

AmoabaKelvin merged 2 commits into
stablyai:mainfrom
innocarpe:fix-45339-lapsed-server-sign-in

Conversation

@innocarpe

Copy link
Copy Markdown
Contributor

Problem

When a paired server's Orca sign-in lapses but the account is still signed in on that server, the desktop Sign <server> in again starts a normal sign-in. The server refuses it with "This server is already signed in. Use Switch account to change it." From that server's shell, orca auth login --switch succeeds.

Change

startBotHostSignIn sends switchAccount: true when the host's last account read is signed-in. A signed-out host, and a host whose session is reconnect-required, still starts a plain sign-in.

Verification

Renderer unit test src/renderer/src/lib/bot-host-orca-account.test.ts.

Before the change: 1 failed, 2 passed (the still-signed-in case sent switchAccount: false). Start at 20:27:21.
After the change: 3 passed. Start at 20:28:05.
oxfmt on the two changed files finished in 7ms.

Limits

The desktop was not opened against a paired server, so the approval page and the server's stored session were not exercised here. A host whose account status has not been read yet still starts a plain sign-in.

Fixes #45339

@coderabbitai

coderabbitai Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 789bf425-be8d-4dc6-9773-f7f1576ab16f
Commits

Reviewing files that changed from the base of the PR and between 8efe603 and 986dd4b.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
Walkthrough

startBotHostSignIn now sets switchAccount based on the cached host account status. The new tests cover signed-in, signed-out, and reconnect-required states, and verify that each sign-in request sets approveInBrowser to true.

Severity of issue fixed: Medium

Merge Risk: Low · previous review 8efe6

Sign-in for a paired server that is still signed in now uses the account-switch path, which fixes the reported refusal. In a narrow case where the cached account status is out of date, the plain sign-in can still be refused. This is the same behavior as before the change, so the risk is low.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: a fix that re-authenticates a server whose account is still signed in. It matches the raw summary, which says startBotHostSignIn now sends switchAccount: true for a si…
Description check Passed The description follows the template well. It covers the problem and the mechanism, which is the switchAccount change for signed-in hosts. It records the before and after test results and the untested…
Linked Issues check Passed Issue #45339 asks for a supported desktop re-authentication flow when a paired server's Orca sign-in has lapsed but the account is still signed in locally. At the reviewed head, startBotHostSignIn i…
Out of Scope Changes check Passed The PR changes two files: the startBotHostSignIn function and its doc comment in bot-host-orca-account.ts, and the new renderer test file bot-host-orca-account.test.ts. The code change is limited to…
Full details: Title check

Explanation

The title names the main change: a fix that re-authenticates a server whose account is still signed in. It matches the raw summary, which says startBotHostSignIn now sends switchAccount: true for a signed-in host. The title is specific and concise, and it follows the conventional commit style.

Full details: Description check

Explanation

The description follows the template well. It covers the problem and the mechanism, which is the switchAccount change for signed-in hosts. It records the before and after test results and the untested limits. It links issue #45339 with Fixes #45339. It explains the reason for the change. It does not complete several template sections: ELI5, the user-facing before and after, the Visual Proof section (required for behavior changes, with no before and after media or N/A reason), the Risk level, the Testing checkboxes, and the Review and Agent skill sections. These are gaps, but the core content is present.

Full details: Linked Issues check

Explanation

Issue #45339 asks for a supported desktop re-authentication flow when a paired server's Orca sign-in has lapsed but the account is still signed in locally. At the reviewed head, startBotHostSignIn in src/renderer/src/lib/bot-host-orca-account.ts sets switchAccount = entry.status?.state === 'signed-in' and passes it to orcaAccount.signIn.start with approveInBrowser: true. A signed-in host therefore sends the same switch request that orca auth login --switch sends. Signed-out, reconnect-required, and not-yet-read hosts send switchAccount: false, as the PR states. The renderer unit test in src/renderer/src/lib/bot-host-orca-account.test.ts reports 3 passing after the change, and the PR description reports 1 failing before it. The server-side acceptance of the switch and the approval page were not exercised end to end, so that part rests on the PR's stated behavior and the issue's report of the CLI behavior. No non-coding requirement remains in the linked issue.

Full details: Out of Scope Changes check

Explanation

The PR changes two files: the startBotHostSignIn function and its doc comment in bot-host-orca-account.ts, and the new renderer test file bot-host-orca-account.test.ts. The code change is limited to deriving switchAccount from the cached account status. The test covers the signed-in, signed-out, and reconnect-required cases. The change does not alter other sign-in flow logic, exported declarations, or unrelated modules. Both files connect directly to the issue objective. The diff could not be read through the repository tool because the changed blobs were missing from the checkout, so the scope judgment relies on the head file content and the PR summary.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 6f72ef4d-00cc-4935-aeff-2c18ddff0413
Commits

Reviewing files that changed from the base of the PR and between cf6cb50 and 8efe603.

Files selected for processing: 2

  • src/renderer/src/lib/bot-host-orca-account.test.ts
  • src/renderer/src/lib/bot-host-orca-account.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 5 remain after this review.

*/
export async function startBotHostSignIn(hostId: ExecutionHostId, bot?: BotRef): Promise<void> {
const entry = entryOf(hostId)
const switchAccount = entry.status?.state === 'signed-in'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Minor · Functional Correctness · Quick win

Read the host's sign-in before choosing the intent.

switchAccount uses the cached status. The notice shows the sign-in button for a cached signed-out or reconnect-required status, and the button stays enabled while a refresh runs. If the server becomes signed in before the next read, the click sends switchAccount: false. The server then refuses it with "This server is already signed in. Use Switch account to change it." The failed view shows that error, and no refresh runs after it.

The intent must reflect a current read of the server's sign-in. Choose the exact approach, such as awaiting refreshBotHostOrcaAccount before the RPC or refreshing after a refusal, from the behavior the product requires.

@AmoabaKelvin
AmoabaKelvin merged commit 50e537f into stablyai:main Nov 20, 2026
48 of 56 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.

Sign <server> in again fails for a server whose Orca sign-in lapsed

2 participants