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

オープン
#699 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 2 日以内に返信

@pcbeingused333 がすでに取り組んでいます。

2026年11月4日 から。

  • #711 @pcbeingused333 による — オープン

評価

難易度
3/5
見積もり時間
半日
初心者へのやさしさ
62/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
python

調査の方向性

The bug is in the OAuth account handling in lean/models/json_module.py, which drops a saved account when several accounts are authorized, even with interactive=False. Start from that account-selection logic and the config_build path that reports the missing --example-account option. Done when a valid saved account survives multiple authorized accounts, an invalid saved account is still discarded, and an explicit command-line account still overrides the saved one, with regression tests covering all three.

索引モデルが issue の本文から書いたものです。

説明

Problem

A non-interactive OAuth brokerage configuration rejects a valid account saved in lean.json whenever the authorization returns more than one account.

In lean/models/json_module.py, the OAuth account handling removes the saved account when either it is absent from the returned list or the list has more than one account. The latter condition applies even with interactive=False. Configuration then reports the account option as missing.

Reproduction

Use an OAuth module with an account choice filtered on its OAuth configuration, and:

  • saved configuration: {"project-id": 123, "example-user-name": "SampleUser", "example-account": "ACCOUNT1"};
  • authorization account ids: ["ACCOUNT1", "ACCOUNT2"];
  • config_build(..., interactive=False), without an explicit account command-line option.

Observed: You are missing the following option: --example-account.

Expected: preserve ACCOUNT1, which is explicitly configured and is in the authorized account list.

Confirmed with a synthetic authorization on master 9479601 as well as 42fbdbd. Passing the same account explicitly as a command-line option succeeds on both. This is existing shared OAuth behavior, not specific to a newly added brokerage.

Suggested fix

Only discard a saved account when it is no longer authorized. If interactive mode intentionally asks users to choose again when several accounts are available, keep that policy confined to interactive mode. Add regression coverage for a valid saved account with multiple authorized accounts, an invalid saved account, and an explicit command-line override.

主要言語
Python
スター
330
フォーク
171
平均マージ
2日 21時間
マージ済み PR(30日)
18

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

QuantConnect/lean-cli のほかの issue

QuantConnect/lean-cli の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。