Skip to content

fix: make Start Plan entitlement billing-authoritative (#406) - #407

Merged
william0wang merged 1 commit into
mainfrom
fix/start-plan-billing-entitlement
Nov 19, 2026
Merged

william0wang merged 1 commit into
mainfrom
fix/start-plan-billing-entitlement

Conversation

@william0wang

Copy link
Copy Markdown
Owner

What

3.17+ desktops serve Start Plan as an overlay on the zai OAuth family: providerFamilyConnectionSelections stays individual-coding-plan forever while billing reports the plan active, so the selection-flag gate hid Start Plan from the dropdown entirely (#406). Flipping the flag by hand breaks the desktop's own credential resolution — it is not a safe lever in either direction.

This makes the bridge decide the same way upstream does (codingPlanProviderAvailability.ts, hasActiveStartPlan): billing is authoritative.

How

  • queryStartPlan (the existing billing/balance client) now writes a process-wide verdict on every completed query: entitled (with the grant's capability model ids), none (queried, no active plan — new internal kind, distinct from unavailable = query failed). Failed queries leave the prior verdict standing — entitlement never flaps on a network blip.
  • entitled entitles every coding-plan family with an OAuth login (no selection flag needed); none suppresses even a start-plan flag; unknown (offline / never queried) keeps the legacy flag-based gate — behavior identical to before for machines where billing can't be reached.
  • The grant's capability list filters the advertised and pushed start-plan models (e.g. only GLM-5.3-Flash under a glm-5.3-flash-only grant) — no more dead dropdown options.
  • Verdict is warmed (bounded 2 s, no credentials → zero network) in syncProviderRegistry before the account snapshot push; the usage-stats wire vocabulary is unchanged (none maps to unavailable).

Verification

  • typecheck + eslint clean; full suite 1293 passed / 9 skipped (+6 new tests: billing-entitled without flag, billing-none beats flag, verdict write / no-flap, model filter, wire mapping)
  • Review pass: 0 Critical / 0 Important

Fixes #406

@william0wang
william0wang merged commit 7ab2d6e into main Nov 19, 2026
2 checks passed
@william0wang
william0wang deleted the fix/start-plan-billing-entitlement branch November 19, 2026 01:52
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.

Start Plan missing from the model dropdown on macOS desktop 3.17.2: connection selection never flips to start-plan

1 participant