bug(python): OIDC refresh drops the gateway's oidc_scopes
メンテナーはふだん 1 日以内に返信
@jyotir07 がすでに取り組んでいます。
2026年10月26日 から。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 84/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- python
調査の方向性
python/openshell/sandbox.py にある _OidcRefresher._refresh から始め、そのトークン形式を issue に記載された CLI の更新経路と比較します。近くにあるゲートウェイメタデータの処理を読み、その後 python/openshell/sandbox_test.py の対象を絞った refresher テストを実行します。テストで、oidc_scopes がある場合はスペース区切りでリクエストに含まれ、ない場合は変更されないことを確認できれば完了です。
索引モデルが issue の本文から書いたものです。
説明
User Story
As a student building a personal project that creates and drives OpenShell sandboxes from the Python SDK (SandboxClient.from_active_cluster), I want the SDK to refresh my OIDC session the same way the CLI does, so that my scripts keep working after the access token expires without me running a CLI command to renew it.
I noticed the Python refresh behaving differently from the CLI while working on the project. Comparing the two refresh paths showed that the Python refresher never sends the gateway's oidc_scopes, and I then reproduced it with a unit test.
Problem Statement
_OidcRefresher._refresh in python/openshell/sandbox.py posts the refresh_token grant with only grant_type, refresh_token, and client_id. It never sends the gateway's oidc_scopes. The CLI does send them (ensure_valid_oidc_token_bundle → oidc_refresh_token(..., scopes)), and the docs say refresh uses "the OIDC scopes saved in the gateway metadata". The Python client-credentials provider in the same file already reads oidc_scopes / oidc_audience from metadata; only the refresh path omits them.
Impact / Why This Matters
With identity providers that require scope on the refresh grant, or that pick the token's resource from it (for example Microsoft Entra ID), the Python SDK's first automatic refresh fails or returns a token the gateway rejects. The same gateway works with the CLI. The current workaround is to run openshell gateway login or a CLI command before the token expires so the CLI rewrites oidc_token.json. That does not work for long-running Python processes.
Acceptance Criteria
- When gateway metadata has
oidc_scopes, the Python refresh request includesscope=<space-separated scopes>, matching the CLI. - Without
oidc_scopes, the refresh request is unchanged. - A unit test covers both cases.
Reproduction Steps
- Register a gateway whose
metadata.jsonhas"auth_mode": "oidc"and"oidc_scopes": "openid api://openshell/.default", with an expired access token and a valid refresh token inoidc_token.json. - Build the provider with
_make_cluster_bearer_provider(gateway_dir, name)(the pathSandboxClient.from_active_clusteruses) and call it once, with the refresher'shttpx.Clientbound to anhttpx.MockTransportthat records the token request. - The posted form contains
grant_type,refresh_token, andclient_id, but noscope. The CLI's refresh for the same gateway sendsscope=openid api://openshell/.default.
Suggested UX (if applicable)
No response
Environment
- OpenShell:
main@ c4688aa8 - SDK: Python (
python/openshell/sandbox.py,_OidcRefresher)
Logs
FAILED python/openshell/sandbox_test.py::test_refresher_sends_gateway_oidc_scopes
E AssertionError: assert None == 'openid api://openshell/.default'
- 主要言語
- Rust
- スター
- 20.6k
- フォーク
- 2k
- 平均マージ
- 2日 14時間
- マージ済み PR(30日)
- 275
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
NVIDIA/OpenShell のほかの issue
-
config preflight exits 0 on allow_unauthenticated_users = true対応中かも @ericcurtin が 1 日前に担当しました。 オープンstate:triage-needed
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
メンテナーはふだん 1 日以内に返信
-
state:triage-needed
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
メンテナーはふだん 1 日以内に返信
-
bug: workspace access hint suggests a --subject command that fails for hyphen-leading OIDC subjects再び着手できるかも このイシューのプルリクエストはマージされずにクローズされました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信
NVIDIA/OpenShell の issue をすべて見る
似ている issue
-
A-linter
難易度 2/5 1〜3時間 初心者へのやさしさ 73/100
oxc-project/oxc#28783 ·
メンテナーはふだん 1 日以内に返信
-
Substrait consumer doesn't recognise `shift_left` / `shift_right` from functions_arithmetic.yamlオープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
apache/datafusion#27059 ·
メンテナーはふだん 1 日以内に返信
-
Bump calamine to 0.38: RUSTSEC-2026-0436 (CFB/OLE2 panic and unbounded allocation) fails cargo auditオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
docling-project/docling.rs#979 ·
メンテナーはふだん 1 日以内に返信
-
llm translation
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
メンテナーはふだん 1 日以内に返信