[bug] auth login --console on Windows: browser URL is truncated at &, so needapikey=true is dropped and no API key is created
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 35/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 技術スタック
- git, node.js, powershell, typescript
- 領域
- authentication, cli
調査の方向性
Start with the browser-opening code path that runs cmd /c start on Windows, which builds the console-login URL and is the source of the unquoted &needapikey=true truncation. Then look at the console-login flow that decides whether to request an API key, and at the non-TTY branch of bl auth login --console that exits and closes the callback port. Done when the URL reaches the browser intact with needapikey=true, and a non-TTY login either waits for completion or prints a clear instruction.
索引モデルが issue の本文から書いたものです。
説明
Environment
- CLI: bl 2.1.0
- Skill: 2.1.0
- Node: v24.21.0 (npm 11.19.0)
- OS: Windows 11 家庭版 (Chinese), build 26200, PowerShell 7.6.6
- Region: cn-beijing (domestic,
bailian.console.aliyun.com)
Reproduce
-
On a Windows machine with no model API key configured (
bl auth status→authenticated: false), run:bl auth login --console -
The CLI tries to open the browser via
cmd /c start <url>; the URL contains&needapikey=true, whichcmdtreats as a command separator.
Expected
The browser opens the full console-login URL (including needapikey=true) and an ordinary API key is created and stored, so model commands work afterwards.
Actual
stderr:
Could not open the default browser (Command failed: cmd /c start https://bailian.console.aliyun.com/console-login?notice=127.0.0.1:49309?state=<state>&needapikey=true
'needapikey' 不是内部或外部命令,也不是可运行的程序或批处理文件。
). Open this URL manually:
The console page still reports “CLI 登录成功”, and bl auth status becomes authenticated: true, but only a console-session token is stored — no model API key is written to ~/.bailian/config.json (top-level keys stay access_token / workspace_id / console_site / console_region / console_switch_agent). Model commands keep failing:
bl text chat --message "hello"
Error: No API key found.
Two separate problems on Windows/agent environments:
cmd /c start <url>is not quoted, so the URL is cut at the first&and&needapikey=truenever reaches the console page.- In a non-TTY environment (agent/CI),
bl auth login --consoleprints the URL, then immediately says “This process keeps the local port open for the console … (or wait for idle timeout)” and exits right away, so the local callback port is gone before the user can finish the login.
Note: the printed URL also reads ...?notice=127.0.0.1:<port>?state=<state>&needapikey=true — notice appears to embed a second ? where & would be expected; combined with (1) this makes the truncation hard to notice.
Full output
Could not open the default browser (Command failed: cmd /c start https://bailian.console.aliyun.com/console-login?notice=127.0.0.1:54675?state=<state>&needapikey=true
'needapikey' 不是内部或外部命令,也不是可运行的程序或批处理文件。
). Open this URL manually:
https://bailian.console.aliyun.com/console-login?notice=127.0.0.1:54675?state=<state>&needapikey=true
This process keeps the local port open for the console; press Ctrl+C when finished (or wait for idle timeout).
Config saved to C:\Users\<user>\.bailian\config.json
{
"authenticated": true,
"config": "default",
"config_file": "C:\\Users\\<user>\\.bailian\\config.json",
"console": { "source": "config", "masked": "[REDACTED]", "region": "cn-beijing", "site": "domestic" }
}
Already tried
bl --version(2.1.0) matches the installed skill version (2.1.0) and the latest npm version — no upgrade pending- Re-ran
bl auth login --consoleseveral times (also with--timeout 900); the process still exits immediately in a non-TTY session - Opening the printed URL manually does complete the console-session handshake, but the stored credential still has no API key
- Workaround that worked: use the console's one-click script (
https://bailian.aliyun.com/api-key.ps1, run withKEY/REGION/WORKSPACEenv vars), which decodes theo1_…key and runsbl auth login --config default --api-key <plain> --base-url https://<workspace>.<region>.maas.aliyuncs.com
Suggested fixes
- Quote the URL and pass an explicit title when opening the browser on Windows, e.g.
cmd /c start "" "<url>"(or useStart-Process), so&is not treated as a separator. - In a non-TTY environment, either keep the callback port open until the login completes / times out, or detect the non-TTY case and print “complete this login in an interactive terminal, or use
--api-key”. - Make
auth status/ the success page distinguish “console session only” from “model API key configured”, so users don't believe setup finished while model commands still fail withNo API key found.
Notes
- Frequency: always (Windows 11, PowerShell; reproduced 3×)
- Invoked via: coding agent (non-TTY) on Windows; the same command in an interactive terminal still loses
needapikey=truebecause of (1) - Secrets: API keys and console tokens are redacted as
[REDACTED]
- 主要言語
- TypeScript
- スター
- 527
- フォーク
- 33
- 平均マージ
- 6時間 11分
- マージ済み PR(30日)
- 26
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
modelstudioai/cli のほかの issue
-
[bug]: speech recognize --timeout 未作用于临时 OSS 上传(固定 120 秒)対応中かも @hopelynd が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
modelstudioai/cli#243 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
modelstudioai/cli#242 ·
メンテナーはふだん 1 日以内に返信
-
[bug] vision describe: default base URL is the Coding Plan endpoint → HTTP 404 for all VL/OCR modelsオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
modelstudioai/cli#241 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
[bug] bl update: darwin-arm64 binary ships invalid ad-hoc signature, killed by macOS (Killed: 9)オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
modelstudioai/cli#223 ·
メンテナーはふだん 1 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 57/100
modelstudioai/cli#239 ·
メンテナーはふだん 1 日以内に返信
modelstudioai/cli の issue をすべて見る
似ている issue
-
./collections should export setUmbracoVersion and setAllowFilePathUploads for in-process consumersオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
umbraco/Umbraco-CMS-MCP-Dev#563 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
-
afk-ok area:data-quality importer size:S
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
enorm-labs/event-junkie#3166 ·
メンテナーはふだん 1 日以内に返信
-
enhancement
難易度 1/5 1時間未満 初心者へのやさしさ 80/100
alunduil/projects-v2-sync#21 ·