Skip to content

codearts/officeace: opt-in client-subscription at sign-in for an account that never opened MaaS #1330

Open

Description

@isdoge

Problem

An account can finish Huawei Cloud sign-in without ever having opened MaaS. It then has a valid STS triple and no model_app_key, so the catalog and chat have nothing to use: models() falls back to the static table and chat answers ModelArts.81002 Failed to get the authorization header from the default api.modelarts-maas.com.

The package deliberately treats that as "the user has not opened MaaS yet" (correct — it is not a failed sign-in), but the only way out is to open the OfficeAce client or the MaaS console by hand, which is exactly what a magpie user is trying to avoid.

Measured (2026-11-18, magpie 0.1.4386, plugin 0.3.22, Linux)

  • A freshly signed-in account (20:04 Beijing) had refreshToken and a valid STS, no model_app_key.
  • Its catalog call answered 400 ModelArts.81002 Failed to get the authorization header.
  • The same account's check-in answered 403 OfficeAce.11020604 未订购套餐 at 18:48–20:18, then succeeded at 20:39 with 新用户专属福利 +300;每日签到有礼 +50 — plan state and sign-in state move independently.

Proposal

An opt-in plugin option, autoMaasSubscribe (default false), that runs once at sign-in when withOfficeAceMaas() comes back without a pair:

  • POST {claw}/v1/claw/client-subscription with x-subscription-type: v2, signed like the OfficeAce client does (the endpoint officeace-auth documents in its README).
  • Merge model_auth_info + model_api_url_base into the record and persist it.
  • A failure must not fail the sign-in; log it and keep the "not linked" state.

Why opt-in

It is a write operation (it creates a subscription). Default off keeps the package's current contract for users who never want a request to change account state; a user who wants "sign in and it just works" can turn it on. The account still needs an active plan — with 未订购套餐 the call has nothing to grant.

Alternatives

  • Keep it manual (status quo) and surface the "not linked" state on the card instead of a model-catalog failure — worth doing regardless.
  • A one-click "接入 MaaS" action on the account row, driven by the same call, if a plugin option feels too implicit.

Activity

  1. isdoge commented on Nov 18, 2026

    @isdoge
    ContributorAuthor

    Measured on a fresh account (2026-11-18)

    A new Huawei Cloud account signed in through officeace-auth 0.3.2 on a local magpie 0.1.4386 host, using the package's "add another Huawei Cloud account" (isolated browser profile) entry:

    • At sign-in the plugin called POST /v1/claw/client-subscription (the client's 「接入华为云 MaaS 模型」 step).
    • The stored record came back with model_app_key / model_app_secret and the gateway base.
    • GET {maas}/v2/models then answered 200 with 25 entries.
    • The subscription shows 个人体验版 200 / 200, expiring 2026-12-18; no bonus_skus at that moment.

    So the automatic path works end to end for a fresh account that has never opened MaaS. With the community package alone the same account would stay at ModelArts.81002 Failed to get the authorization header until a user opened the OfficeAce client or the MaaS console by hand — which is the gap this request is about.

    The opt-in shape still seems right: the call is a subscription write, and an account with no plan (未订购套餐) has nothing to grant, so it should stay off by default and report its outcome rather than fail the sign-in.

  2. isdoge commented on Nov 18, 2026

    @isdoge
    ContributorAuthor

    One more rule worth recording for this design: MaaS credits do not post immediately.

    The same delay happens when the account is activated by hand in the desktop client, so an empty bonus_skus at sign-in is not a symptom of a failed subscription. The opt-in path should treat "credits post later" as normal and never retry or fail the sign-in because the balance is still empty right after client-subscription returns.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions