Skip to content

fix(claw): allow instance destroy without active subscription#1279

Merged
jeanduplessis merged 2 commits intomainfrom
fix/kiloclaw-allow-destroy-without-subscription
Mar 20, 2026
Merged

fix(claw): allow instance destroy without active subscription#1279
jeanduplessis merged 2 commits intomainfrom
fix/kiloclaw-allow-destroy-without-subscription

Conversation

@jeanduplessis
Copy link
Contributor

Summary

Users whose trial or subscription has expired but whose KiloClaw instance is still alive were unable to destroy their instance — the destroy endpoint required clawAccessProcedure, which gates on active billing. This change:

  • Downgrades destroy from clawAccessProcedure to baseProcedure so any authenticated user can destroy their instance regardless of billing state.
  • Adds a two-step "Destroy Instance" confirmation flow to the AccessLockedDialog for trial_expired_instance_alive and subscription_expired_instance_alive lock states.
  • Clears suspended_at and destruction_deadline on the subscription row after a successful destroy, preventing the billing cron from sending redundant destruction-warning emails or attempting a duplicate destroy.

Verification

  • pnpm typecheck — pass
  • pnpm lint — pass (via pre-push hook)
  • pnpm format:check — pass (via pre-push hook)

Visual Changes

Screenshots could not be captured automatically: the AccessLockedDialog only renders when the user has an expired trial/subscription with a live instance, a billing state that cannot be reproduced via simple dev-server navigation.

The dialog change adds a "Destroy Instance" link button below the subscribe/payment CTA. Clicking it reveals a two-step confirmation with a red "Yes, destroy" button and a "Cancel" button. The destroy button shows a loading state while the mutation is in-flight.

Before After
No destroy option in lock dialog "Destroy Instance" link with two-step confirm flow

Reviewer Notes

  • The destroy endpoint now uses baseProcedure (auth-only, no billing gate). This is intentional — users should always be able to tear down their own instance. The markActiveInstanceDestroyed / restoreDestroyedInstance rollback pattern is preserved.
  • The subscription field cleanup (suspended_at, destruction_deadline) after destroy prevents the billing lifecycle cron from racing against the user-initiated destroy.

Change the destroy endpoint from clawAccessProcedure to baseProcedure so
users with expired trials or subscriptions can still destroy their
running instance. Add a two-step 'Destroy Instance' confirmation button
to AccessLockedDialog for trial_expired/subscription_expired states.
Clear suspended_at and destruction_deadline after successful destroy so
the billing cron doesn't send redundant warnings.
@kilo-code-bot
Copy link
Contributor

kilo-code-bot bot commented Mar 19, 2026

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (1 files)
  • src/routers/kiloclaw-router.ts

Reviewed by gpt-5.4-20260305 · 498,546 tokens

@jeanduplessis jeanduplessis merged commit e2c6858 into main Mar 20, 2026
18 checks passed
@jeanduplessis jeanduplessis deleted the fix/kiloclaw-allow-destroy-without-subscription branch March 20, 2026 11:42
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.

2 participants