provider page: a plugin account shows its accountId — for Huawei Cloud that is iam::<domain>:user:<name>
What the user sees
In a plugin provider's settings page, the account list shows each account's accountId. For Huawei Cloud that value is an IAM id:
iam::01a18be16b297c5197d8569e4be6a479:user:hw059194106570983
The same account shows 180****2361 on its quota card, because the plugin returns a masked phone as usage().user.
Why the plugin cannot fix it
magpie-community/plugins#483 settled where that value comes from. In review:
accountIdis the account's identity in magpie, not only its name, so it must stay what 0.x stored.
with the probe that settled it:
AccountNameOf(...) |
gateway-key id | |
|---|---|---|
| before | AccountNameOf(01a0cbf7-…)="Work account" |
842c5f53982b63b7 |
after (accountId = the masked phone) |
AccountNameOf(138****8000)="" |
82ba203e26eff0ed |
So accountId keys the user's own name, the proxy, and the gateway key. The three plugins that display a phone — #483 codearts, #486 raccoon, #487 qoder — therefore keep accountId as the vendor's id and put the phone in usage().user. The account list still renders accountId, so it renders the id.
What could change in magpie
Render in the account list what the quota card already renders — usage().user — while accountId stays the key. Two shapes:
- Display-only: the account row shows
usage().userwhen present, elseaccountId. Nothing stored changes, nothing migrates. - An explicit name: let a plugin return an account name beside
accountIdinauth.methods[].authorize(), stored apart from the identity key.
Evidence
~/.config/magpie/logins.json on a machine with both Huawei plugins installed:
| agent | user |
|---|---|
plugin:codearts |
181****0632, 181****6710, 189****8051, iam::01a18be1…:user:hw059194106570983 |
plugin:officeace |
181****0632, 181****6710, 189****8051 |
The fourth codearts row is the id — it follows #483. The officeace rows are phones because that package writes the phone into accountId, which is exactly what #483 forbids and which loses the user's own name on the next renewal.
So today the same UI either shows an id (compliant) or shows a phone (non-compliant). Making both correct is a change in magpie, not in the plugins.
@MYCF711 v0.1.2247 已修复(3b5dccd52):插件账号在账号列表、改名、隐藏列表、代理选择、Routing、CLI/TUI 和用量里按这个顺序显示:
- 你自己起的名字;
- 插件 usage() 返回的名字(例如 180****2361);
- accountId。
accountId 仍是内部标识,存储的内容不变,也不需要迁移。读取失败时保留上次读到的名字,只有从未读到过才显示 id。
还没用真实的华为云 CodeArts 账号试过。另外,用量只按模型组分窗口的插件,重启后到第一次读取用量之前仍会显示 id。
麻烦升级后确认一下,没问题我再关掉这个 issue。
看了 3b5dccd52 的实现(AccountShown / AccountShownOf / AccountLabelOf 一条规则,优先级 自起名 → usage 的 user → accountId),和我这个 issue 里报的现象对得上。
本机暂时验不了:跑的是 magpie 0.1.2214,还没到你说的 0.1.2247。升级后我会拿真实的华为云账号确认两处:
- 账号列表 / Routing 里显示的是
180****2361这类 usage 名字,而不是iam::<domain>:user:<name>; - 重启后第一次读用量之前,是否仍显示 id(你在 commit message 里也标了这条限制)。
确认没问题我回来说一声。
本机核过了,0.1.2256 上没问题。
版本对得上:3b5dccd5 就是 tag v0.1.2247(GitHub compare 3b5dccd5...v0.1.2247 = identical,0 commits)。
测法:不动正在跑的 0.1.2214(本机装的就是它),把 0.1.2256 的构建放进一个便携目录(.portable + data/,缓存也落在里面),数据目录复制本机真实配置(logins.json / providers.json / quotas.json / plugins),插件 0.2.6、真实华为云 CodeArts 账号。Windows。
账号列表(magpie accounts,同一份数据):
| 版本 | 那一行 |
|---|---|
| 0.1.2214 | iam::01a18be16b297c5197d8569e4be6a479:user:hw059194106570983 |
| 0.1.2256 | 180****2361 · iam::01a18be16b297c5197d8569e4be6a479:user:hw059194106570983 |
| 0.1.2214 | iam::01a18c09d8037a5dbfad63f678874483:user:hw038060818785319 |
| 0.1.2256 | 187****5670 · iam::01a18c09d8037a5dbfad63f678874483:user:hw038060818785319 |
账号页的来源:便携实例 GET /api/providers → "accountUsers":{"iam::01a18be1…":"180****2361","iam::01a18c09…":"187****5670"}。GUI 那一行没在窗口里看(headless),看的是它读的这一个字段,加上 commit 里的 account-plugin-user.test.cjs。
存储没动:跑完 providers.json 与跑前逐字节相同(我自己起的名字仍在 accountNames),logins.json 里两个账号的 user 仍是 IAM id。
你注记的边界:先把 quotas.json 删掉再跑,两行照样是 180****2361 / 187****5670,即来自本次实时 usage() 读取,不是旧读数;这三次读数(总积分 / 基础积分包 / 赠送积分包)也写进了新的 quotas.json,所以重启后不会退回 id。会退回 id 的是窗口里带 models 的那种(quota_last.go:81-83:w.matches != nil 就整次不落盘)——本机 5 个 CodeArts 账号今天都没有那一窗口,这一条只是按代码确认,没复现到。
另外 3 个 CodeArts 账号(181****0632 / 181****6710 / 189****8051)的 accountId 本身就是手机号(#483 之前建的),这次改动不碰它们。
可以关。
take
Cross-checked against the current tip (db7c57670) — I agree with @MYCF711 that this can be closed. Two independent confirmations on top of your verification:
1. The display rule is intact at the tip. 3b5dccd52 (= tag v0.1.2247, the fix for this issue) still reads exactly as @yetone announced: AccountShownOf is cmp.Or(AccountLabelOf(id, user), user) with AccountLabelOf = cmp.Or(AccountNameOf, PluginUserOf) — the account goes by the name you gave it, else its plugin's usage().user (the in-memory read, else quotas.json), else its accountId, and it never goes blank (internal/provider/account_names.go:135-147). TestPluginAccountShownByItsUsageUser passes at the tip.
2. The edge you couldn't reproduce is exactly as you read it. In keepLast (internal/provider/quota_last.go:81-83), any window with w.matches != nil returns before the reading is written — the code comment says "a pool that can't be written down isn't kept" — so a plugin whose usage comes back as model pools leaves nothing in quotas.json, and after a restart the account shows its id until the first live read. That is deliberate and documented in the fix's commit message ("Not tried: … A plugin whose windows are all model pools isn't kept in quotas.json, so after a restart it shows its id until its first read.") — a known limitation, not a regression.
Nothing left open on the magpie side from here.
Attribution: AI-written; I've verified the claims above against db7c57670 and run TestPluginAccountShownByItsUsageUser on it.
已修复,关闭
v0.1.2247(3b5dccd52,AccountShownOf)把显示优先级改成 自起名 → usage().user → accountId。
- 我在 0.1.2256 的便携实例上用真实华为云 CodeArts 账号验了两处:账号列表、以及重启后首次读用量前的回退
ggbdpq11-03 在 tipdb7c57670上复核,确认TestPluginAccountShownByItsUsageUser是绿的
⚠ 留一个口径给后来的人:稳定渠道当前是 0.1.2115,低于 0.1.2247 —— 稳定版用户暂时还拿不到这个修复,别据此认为「稳定版已修」。
谢谢 @yetone 和 @ggbdpq。