Skip to content

feat(notifications): add auto top-up notification for organization owners#970

Merged
jobrietbergen merged 1 commit intomainfrom
session/agent_aac3b56e-73a5-4c82-a7fa-f8f30fb2bdcd
Mar 10, 2026
Merged

feat(notifications): add auto top-up notification for organization owners#970
jobrietbergen merged 1 commit intomainfrom
session/agent_aac3b56e-73a5-4c82-a7fa-f8f30fb2bdcd

Conversation

@kilo-code-bot
Copy link
Copy Markdown
Contributor

@kilo-code-bot kilo-code-bot Bot commented Mar 10, 2026

Summary

Adds a new generateAutoTopUpOrgsNotification notification generator that promotes the auto top-up feature to organization owners. The notification is only shown to users who have 'owner' role in at least one organization, using the existing getUserOrganizationsWithSeats function to check membership roles. Wired into the existing generateUserNotifications aggregation alongside the other conditional generators.

Verification

  • pnpm typecheck — passes cleanly, no type errors

Visual Changes

N/A

Reviewer Notes

  • The OrganizationRole type is 'owner' | 'member' | 'billing_manager' — there is no 'admin' role in the schema, so the check filters on role === 'owner' only, which is the admin-equivalent role for organizations.
  • The function reuses the existing getUserOrganizationsWithSeats import already present in the file (used by generateAutoTopUpNotification and generateKiloPassNotification).

Built for jobrietbergen by Kilo for Slack

Comment thread src/lib/notifications.ts

async function generateAutoTopUpOrgsNotification(user: User): Promise<KiloNotification[]> {
const orgs = await getUserOrganizationsWithSeats(user.id);
const isOwnerOrAdmin = orgs.some(org => org.role === 'owner');
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WARNING: Billing managers are excluded from the org auto-top-up notification

organizationOwnerProcedure allows both owner and billing_manager to configure organization auto top-ups, but this check only matches owner. Billing managers therefore never see the CTA even though they have permission to act on it.

Suggested change
const isOwnerOrAdmin = orgs.some(org => org.role === 'owner');
const isOwnerOrAdmin = orgs.some(org => org.role === 'owner' || org.role === 'billing_manager');

@kilo-code-bot
Copy link
Copy Markdown
Contributor Author

kilo-code-bot Bot commented Mar 10, 2026

Code Review Summary

Status: 1 Issues Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 1
SUGGESTION 0

Fix these issues in Kilo Cloud

Issue Details (click to expand)

WARNING

File Line Issue
src/lib/notifications.ts 159 Billing managers can configure org auto top-ups, but this notification only targets owner, so eligible users miss the CTA.
Other Observations (not in diff)

None.

Files Reviewed (1 files)
  • src/lib/notifications.ts - 1 issue

@jobrietbergen jobrietbergen merged commit 9de4aa9 into main Mar 10, 2026
18 checks passed
@jobrietbergen jobrietbergen deleted the session/agent_aac3b56e-73a5-4c82-a7fa-f8f30fb2bdcd branch March 10, 2026 06:58
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