Skip to content

gateway: read the CodeArts accounts array as an array (#84) - #87

Closed
ghshhf wants to merge 1 commit into
LAGcomcom:masterfrom
ghshhf:pr-84-codearts-accounts-array
Closed

ghshhf wants to merge 1 commit into
LAGcomcom:masterfrom
ghshhf:pr-84-codearts-accounts-array

Conversation

@ghshhf

@ghshhf ghshhf commented Oct 17, 2026

Copy link
Copy Markdown
Contributor

Fixes #84 — after a successful Huawei Cloud OAuth the channel still reported 未登录 and no codearts/* model ever reached an agent picker.

The embedded hub's /status answers accounts as an array of account objects (h.cfg.Pool.List()), but probeCodearts decoded it into an int. The unmarshal error was discarded with _ =, so Accounts stayed 0, LoggedIn = Accounts > 0 stayed false, and ensureCodeartsProvider disabled the managed provider on every round — while the hub sitting on 8096 had the account loaded and was serving /v1/models happily.

What it does

  • The field is decoded as []json.RawMessage and counted. The parse moved into parseCodeartsAccounts, which returns the error instead of dropping it, so a malformed /status says so on the card rather than quietly reading as "no account loaded".
  • A regression test covers the array shape and the error path.

Verified: go vet ./... + go test ./... green. Reported against v1.7.17 and master; the diagnosis and the suggested shape come from the issue itself.

…comcom#84)

The vendored /status answers accounts as an array of account objects;
decoding it into an int failed silently, Accounts stayed 0, and the
channel judged itself logged out forever after a successful OAuth —
ensureCodeartsProvider then disabled the managed provider every round.
Also stop discarding the unmarshal error.
@LAGcomcom

Copy link
Copy Markdown
Owner

@ghshhf 感谢修复,但 #90(原生移植)把整个内嵌 hub 删了——probeCodearts 读 /status accounts 数组这段代码本身不复存在了,所以这个 PR 已无必要,先关闭避免冲突挂着。#84 的根因正是这个数组被当 int 解析,原生移植从设计上不再走旁路 hub 的 /status,账号直接存网关配置、状态即时生效。你为 WorkBuddy 提的 #85/#86/#88/#89 我会照常逐个审。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] CodeArts 账号渠道登录成功后仍判「未登录」:探针把 /status 的 accounts 数组当成 int

2 participants