Skip to content

fix: keep a valid saved OAuth account in non-interactive mode with several authorized accounts - #711

Open
pcbeingused333 wants to merge 1 commit into
QuantConnect:masterfrom
pcbeingused333:fix/oauth-saved-account
Open

pcbeingused333 wants to merge 1 commit into
QuantConnect:masterfrom
pcbeingused333:fix/oauth-saved-account

Conversation

@pcbeingused333

Copy link
Copy Markdown
Contributor

Fixes #699

Root cause. In JsonModule.config_build, the OAuth account handling drops the account saved in lean.json when it is not in the authorized list or when more than one account is authorized. The second condition exists so interactive runs ask the user to choose again, but it also applied with interactive=False, where nobody can be prompted. The valid saved account was removed and configuration failed with You are missing the following option: --<account>.

Fix. The "several accounts" rule now applies only in interactive mode. A saved account that is no longer authorized is still discarded in both modes, and an account passed on the command line is untouched.

Tests (tests/components/util/test_json_modules_handler.py): a valid saved account with several authorized accounts is kept without prompting when interactive=False (fails on master with the error above); a saved account that is no longer authorized still raises the missing-option error when non-interactive. The existing interactive tests (prompt on stale account, prompt on several accounts) still pass: 15 passed. Mocked authorization; no live OAuth flow was run.

This change was made with Claude Code.

🤖 Generated with Claude Code

…veral accounts are authorized

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
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.

OAuth: non-interactive deployment discards a valid saved account when multiple accounts are authorized

1 participant