Skip to content

fix(usage): console-aware Token Plan guidance + subscription hint on bailian 401 - #12288

Merged
diegosouzapw merged 2 commits into
release/v3.8.51from
fix/token-plan-console-aware-messages
Sep 1, 2026
Merged

diegosouzapw merged 2 commits into
release/v3.8.51from
fix/token-plan-console-aware-messages

Conversation

@diegosouzapw

Copy link
Copy Markdown
Owner

Problem (two operator-facing messages, one root cause)

The personal Token Plan is sold through two consoles (QwenCloud and Alibaba Model Studio)
with different portals, gateway hosts and login tickets — and the gateway validates the session
against the console identity, so a cookie captured on the wrong console is rejected with
BailianGateway.Login.NotLogined.

  1. Cookie guidance ignored the console. The quota message always instructed
    home.qwencloud.com / cs-data.qwencloud.com / login_qwencloud_ticket, even for
    bailian-coding-plan connections served by the Alibaba console. An operator following it
    verbatim captures a cookie the gateway rejects. (This confused the operator on 2026-08-18.)
  2. Invalid API key hid the real cause. An expired Token Plan subscription produces the
    exact same upstream 401 invalid_api_key as a wrong key — observed live 2026-09-01: the
    subscription ended 08-23 (autoRenewFlag: false) and the previously verified working key
    started failing validation with "Invalid API key".

Changes

  • open-sse/services/usage/qwen-token-plan.ts — the guidance derives the console from the
    provider via resolveConsoleSite (the same rule the fetcher applies to a pasted cookie):
    ALIYUN connections get the Model Studio instructions (modelstudio.console.alibabacloud.com,
    gateway bailian-singapore-cs.alibabacloud.com, login_aliyunid_ticket); QwenCloud keeps the
    current text. Brand label follows suit.
  • src/lib/providers/validation/audioMiscProviders.ts — bailian 401/403 message becomes
    "Invalid API key — or the Token Plan subscription is expired/inactive; check it in the Model
    Studio console".
  • Two existing assertions pinning the exact string relaxed to prefix-match (same property:
    401 → invalid).

Tests (TDD — RED first)

tests/unit/token-plan-console-aware-messages.test.ts:

  • Alibaba-console guidance names the Model Studio portal/gateway/ticket and does NOT send the
    operator hunting for login_qwencloud_ticket — RED before.
  • QwenCloud guidance unchanged (portal/gateway/ticket) — green before and after.
  • Bailian 401 mentions the subscription — RED before.

Sibling sweep green: bailian-coding-plan-provider, provider-validation-specialty,
qwen-token-plan-{quota-fetcher,console-site,cookie-field} — 176 pass / 0 fail — plus
typecheck:core, focused ESLint + Prettier.

…n bailian 401

The personal Token Plan is sold through two consoles with different portals,
gateway hosts and login tickets. Two operator-facing messages ignored the split:

- The quota guidance always said 'get the cookie at home.qwencloud.com', even
  for connections served by the Alibaba Model Studio console — following it
  verbatim produces a cookie the gateway rejects (console mismatch →
  BailianGateway.Login.NotLogined). The guidance now derives the console from
  the provider via resolveConsoleSite, matching what the fetcher will do with
  the pasted cookie.
- Key validation mapped upstream 401 to a bare 'Invalid API key'. An expired
  Token Plan subscription produces the exact same upstream 401 (observed live
  2026-09-01: subscription ended 08-23, the working key started failing), so
  the message now names the subscription as a cause worth checking.
…prefix match

search-provider-validation.test.ts pinned the exact 'Invalid API key' string for
the bailian validator; the message now also names an expired Token Plan
subscription. Same property asserted (401/403 => invalid), prefix match.
@diegosouzapw
diegosouzapw merged commit accdfa9 into release/v3.8.51 Sep 1, 2026
21 checks passed
@diegosouzapw
diegosouzapw deleted the fix/token-plan-console-aware-messages branch September 1, 2026 14:42
diegosouzapw added a commit to HouMinXi/OmniRoute that referenced this pull request Sep 1, 2026
…ude diegosouzapw#12288)

Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com>
muhamadgalihsaputra pushed a commit to niyatna/NiyatnaRoute that referenced this pull request Sep 27, 2026
…bailian 401 (diegosouzapw#12288)

* fix(usage): console-aware Token Plan guidance and subscription hint on bailian 401

The personal Token Plan is sold through two consoles with different portals,
gateway hosts and login tickets. Two operator-facing messages ignored the split:

- The quota guidance always said 'get the cookie at home.qwencloud.com', even
  for connections served by the Alibaba Model Studio console — following it
  verbatim produces a cookie the gateway rejects (console mismatch →
  BailianGateway.Login.NotLogined). The guidance now derives the console from
  the provider via resolveConsoleSite, matching what the fetcher will do with
  the pasted cookie.
- Key validation mapped upstream 401 to a bare 'Invalid API key'. An expired
  Token Plan subscription produces the exact same upstream 401 (observed live
  2026-09-01: subscription ended 08-23, the working key started failing), so
  the message now names the subscription as a cause worth checking.

* test(providers): align the remaining bailian 401/403 message pins to prefix match

search-provider-validation.test.ts pinned the exact 'Invalid API key' string for
the bailian validator; the message now also names an expired Token Plan
subscription. Same property asserted (401/403 => invalid), prefix match.
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.

1 participant