Repository navigation
Conversation
- 为 PAT 账号注册 Prober,使运行时能够通过内进程探针刷新就绪状态和额度 - PAT 登录成功后记录 auth_type="pat",使卡片和导出能正确识别凭据类型 - QuotaSnapshot 保留真实的 quotaFetchedAt 时间戳,不再每次读取都覆写为"now" - 强制刷新时同步拉取 /api/v2/quota/usage,失败返回错误而非静默返回旧值 - 不可用的组织资源包不再计入headline总额,与浏览器路径规则保持一致 - 导出时对 qoder-pat-v1 格式走 payload 分支,不再尝试读取已废弃的 CLI blob - 探针遇到网关 401/403 时将账号标记为 login_required,卡片显示"重新登录" - 补充 adapter、bridge、runtime 相关测试覆盖上述变更
caigee-cmd
approved these changes
Nov 14, 2026
caigee-cmd
left a comment
Owner
There was a problem hiding this comment.
Approved.
PAT-backed Qoder accounts now share the browser-login probe and quota path: the registered Prober refreshes the in-process session, a manual refresh hits /api/v2/quota/usage and surfaces failures, and the snapshot keeps the real fetch time plus the add-on / resource-package breakdown. Auth type pat is recorded so the card and qoder-pat-v1 export match. Worker-URL accounts still stay on /health.
Checked the diff against current main (clean merge, the 19-file change only) and ran go test for internal/providers/qoder, internal/runtime, internal/control, and internal/store. CI is green. Live PAT QA is still unchecked, as noted in the PR.
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.
问题
Qoder PAT(令牌)账户显示过时的卡片数据:状态从未更新,积分一直处于冻结状态,凭证类型显示为“无”而非“PAT”。这意味着“刷新积分”操作没有任何可见效果,后台扫描无法显示实际配额,导出时也不携带便携式PAT有效载荷。
解决方案
将PAT支持的Qoder账户视为浏览器登录账户,以便进行准备和配额管理:
/api/v2/quota/usage调用;错误会显示在控制台,而不是留下一个标记为“现在”的过时数字。FetchedAt作为真实的上游时间戳,而不是每次读取时都进行重写。auth_type = pat,以便卡片显示正确的类型,并确保导出/导入功能正常。qoder-pat-v1载荷导出支持PAT的Qoder账户,而不是使用传统的CLI blob。这涉及什么
internal/providers/qoder/adapter.go— 注册探测器(Prober);探测器针对PAT账户调用网桥(Bridge),针对旧版调用工作进程URL;配额(Quota)始终强制进行上游读取。internal/providers/qoder/bridge.go— 将EnsureAccountStatus拆分为即发即弃版本和返回错误的RefreshAccountStatus版本;保留真实的quotaFetchedAt时间戳。internal/providers/interfaces.go— 在QuotaInfo中添加HasAddOn/ResourcePackage*字段。internal/control/login.go— 在PAT登录后调用SetCredentialAuthType。internal/control/accounts.go— 通过其便携式凭证载荷导出PAT账户。internal/accounts/store.go+internal/store/store.go— 新增SetCredentialAuthType方法。internal/runtime/manager_probe.go— 将forceQuota参数传递给进程内分支;处理认证错误。internal/runtime/manager_quota.go— 提取了quotaSnapshotFromInfo,以便在通用路径下保留 Qoder 存储桶的详细信息。internal/runtime/manager_maintenance.go— 在签入后,在不通过共享配额获取门的情况下,刷新进程中的Qoder配额。internal/runtime/manager_accounts.go— 仅当快照实际存在时才保存配额。adapter_test.go、bridge_quota_test.go、duty_services_test.go、providers_test.go等文件的测试覆盖了新行为。测试
FetchedAt保留、不可用资源包排除、同步强制配额刷新、配额失败时错误暴露,以及通过通用路径实现Qoder故障分解持久化。清单
changelog/unreleased/qoder-token-account-card-refresh.md)