Repository navigation
fix: accept current global userinfo shape in PAT login - #4
Closed
darkmore666 wants to merge 1 commit into
Closed
darkmore666 wants to merge 1 commit into
darkmore666 wants to merge 1 commit into
Conversation
The global /api/v1/userinfo endpoint now returns id/name/username/avatar and camelCase organization fields instead of uid/organization_tags. PAT exchange succeeded but the UID lookup failed, aborting startup with "could not fetch user info after exchange". Normalize both legacy and current response shapes, mirroring the official CLI field precedence, and include the underlying userinfo error in the failure message so future shape changes remain diagnosable.
darkmore666
force-pushed
the
fix/userinfo-current-shape
branch
from
November 9, 2026 09:57
abd223d to
a56dde6
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题
-region global+ 环境 PAT(QODER_PERSONAL_ACCESS_TOKEN)启动时直接失败:POST /api/v1/jobToken/exchange本身返回 200,失败的是随后的GET /api/v1/userinfo解析。根因
global 的
/api/v1/userinfo现在返回新形状:{ "id": "...", "name": "...", "username": "...", "avatar": "https://...", "organization_id": "...", "organization_name": "...", "is_privacy_policy_modifiable": false }用户 ID 在
id字段里,而authUserInfoProfile只认uid。于是profile.UID == "",PAT 登录被判定失败,只能看到一句笼统的could not fetch user info after exchange。除
uid外,同一响应里还有几处字段名变化:avatar(旧avatar_url)、is_privacy_policy_modifiable(旧is_data_policy_modifiable),以及 camelCase 的组织字段。修改
authUserInfoProfile同时接受新旧两种形状:id/user_id/uid,name/username/user_name,avatar_url/avatar,organization_id/orgId/organizationId,以及嵌套的organization对象。normalize(),按官方 CLI 的字段优先级归一化后再交给applyAuthUserInfoProfile,调用方仍然只处理稳定的userInfo字段。%w);UID 缺失时单独说明,以后同类形状变化不必再猜。auth_userinfo_shape_test.go:新形状、旧形状,以及 PAT 登录全流程回归。验证
go test ./...通过。credentials loaded→listening on 127.0.0.1:8377,GET /v1/models返回 200,POST /v1/chat/completions正常返回。uid+organization_tags+data_policy_agreed)行为不变。兼容性
仅放宽解析,不改变既有响应支持范围,不需要配置迁移。