feat(claw): prompt users to purchase credits when selecting a paid model#1324
Merged
Conversation
Contributor
Code Review SummaryStatus: 2 Issues Found | Recommendation: Address before merge Overview
Fix these issues in Kilo Cloud Issue Details (click to expand)WARNING
Other Observations (not in diff)Issues found in unchanged code that cannot receive inline comments:
Files Reviewed (6 files)
Reviewed by gpt-5.4-20260305 · 1,558,125 tokens |
…del during onboarding Users without credits can select paid models during KiloClaw onboarding, but the bot won't work without a balance. This adds an inline credit purchase nudge (amount selector + Stripe checkout CTA + free model fallback) and preserves model selection across the checkout redirect via the existing payment-return-url cookie.
Replace useTransition with a plain useState boolean that stays true once set, since the form submission navigates away and never needs to reset.
Show a success toast and immediately start provisioning when the user returns from Stripe checkout, so they don't have to manually click Get Started again.
Replace the hand-rolled Set of free model IDs with a direct call to the existing isFreeModel() helper, which already covers all free model detection cases (kilo free models, :free suffix, stealth models, etc.).
Add an optional cancel-path query param to the /payments/topup route, validated with isValidReturnUrl to prevent open redirects. The claw CreditsNudge now passes cancel-path=/claw so users return to the onboarding page instead of /profile when they cancel checkout.
jeanduplessis
approved these changes
Mar 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
/clawwith their model selection preserved via the existingpayment-return-urlcookie mechanism, a success toast is shown, and provisioning starts automatically.isFreeModel()helper, so selecting any free model (not just Kilo Auto: Free) from the 500+ dropdown also hides the nudge.Verification
pnpm typecheck— passes across all packagespnpm format:check(oxfmt) — passespnpm lint— passes (oxlint + eslint)Visual Changes
credit-purchase.mp4
Reviewer Notes
/profile(hardcoded ingetStripeTopUpCheckoutUrl). A follow-up could pass a custom cancel URL so users return to/clawon cancellation too.useRefguard (hasAutoProvisioned) to prevent double-firing in React strict mode or on re-renders.