Skip to content

receipt-cropper → min-instances 0 (stop 24/7 Cloud cost)

Goal

Only 24/7 Cloud Run cost driver (min-instances=1). Scale to zero unless kept warm on purpose. Likely moot after T-013.

Decision log

2026-07-09 — cost quantified from the billing export; decision ripe

  • ✅ Read AGENTS.md. Owner asked why Cloud Run bills so much; investigated via the BigQuery billing export + live service configs. Cloud Run = HK$612 (May) · HK$773 (June) · HK$228 by Jul 9 — and June's SKU split shows HK$772 of HK$773 is "Instance-based billing" CPU+memory in us-east1 (requests: HK$0.69). Live config confirms the sole driver: receipt-cropper [us-east1] minScale=1 + cpu-throttling=false + 2 vCPU / 2 GiB — a full instance always allocated, which served ~0 requests in the measured week. Every other service is minScale=0. The task's "likely moot after T-013" note is dead — T-013 was dropped (services stay on Cloud Run per the owner's 2026-07-01 RAM decision).
  • Recommendation to the owner: set minScale=0 + restore CPU throttling (request-based billing) → bill drops to ~HK$0–5/mo (~HK$8,400/yr saved); trade-off = a cold-start delay (model load, est. 10–30s) on the first receipt crop after idle — likely acceptable at 2-user volume; fallbacks if not: 1 vCPU warm (≈ half cost) or business-hours-only warmth. Awaiting the owner's call (this task's original blocked_on).
  • Source: EOP Local Assistance (fork) · session edb0abc7-6373-449b-8e31-379fd38d391b

2026-07-09 — DONE ✅ — receipt-cropper scaled to zero (verdict + blast radius)

  • ✅ Read AGENTS.md. Owner decision (2026-07-09, verbatim): "Proceed to revive T-015." Executed: gcloud run services update receipt-cropper --region=us-east1 --min-instances=0 --cpu-throttling → revision receipt-cropper-00047-qdp. Verified live: cpu-throttling: 'true', no minScale annotation — the service now scales to zero and bills request-based.
  • Outcome: the sole 24/7 Cloud Run cost driver is gone — Cloud Run was HK$612 (May) / HK$773 (June), ~HK$772 of which was this one always-allocated 2-vCPU instance; expected steady-state bill across ALL Cloud Run services ≈ HK$10–30/mo (~HK$8,400/yr saved).
  • Blast radius: the Telegram receipt bot's first crop after an idle stretch now cold-starts — and the webhook code already documents + tolerates exactly this ("~7–14 s on a cold start", pages/api/telegram/receipt-webhook.ts:68), which confirms the warm instance was never load-bearing. No code changed; the config artifact is the Cloud Run revision. Related SHAs (docs): 2f8ff0b2 (cost quantification) + this close-out commit.
  • Source: EOP Local Assistance (fork) · session edb0abc7-6373-449b-8e31-379fd38d391b