feat: Add ability to purchase provider coding plans#3521
Conversation
c5a5451 to
f768c1e
Compare
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Executive SummaryFull review of all 60 files. All previously flagged issues are resolved. No new issues found in the updated diff (incremental history unavailable due to force-push; full diff reviewed against Resolved since previous review
Other Observations (not blocking)
Offset-based pagination: Sweep backlog: If more than 1 000 rows become due simultaneously (e.g. after an outage), both sweeps will process at most 1 000 per cron run and the remainder will be picked up on the next invocation. This is correct and safe behavior, but may be worth noting in operational runbooks. Migration trailing newline: Files Reviewed (60 files)
Reviewed by claude-4.6-sonnet-20260217 · 5,964,659 tokens Review guidance: REVIEW.md from base branch |
f768c1e to
ab56852
Compare
4c78b65 to
6d07a01
Compare
- Add upstream_plan_id to the coding plan key inventory (migration 0148) and parse managed MiniMax credentials in <api key>::<plan id> format. - Clear encrypted_api_key when a credential enters revocation_pending, including on GDPR soft-delete, so revoked keys are not retained. - Gate the Coding Plans tab on /subscriptions behind CODING_PLANS_PURCHASE_ENABLED; hidden by default for a dark launch. - Update billing lifecycle, revocation, inventory validation, the coding-plans router, and admin operations surfaces accordingly.
The counter intentionally measures triggered auto-top-up attempts (not successful charges), matching spec rule 5.5. Document that a best-effort maybePerformAutoTopUp failure still counts as a triggered attempt.
Replace the serial validation loop in uploadKeysToInventory with a p-limit(10) fan-out so large inventory uploads finish well within the request budget without firing one unbounded burst at the MiniMax API. Behavior is unchanged: malformed entries fail before validation, any invalid credential aborts the upload, and nothing is inserted on failure.
PLAN.md was a development planning artifact and does not belong in the repo root (the designated location for plans is .plans/). Drop it so it is not part of this PR's changes.
This duplicated glob with a doubled dev/dev segment was auto-written into tsconfig.json by the Next dev server and committed by mistake. It points at a nonexistent directory and duplicates the existing .next/dev/types entry, so removing it restores tsconfig to match main.
6d07a01 to
5a0b6d7
Compare
Summary
Adds managed MiniMax Token Plan Plus subscriptions funded by Kilo Credits and surfaced through Subscription Center and admin operations.
Why this change is needed
Kilo needs a first Coding Plans offering that can sell provider-plan access without redirecting subscribers to an upstream checkout or exposing managed provider credentials. The pilot also needs explicit billing, cleanup, and manual-revocation rules because ordinary MiniMax BYOK controls routing while Kilo remains responsible for subscription lifecycle and issued credentials.
How this is addressed
/subscriptionsbehind theCODING_PLANS_PURCHASE_ENABLEDserver flag (hidden by default) so the feature can ship dark; backend routers, billing lifecycle cron, and admin operations remain active regardless of the flag.Human Verification
Reviewer Notes
Human Reviewer Flags
.specs/coding-plans.mdand extends Subscription Center contract for first managed provider-plan pilot.CODING_PLANS_PURCHASE_ENABLED=true, so merging does not expose Coding Plans to users until the flag is enabled in the target environment.Code Reviewer Agent
Code Reviewer Notes