fix(kiloclaw): log destroy and auto-top-up cleanup#2583
Open
jeanduplessis wants to merge 4 commits intojdp/kiloclaw-spec-compliance-pr1-specsfrom
Open
Conversation
Contributor
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Files Reviewed (2 files)
Reviewed by gpt-5.4-20260305 · 900,136 tokens |
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
Adds changelog coverage for destroy cleanup and credit-renewal auto-top-up marker updates.
Why this change is needed
Destroy flows were clearing subscription lifecycle fields without recording the mutation in the subscription audit log. Credit renewal also marked
auto_top_up_triggered_for_periodwithout a matching changelog entry. That left two subscription mutation paths outside required audit coverage even though the underlying rows were being changed.How this is addressed
status_changed / instance_destroyedin one transaction.Verification
pnpm test -- apps/web/src/routers/kiloclaw-router.test.ts apps/web/src/routers/organizations/organization-kiloclaw-router.test.tspnpm --filter kiloclaw-billing test -- src/lifecycle.test.tspnpm typecheckpnpm formatVisual Changes
N/A
Reviewer Notes
Human Reviewer
clearSubscriptionLifecycleAfterInstanceDestroyintentionally preserves subscription row and only clears destroy-related lifecycle fields on surviving billing state. Reviewers should confirm this matches intended destroyed-instance successor model.status_changed / credit_renewal_auto_top_up_markedinstead of introducing a new action label. That keeps vocabulary stable but treats marker writes as lifecycle state changes rather than separate top-up events.Code Reviewer Agent
Code Reviewer Notes
apps/web/src/lib/kiloclaw/instance-lifecycle.ts, reused by both personal and org destroy routers.destruction_deadlineor clearssuspended_aton non-past_duerows;past_duerows still keep suspension state.processPersonalCreditRenewalRowinservices/kiloclaw-billing/src/lifecycle.ts: fetchbefore, updateauto_top_up_triggered_for_period, then log via existinginsertLifecycleChangeLogBestEfforthelper.