Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

fix: temporarily disable AI usage billing (#6979)

Will Hutchinson766170aaff12
diff --git a/apps/web/src/components/app/Layout.tsx b/apps/web/src/components/app/Layout.tsx
index 8a48f15e97..31ab3140d3 100644
--- a/apps/web/src/components/app/Layout.tsx
+++ b/apps/web/src/components/app/Layout.tsx
@@ -23,7 +23,8 @@ import {
isAddInboxDialogOpen,
} from '@app/features/inbox/AddInboxDialog';
import { MacroMcpSetupModal } from '@app/features/integrations/mcp-setup/MacroMcpSetupModal';
-import { AiUsageLimitDialog } from '@app/features/paywall/AiUsageLimitDialog';
+// AI usage billing is temporarily disabled.
+// import { AiUsageLimitDialog } from '@app/features/paywall/AiUsageLimitDialog';
import { Paywall } from '@app/features/paywall/Paywall';
import { PropertyEditorModal } from '@app/features/property/editor/PropertyEditorModal';
import { ReminderComposerModal } from '@app/features/reminders/ReminderComposerModal';
@@ -53,7 +54,7 @@ import {
} from '@components/app/sidebarVisibility';
import { useIsAuthenticated } from '@core/auth';
import { UserCardDrawer } from '@core/component/UserCardDrawer';
-import { useAiUsageLimitState } from '@core/constant/AiUsageLimitState';
+// import { useAiUsageLimitState } from '@core/constant/AiUsageLimitState';
import { enableReminders } from '@core/constant/featureFlags';
import { usePaywallState } from '@core/constant/PaywallState';
import { isSoloSettings } from '@core/constant/SettingsState';
@@ -354,7 +355,7 @@ function NewOnboardingRedirect() {
function LayoutInner(props: RouteSectionProps) {
const isAuthenticated = useIsAuthenticated();
const { paywallOpen, showPaywall } = usePaywallState();
- const { usageLimitOpen } = useAiUsageLimitState();
+ // const { usageLimitOpen } = useAiUsageLimitState();
const location = useLocation();
const [sidebarOverlayOpen, setSidebarOverlayOpen] = createSignal(false);
const [sidebarOverlayTriggerHovered, setSidebarOverlayTriggerHovered] =
@@ -501,9 +502,11 @@ function LayoutInner(props: RouteSectionProps) {
<Paywall />
</Suspense>
</Show>
+ {/* AI usage billing is temporarily disabled.
<Show when={usageLimitOpen()}>
<AiUsageLimitDialog />
</Show>
+ */}
<div class="max-h-full grow flex">
{/* The provider spans the sidebar too so its favorites can register
sortables with the same drag-drop context as the entity drags. */}
diff --git a/apps/web/src/features/paywall/plans.ts b/apps/web/src/features/paywall/plans.ts
index 939a776305..95246c18b4 100644
--- a/apps/web/src/features/paywall/plans.ts
+++ b/apps/web/src/features/paywall/plans.ts
@@ -49,6 +49,7 @@ interface PlanFeature {
}
export const PLAN_FEATURES: PlanFeature[] = [
+ /* AI usage billing is temporarily disabled.
{
label: 'AI usage included',
values: {
@@ -57,6 +58,7 @@ export const PLAN_FEATURES: PlanFeature[] = [
max: '$200 / mo',
},
},
+ */
{
label: 'AI Agent',
values: {
@@ -65,6 +67,7 @@ export const PLAN_FEATURES: PlanFeature[] = [
max: 'All models',
},
},
+ /* AI usage billing is temporarily disabled.
{
label: 'Beyond included',
values: {
@@ -73,6 +76,7 @@ export const PLAN_FEATURES: PlanFeature[] = [
max: 'Credits or usage billing',
},
},
+ */
{
label: 'Storage',
values: {
diff --git a/apps/web/src/features/settings/Billing.test.tsx b/apps/web/src/features/settings/Billing.test.tsx
new file mode 100644
index 0000000000..9c6ae83efb
--- /dev/null
+++ b/apps/web/src/features/settings/Billing.test.tsx
@@ -0,0 +1,94 @@
+import { PLAN_FEATURES, type PlanTier } from '@app/features/paywall/plans';
+import { PERMISSION_IDS } from '@core/constant/permissions';
+import { cleanup, render, screen } from '@solidjs/testing-library';
+import type { JSX } from 'solid-js';
+import { afterEach, describe, expect, it, vi } from 'vitest';
+import { Billing } from './Billing';
+
+const state = vi.hoisted(() => ({ tier: 'premium' as PlanTier }));
+
+vi.mock('@app/lib/analytics/analytics-context', () => ({
+ useAnalytics: () => ({ track: vi.fn() }),
+}));
+vi.mock('@core/auth', () => ({
+ useHasPaidAccess: () => () => state.tier !== 'free',
+}));
+vi.mock('@core/context/user', () => ({
+ usePermissions: () => () => [PERMISSION_IDS.WRITE_STRIPE_SUBSCRIPTION],
+ useUserId: () => () => 'macro|[email protected]',
+}));
+vi.mock('@core/component/Toast/Toast', () => ({
+ toast: { success: vi.fn(), failure: vi.fn() },
+}));
+vi.mock('@queries/team/teams', () => ({
+ useCurrentTeamQuery: () => ({ data: undefined }),
+}));
+vi.mock('@queries/auth', () => ({
+ useAiBillingSummaryQuery: () => ({
+ isSuccess: true,
+ data: {
+ tier: state.tier,
+ can_manage_billing: true,
+ unlimited: false,
+ used_cents: 1_000_000,
+ included_cents: 4_000,
+ credit_balance_cents: 0,
+ blocked_reason: 'ai_allowance_exhausted',
+ },
+ }),
+ useChangePlanMutation: () => ({ isPending: false, mutateAsync: vi.fn() }),
+ useCreateCheckoutSessionMutation: () => ({ mutateAsync: vi.fn() }),
+}));
+vi.mock('@service-stripe/client', () => ({
+ stripeServiceClient: { createPortalSession: vi.fn() },
+}));
+vi.mock('./AiUsage', () => ({
+ AiUsageMeter: () => {
+ throw new Error('AI usage meter must not mount while billing is paused');
+ },
+ AiUsageControls: () => {
+ throw new Error(
+ 'AI credit controls must not mount while billing is paused'
+ );
+ },
+}));
+vi.mock('@ui', () => ({
+ cn: (...values: unknown[]) => values.filter(Boolean).join(' '),
+ Layer: (props: { children: JSX.Element }) => <>{props.children}</>,
+ Button: (props: { children: JSX.Element }) => (
+ <button type="button">{props.children}</button>
+ ),
+}));
+
+afterEach(cleanup);
+
+describe('Billing while AI usage billing is paused', () => {
+ it.each<PlanTier>(['free', 'premium', 'max'])(
+ 'keeps %s subscription controls without usage or credit UI',
+ (tier) => {
+ state.tier = tier;
+ const { container } = render(() => <Billing />);
+
+ expect(screen.getByRole('heading', { name: 'Billing' })).toBeTruthy();
+ expect(container.textContent).not.toMatch(
+ /AI usage|Add credits|Usage billing|included AI|out of credits/i
+ );
+ if (tier === 'free') {
+ expect(
+ screen.getByRole('button', { name: 'Upgrade now' })
+ ).toBeTruthy();
+ } else {
+ expect(screen.getByRole('button', { name: 'Manage' })).toBeTruthy();
+ }
+ }
+ );
+
+ it('does not advertise credit or usage billing in the plan comparison', () => {
+ expect(PLAN_FEATURES.map((feature) => feature.label)).not.toContain(
+ 'AI usage included'
+ );
+ expect(PLAN_FEATURES.map((feature) => feature.label)).not.toContain(
+ 'Beyond included'
+ );
+ });
+});
diff --git a/apps/web/src/features/settings/Billing.tsx b/apps/web/src/features/settings/Billing.tsx
index 06b28383e4..54fda34d08 100644
--- a/apps/web/src/features/settings/Billing.tsx
+++ b/apps/web/src/features/settings/Billing.tsx
@@ -18,7 +18,8 @@ import type { TeamMember } from '@service-auth/generated/schemas/teamMember';
import { stripeServiceClient } from '@service-stripe/client';
import { Button, Layer } from '@ui';
import { createMemo, For, Match, Show, Switch } from 'solid-js';
-import { AiUsageControls, AiUsageMeter } from './AiUsage';
+// AI usage billing is temporarily disabled; keep the UI for re-enabling.
+// import { AiUsageControls, AiUsageMeter } from './AiUsage';
import { SettingsCard, SettingsPage, SettingsSection } from './primitives';
const BILLING_PLAN_FEATURES: Record<PlanTier, string[]> = {
@@ -26,7 +27,7 @@ const BILLING_PLAN_FEATURES: Record<PlanTier, string[]> = {
premium: [
'All agents',
'All models',
- '$40 of AI usage each month',
+ // '$40 of AI usage each month',
'No watermark',
'AI projections',
'Multiple email inboxes',
@@ -36,7 +37,7 @@ const BILLING_PLAN_FEATURES: Record<PlanTier, string[]> = {
],
max: [
'Everything in Premium',
- '$200 of AI usage each month',
+ // '$200 of AI usage each month',
'Priority support',
],
};
@@ -70,8 +71,10 @@ function describeSeatPlans(members: TeamMember[]): string {
const PlanPrice = (props: { tier: PaidPlan }) => (
<p class="text-ink-extra-muted text-xs">
- ${PLAN_BY_TIER[props.tier].price} per seat / month · includes $
- {PLAN_BY_TIER[props.tier].aiIncluded} of AI usage
+ ${PLAN_BY_TIER[props.tier].price} per seat / month
+ {/* AI usage billing is temporarily disabled.
+ · includes ${PLAN_BY_TIER[props.tier].aiIncluded} of AI usage
+ */}
</p>
);
@@ -137,10 +140,14 @@ export const Billing = () => {
try {
await changePlan.mutateAsync({ plan });
analytics.track('plan_changed', { plan });
+ // AI usage billing is temporarily disabled.
+ // toast.success(
+ // plan === 'max'
+ // ? 'Upgraded to Max. Your larger AI allowance applies right away.'
+ // : 'Switched to Premium.'
+ // );
toast.success(
- plan === 'max'
- ? 'Upgraded to Max. Your larger AI allowance applies right away.'
- : 'Switched to Premium.'
+ plan === 'max' ? 'Upgraded to Max.' : 'Switched to Premium.'
);
} catch (error) {
console.error(error);
@@ -157,7 +164,7 @@ export const Billing = () => {
}
};
- const returnUrl = () => `${window.location.origin}/app/settings/billing`;
+ // const returnUrl = () => `${window.location.origin}/app/settings/billing`;
return (
<SettingsPage
@@ -247,6 +254,7 @@ export const Billing = () => {
</SettingsCard>
</SettingsSection>
+ {/* AI usage billing is temporarily disabled.
<Show when={hasPaid() && summary.isSuccess && summary.data}>
{(snapshot) => (
<SettingsSection
@@ -276,6 +284,7 @@ export const Billing = () => {
</SettingsSection>
)}
</Show>
+ */}
<Show when={canChangePlan()}>
<Switch>
@@ -326,7 +335,8 @@ export const Billing = () => {
</SettingsSection>
</Match>
<Match when={tier() === 'premium'}>
- <SettingsSection title="Need more AI?">
+ {/* <SettingsSection title="Need more AI?"> */}
+ <SettingsSection title="Upgrade">
<SettingsCard>
<section class="flex flex-col gap-4 p-4">
<header class="flex items-center gap-2">
@@ -371,7 +381,8 @@ export const Billing = () => {
>
Switch to Premium
</button>{' '}
- ($40 per seat / month with $40 of AI usage).
+ {/* ($40 per seat / month with $40 of AI usage). */}
+ ($40 per seat / month).
</p>
</SettingsSection>
</Match>
diff --git a/apps/web/src/lib/core/component/AI/component/input/ModelSelector.test.tsx b/apps/web/src/lib/core/component/AI/component/input/ModelSelector.test.tsx
index 049abb823d..b593533d98 100644
--- a/apps/web/src/lib/core/component/AI/component/input/ModelSelector.test.tsx
+++ b/apps/web/src/lib/core/component/AI/component/input/ModelSelector.test.tsx
@@ -75,6 +75,13 @@ describe('ModelSelector: availability', () => {
);
});
+ it('hides usage multipliers while AI usage billing is paused', () => {
+ const { container } = render(() => (
+ <ModelSelector models={ALL_PAID} onSelect={() => {}} />
+ ));
+ expect(container.textContent).not.toContain('× usage');
+ });
+
it('grays out and locks inaccessible models, leaving accessible ones clean', () => {
// A free user: only the fast model is available.
const freeAllowed = modelsForPlan(false);
diff --git a/apps/web/src/lib/core/component/AI/component/input/ModelSelector.tsx b/apps/web/src/lib/core/component/AI/component/input/ModelSelector.tsx
index 35a2dcb183..b256559adc 100644
--- a/apps/web/src/lib/core/component/AI/component/input/ModelSelector.tsx
+++ b/apps/web/src/lib/core/component/AI/component/input/ModelSelector.tsx
@@ -4,7 +4,7 @@ import {
MODEL_PRETTYNAME,
MODEL_PROVIDER_ICON,
Model,
- modelUsageHint,
+ // modelUsageHint,
} from '@core/component/AI/constant';
import type { TModel } from '@core/component/AI/types';
import { isMobile } from '@core/mobile/isMobile';
@@ -98,7 +98,8 @@ export function ModelSelector(props: ModelSelectorProps) {
<span class="flex-1 truncate">
{MODEL_PRETTYNAME[option.id]}
</span>
- {/* Decorative: the item's accessible name stays the model. */}
+ {/* AI usage billing is temporarily disabled.
+ Decorative: the item's accessible name stays the model.
<Show when={modelUsageHint(option.id)}>
{(hint) => (
<span
@@ -109,6 +110,7 @@ export function ModelSelector(props: ModelSelectorProps) {
</span>
)}
</Show>
+ */}
<Show when={!option.available}>
<LockIcon class="size-3.5 shrink-0 text-ink-extra-muted" />
</Show>
@@ -189,6 +191,7 @@ export function ModelSelector(props: ModelSelectorProps) {
<span class="text-base font-medium leading-5">
{MODEL_PRETTYNAME[option.id]}
</span>
+ {/* AI usage billing is temporarily disabled.
<Show when={modelUsageHint(option.id)}>
{(hint) => (
<span class="text-xs text-ink-extra-muted">
@@ -196,6 +199,7 @@ export function ModelSelector(props: ModelSelectorProps) {
</span>
)}
</Show>
+ */}
</span>
<span class="text-[13px] leading-[18px] text-ink-muted">
{MODEL_DESCRIPTION[option.id]}
diff --git a/crates/ai_billing/src/domain/service.rs b/crates/ai_billing/src/domain/service.rs
index c8562f7612..c2701f43e6 100644
--- a/crates/ai_billing/src/domain/service.rs
+++ b/crates/ai_billing/src/domain/service.rs
@@ -4,17 +4,20 @@
#[cfg(test)]
mod test;
-use super::ledger::{SettlementPolicy, build_snapshot, decide};
+// AI usage billing is temporarily disabled; retain settlement and gating for re-enabling.
+// use super::ledger::{SettlementPolicy, build_snapshot, decide};
+use super::ledger::build_snapshot;
use super::models::{
AllowanceDecision, AllowanceStore, BillingError, BillingPeriod, BillingSettings,
- CREDIT_PACKS_CENTS, Entitlement, OVERAGE_CHARGE_THRESHOLD_CENTS, OVERAGE_LIMIT_MAX_CENTS,
- OVERAGE_LIMIT_MIN_CENTS, OverageChargeStatus, PayerScope, PeriodAllowance, PlanTier, Result,
- SeatAllowance, SeatUsage, UsageSnapshot,
+ CREDIT_PACKS_CENTS, Entitlement, OVERAGE_LIMIT_MAX_CENTS, OVERAGE_LIMIT_MIN_CENTS,
+ OverageChargeStatus, PayerScope, Result, SeatAllowance, SeatUsage, UsageSnapshot,
};
+// use super::models::{OVERAGE_CHARGE_THRESHOLD_CENTS, PeriodAllowance, PlanTier};
use super::ports::{
- BillingRepo, BillingService, CreditCheckoutRequest, EntitlementSource, OverageChargeRequest,
- PaymentGateway, PendingCharge, UsageReader,
+ BillingRepo, BillingService, CreditCheckoutRequest, EntitlementSource, PaymentGateway,
+ UsageReader,
};
+// use super::ports::{OverageChargeRequest, PendingCharge};
use chrono::{DateTime, Utc};
use macro_user_id::user_id::MacroUserIdStr;
use macro_uuid::Uuid;
@@ -205,6 +208,7 @@ where
))
}
+ /* AI usage billing is temporarily disabled. Keep settlement helpers for re-enabling.
/// Per-seat allowances to settle `period` with.
///
/// A closed period uses the freeze recorded while it was open. An open
@@ -396,6 +400,8 @@ where
self.repo.suspend_overage(payer).await
}
+ */
+
fn require_payer(entitlement: &Entitlement, user: &MacroUserIdStr<'_>) -> Result<()> {
if !entitlement.is_payer(user) {
return Err(BillingError::NotPayer);
@@ -442,22 +448,33 @@ where
{
#[tracing::instrument(skip(self), err)]
async fn check_allowance(&self, user: &MacroUserIdStr<'_>) -> Result<AllowanceDecision> {
- let position = self.position(user, Utc::now()).await?;
- if position.entitlement.unlimited || position.entitlement.tier == PlanTier::Free {
- return Ok(AllowanceDecision::Allow);
- }
- let snapshot = self.snapshot_at(user, &position).await?;
- Ok(decide(&snapshot))
+ // AI usage billing is temporarily disabled: do not block requests on credits.
+ // let position = self.position(user, Utc::now()).await?;
+ // if position.entitlement.unlimited || position.entitlement.tier == PlanTier::Free {
+ // return Ok(AllowanceDecision::Allow);
+ // }
+ // let snapshot = self.snapshot_at(user, &position).await?;
+ // Ok(decide(&snapshot))
+ Ok(AllowanceDecision::Allow)
}
#[tracing::instrument(skip(self), err)]
async fn snapshot(&self, user: &MacroUserIdStr<'_>) -> Result<UsageSnapshot> {
let position = self.position(user, Utc::now()).await?;
- self.snapshot_at(user, &position).await
+ // self.snapshot_at(user, &position).await
+ let mut snapshot = self.snapshot_at(user, &position).await?;
+ // Match check_allowance while enforcement is paused. Restore the original
+ // return above when re-enabling; keep build_snapshot's billing logic intact.
+ snapshot.blocked_reason = None;
+ Ok(snapshot)
}
#[tracing::instrument(skip(self), err)]
async fn settle(&self, user: &MacroUserIdStr<'_>) -> Result<()> {
+ // AI usage billing is temporarily disabled for every caller (summary reads,
+ // usage recording, settings changes, purchases, and internal settlement).
+ // Do not consume credits, reserve charges, or create/retry Stripe invoices.
+ /*
let now = Utc::now();
let position = self.position(user, now).await?;
if position.entitlement.unlimited || !position.entitlement.tier.is_paid() {
@@ -471,6 +488,8 @@ where
.await?;
self.settle_period(&position.entitlement, position.period, now)
.await
+ */
+ Ok(())
}
#[tracing::instrument(skip(self), err)]
diff --git a/crates/ai_billing/src/domain/service/test.rs b/crates/ai_billing/src/domain/service/test.rs
index 12f4281c83..8eceaba5b0 100644
--- a/crates/ai_billing/src/domain/service/test.rs
+++ b/crates/ai_billing/src/domain/service/test.rs
@@ -1,10 +1,10 @@
use super::*;
-use crate::domain::ledger::plan_settlement;
+use crate::domain::ledger::{SettlementPolicy, plan_settlement};
use crate::domain::models::{
AllowanceStore, DenyReason, OpenPeriodStart, PayerScope, PeriodAllowance, PeriodLedger,
- SeatGeneration,
+ PlanTier, SeatGeneration,
};
-use crate::domain::ports::SettlementOutcome;
+use crate::domain::ports::{OverageChargeRequest, PendingCharge, SettlementOutcome};
use macro_user_id::cowlike::CowLike;
use macro_uuid::Uuid;
use std::collections::HashMap;
@@ -505,6 +505,7 @@ fn premium_service(used_cents: i64) -> (Service, FakeRepo, FakePayments, FakeUsa
}
#[tokio::test]
+#[ignore = "AI usage billing is temporarily disabled; restore with the gate"]
async fn allows_within_allowance_and_denies_past_it() {
let (svc, _, _, usage) = premium_service(3_000);
let payer = user("[email protected]");
@@ -519,6 +520,92 @@ async fn allows_within_allowance_and_denies_past_it() {
);
}
+#[tokio::test]
+async fn billing_pause_allows_exhausted_allowances_caps_and_failed_payments() {
+ let (svc, repo, _, _) = premium_service(1_000_000);
+ let payer = user("[email protected]");
+ assert_eq!(
+ svc.check_allowance(&payer).await.unwrap(),
+ AllowanceDecision::Allow
+ );
+ assert_eq!(svc.snapshot(&payer).await.unwrap().blocked_reason, None);
+
+ let snapshot = svc.update_overage(&payer, true, 1_000).await.unwrap();
+ assert_eq!(snapshot.blocked_reason, None);
+ assert_eq!(
+ svc.check_allowance(&payer).await.unwrap(),
+ AllowanceDecision::Allow
+ );
+
+ repo.state.lock().unwrap().suspended = true;
+ assert_eq!(
+ svc.check_allowance(&payer).await.unwrap(),
+ AllowanceDecision::Allow
+ );
+ assert_eq!(svc.snapshot(&payer).await.unwrap().blocked_reason, None);
+}
+
+#[tokio::test]
+async fn billing_pause_preserves_credits_and_never_reserves_or_collects_overage() {
+ let (svc, repo, payments, usage, _, payer, previous, current) = anchored_premium(1_000_000);
+ svc.sync_period(&payer, current.start, current.end)
+ .await
+ .unwrap();
+ usage.add(
+ &payer,
+ previous.start + chrono::Duration::days(2),
+ 1_000_000,
+ );
+
+ svc.update_overage(&payer, true, 10_000).await.unwrap();
+ svc.apply_credit_purchase(&payer, 2_500, "cs_paused")
+ .await
+ .unwrap();
+ svc.apply_credit_purchase(&payer, 2_500, "cs_paused")
+ .await
+ .unwrap();
+ svc.settle(&payer).await.unwrap();
+ svc.settle(&payer).await.unwrap();
+
+ let snapshot = svc.snapshot(&payer).await.unwrap();
+ assert_eq!(snapshot.used_cents, 1_000_000);
+ assert_eq!(snapshot.credit_balance_cents, 2_500);
+ assert_eq!(snapshot.credits_consumed_cents, 0);
+ assert_eq!(snapshot.overage_charged_cents, 0);
+ assert!(repo.state.lock().unwrap().consumed.is_empty());
+ assert!(repo.charges().is_empty());
+ assert!(payments.opened().is_empty());
+ assert!(payments.payments().is_empty());
+}
+
+#[tokio::test]
+async fn billing_pause_does_not_retry_pending_or_failed_charges() {
+ for status in [OverageChargeStatus::Pending, OverageChargeStatus::Failed] {
+ for invoice in [None, Some("in_existing".to_string())] {
+ let (svc, repo, payments, _) = premium_service(1_000_000);
+ let payer = user("[email protected]");
+ let period = BillingPeriod::current(None, Utc::now());
+ repo.state.lock().unwrap().charges.push(FakeCharge {
+ id: macro_uuid::generate_uuid_v7(),
+ period_start: period.start,
+ amount_cents: 1_000,
+ status,
+ invoice: invoice.clone(),
+ });
+
+ svc.update_overage(&payer, true, 10_000).await.unwrap();
+ svc.settle(&payer).await.unwrap();
+
+ let charges = repo.charges();
+ assert_eq!(charges.len(), 1);
+ assert_eq!(charges[0].status, status);
+ assert_eq!(charges[0].invoice, invoice);
+ assert!(payments.opened().is_empty());
+ assert!(payments.payments().is_empty());
+ }
+ }
+}
+
#[tokio::test]
async fn free_users_are_not_gated() {
let (svc, ..) = premium_service(1_000_000);
@@ -533,6 +620,7 @@ async fn free_users_are_not_gated() {
}
#[tokio::test]
+#[ignore = "AI usage billing is temporarily disabled; restore with settlement"]
async fn credits_unblock_and_settlement_consumes_them() {
let (svc, repo, ..) = premium_service(4_600);
let payer = user("[email protected]");
@@ -563,6 +651,7 @@ async fn credits_unblock_and_settlement_consumes_them() {
}
#[tokio::test]
+#[ignore = "AI usage billing is temporarily disabled; restore with settlement"]
async fn overage_is_charged_in_chunks_and_respects_the_cap() {
let (svc, repo, payments, usage) = premium_service(4_500);
let payer = user("[email protected]");
@@ -598,6 +687,7 @@ async fn overage_is_charged_in_chunks_and_respects_the_cap() {
}
#[tokio::test]
+#[ignore = "AI usage billing is temporarily disabled; restore with settlement"]
async fn failed_overage_charge_suspends_overage_and_is_retried_not_duplicated() {
let (svc, repo, payments, _) = premium_service(5_500);
let payer = user("[email protected]");
@@ -636,6 +726,7 @@ async fn failed_overage_charge_suspends_overage_and_is_retried_not_duplicated()
}
#[tokio::test]
+#[ignore = "AI usage billing is temporarily disabled; restore with settlement"]
async fn opening_the_invoice_failing_marks_the_charge_failed() {
let (svc, repo, payments, _) = premium_service(5_500);
let payer = user("[email protected]");
@@ -659,6 +750,7 @@ async fn opening_the_invoice_failing_marks_the_charge_failed() {
}
#[tokio::test]
+#[ignore = "AI usage billing is temporarily disabled; restore with settlement"]
async fn a_failed_uninvoiced_charge_whose_usage_credits_covered_is_not_retried() {
let (svc, repo, payments, _) = premium_service(5_800);
let payer = user("[email protected]");
@@ -687,6 +779,7 @@ async fn a_failed_uninvoiced_charge_whose_usage_credits_covered_is_not_retried()
}
#[tokio::test]
+#[ignore = "AI usage billing is temporarily disabled; restore with settlement"]
async fn failed_invoiced_charge_keeps_coverage_when_credits_are_bought() {
let (svc, repo, payments, _) = premium_service(7_000);
let payer = user("[email protected]");
@@ -719,6 +812,7 @@ async fn failed_invoiced_charge_keeps_coverage_when_credits_are_bought() {
}
#[tokio::test]
+#[ignore = "AI usage billing is temporarily disabled; restore with settlement"]
async fn a_declined_card_leaves_the_invoice_open_for_the_webhook() {
let (svc, repo, payments, _) = premium_service(5_500);
let payer = user("[email protected]");
@@ -802,6 +896,7 @@ async fn only_the_payer_manages_billing_and_needs_a_paid_plan() {
}
#[tokio::test]
+#[ignore = "AI usage billing is temporarily disabled; restore with settlement"]
async fn team_seats_keep_allowances_separate_and_share_credits() {
let owner = user("[email protected]");
let member = user("[email protected]");
@@ -847,6 +942,7 @@ async fn team_seats_keep_allowances_separate_and_share_credits() {
}
#[tokio::test]
+#[ignore = "AI usage billing is temporarily disabled; restore with settlement"]
async fn overage_invoice_webhooks_update_suspension() {
let (svc, repo, payments, _) = premium_service(5_500);
let payer = user("[email protected]");
@@ -876,6 +972,7 @@ async fn overage_invoice_webhooks_update_suspension() {
}
#[tokio::test]
+#[ignore = "AI usage billing is temporarily disabled; restore with settlement"]
async fn out_of_order_invoice_webhooks_follow_the_newest_charge() {
let (svc, repo, payments, usage) = premium_service(6_000);
let payer = user("[email protected]");
@@ -1001,6 +1098,7 @@ async fn snapshot_freezes_the_open_period_allowance_and_refreshes_it() {
}
#[tokio::test]
+#[ignore = "AI usage billing is temporarily disabled; restore with settlement"]
async fn previous_period_overage_survives_an_upgrade() {
let (svc, repo, payments, usage, ents, payer, previous, current) = anchored_premium(0);
svc.sync_period(&payer, current.start, current.end)
@@ -1063,6 +1161,7 @@ async fn previous_period_does_not_charge_included_usage_after_a_downgrade() {
}
#[tokio::test]
+#[ignore = "AI usage billing is temporarily disabled; restore with settlement"]
async fn previous_period_usage_uses_the_frozen_billed_users() {
let owner = user("[email protected]");
let member_a = user("[email protected]");
diff --git a/crates/ai_billing/src/outbound/settling_recorder.rs b/crates/ai_billing/src/outbound/settling_recorder.rs
index 536f793e54..457dab6748 100644
--- a/crates/ai_billing/src/outbound/settling_recorder.rs
+++ b/crates/ai_billing/src/outbound/settling_recorder.rs
@@ -3,7 +3,8 @@
use crate::domain::{BillingService, SettlementTrigger};
use ai_usage::domain::service::UsageServiceImpl;
-use ai_usage::{SYSTEM_USER_ID, UsageEvent, UsageRecorder, UsageRepo};
+// use ai_usage::SYSTEM_USER_ID;
+use ai_usage::{UsageEvent, UsageRecorder, UsageRepo};
use std::sync::Arc;
use std::time::Duration;
@@ -26,7 +27,9 @@ const RECORD_RETRY_BACKOFF: [Duration; 3] = [
/// re-delivered after an ambiguous failure could double count instead.
pub struct SettlingUsageRecorder<Repo, B, T> {
inner: Arc<UsageServiceImpl<Repo>>,
+ #[expect(dead_code, reason = "AI usage billing is temporarily disabled")]
billing: Arc<B>,
+ #[expect(dead_code, reason = "AI usage billing is temporarily disabled")]
trigger: T,
}
@@ -49,10 +52,11 @@ where
{
fn record(&self, event: UsageEvent) {
let inner = self.inner.clone();
- let billing = self.billing.clone();
- let trigger = self.trigger.clone();
+ // AI usage billing is temporarily disabled; keep recording usage with retries.
+ // let billing = self.billing.clone();
+ // let trigger = self.trigger.clone();
tokio::spawn(async move {
- let user = event.user.clone();
+ // let user = event.user.clone();
let mut backoff = RECORD_RETRY_BACKOFF.iter();
loop {
let Err(e) = inner.record_now(event.clone()).await else {
@@ -75,6 +79,7 @@ where
}
}
}
+ /* AI usage billing is temporarily disabled: do not request settlement.
if user.as_ref() == SYSTEM_USER_ID.as_ref() {
return;
}
@@ -91,6 +96,7 @@ where
tracing::warn!(error = ?e, "failed to read ai billing position");
}
}
+ */
});
}
}
diff --git a/docs/AGENT_GUIDE/ai-chat.md b/docs/AGENT_GUIDE/ai-chat.md
index 9b8cc83db9..4880a36b28 100644
--- a/docs/AGENT_GUIDE/ai-chat.md
+++ b/docs/AGENT_GUIDE/ai-chat.md
@@ -285,6 +285,12 @@ documents:
## AI usage limits
+AI usage billing is temporarily paused. Chat requests are not blocked by
+Macro's credit allowance, spending cap, or failed-overage-payment state. The
+app does not show usage meters, credit-purchase controls, out-of-credit dialogs,
+or model usage multipliers. Normal paid-model access rules still apply.
+
+<!-- Retained for when AI usage billing is re-enabled.
Paid plans include a monthly AI allowance (Premium $40, Max $200, at Macro's
usage rates). When it is used up and no credits or usage billing cover the
request, sending a message answers HTTP 402 and the app opens the
@@ -296,6 +302,7 @@ team this moves only the payer's own seat). Team members who are not the payer
see a note to ask the team owner, or a team admin to move their seat to Max.
Each team seat has its own allowance; unused allowance never moves between
members. The team owner's prepaid credits and usage-billing cap are shared.
+-->
## Start a doc-scoped chat
@@ -351,7 +358,8 @@ existing text sizing.
- Contenteditable composer (placeholder `Ask AI, @mention anything` / `Describe the edit…`).
- Model picker button showing the current model (e.g. `Haiku 4.5`). Paid plans list
`Sonnet 5`, `Opus 5`, `Fable 5.1`, `Haiku 4.5`, `GPT-6 Astra`, `GPT-5.6`, `GPT-5.6 mini`;
- heavy models carry a `2.5× usage` / `5× usage` hint. On the free plan everything but `Haiku 4.5` is
+ <!-- heavy models carry a `2.5× usage` / `5× usage` hint. -->
+ On the free plan everything but `Haiku 4.5` is
dimmed with a lock and opens the `Smart models are premium` paywall when clicked.
- `Send` button (disabled when empty). While streaming it becomes `Stop generating`.
diff --git a/docs/AGENT_GUIDE/surfaces.md b/docs/AGENT_GUIDE/surfaces.md
index b66fad0c98..0c0130fa17 100644
--- a/docs/AGENT_GUIDE/surfaces.md
+++ b/docs/AGENT_GUIDE/surfaces.md
@@ -1006,9 +1006,13 @@ and split navigation.
Left nav: General → `Account` (profile, delete account), `API Keys` (create /
list / delete personal keys; the secret is shown only once and is sent as
`x-macro-user-api-key`), `Notifications`, `Billing` (current plan card with
-`Manage`; on paid plans an **AI usage** card with the period meter, credit
-balance, credit-pack buttons `$10`/`$25`/`$50`/`$100` that redirect to Stripe
-Checkout, and a `Usage billing` toggle with per-period limit pills; an
+`Manage`; AI usage meters, balances, credit purchases, and usage-billing
+controls are temporarily hidden;
+<!-- Retained for when AI usage billing is re-enabled: on paid plans an
+**AI usage** card with the period meter, credit balance, credit-pack buttons
+`$10`/`$25`/`$50`/`$100` that redirect to Stripe Checkout, and a `Usage billing`
+toggle with per-period limit pills; -->
+an
`Upgrade`/`Upgrade to Max` card, or a `Switch to Premium` link on Max; on a team
the plan change moves only the viewer's own seat),
`Appearance`, `Agents`, `Mobile App`, `Shortcuts` (interactive keyboard visualization, not a list);