Skip to content
This repository was archived by the owner on Aug 6, 2026. It is now read-only.

feat(loops): Surface billing pauses and gate manual runs - #3779

Merged
charlesvien merged 2 commits into
mainfrom
feat/loops-billing-support
Jul 24, 2026
Merged

feat(loops): Surface billing pauses and gate manual runs#3779
charlesvien merged 2 commits into
mainfrom
feat/loops-billing-support

Conversation

@charlesvien

Copy link
Copy Markdown
Member

Problem

When the backend auto-pauses a loop (usage limit reached, or too many failed runs in a row), the app shows a bare "Paused" badge with no explanation. Manual "Run now" also skips the cloud usage preflight every other cloud run path uses, and a blocked fire surfaces as a raw Run not started: gate_blocked toast.

Companion backend PR records the pause reason on Loop.disabled_reason.

Changes

  • "Run now" preflights assertCloudUsageAvailable() like the task composer, and a gate_blocked result opens the usage limit modal instead of a raw toast. Other blocked reasons get readable messages.
  • Status badge now distinguishes "Paused: usage limit" and "Auto-paused" from a manual "Paused", and the detail view shows a banner explaining backend pauses, with a "Manage plan" CTA for the billing case.
  • api-client: add the fire reasons the backend can already return (owner_inactive, owner_changed) and document the new disabled_reason values.

How did you test this?

Added parameterised unit tests for the new display helpers (loopDisplay.test.ts). Ran the loops feature suite (113 tests) and api-client suite (130 tests), plus typecheck on both packages. No manual app run.

Automatic notifications

  • Publish to changelog?
  • Alert Sales and Marketing teams?

@charlesvien charlesvien self-assigned this Jul 24, 2026
@trunk-io

trunk-io Bot commented Jul 24, 2026

Copy link
Copy Markdown

😎 This pull request was merged.

@github-actions

github-actions Bot commented Jul 24, 2026

Copy link
Copy Markdown

React Doctor found no issues in the changed files. 🎉

Reviewed by React Doctor for commit af9f944.

@greptile-apps

greptile-apps Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor
Prompt To Fix All With AI
Fix the following 1 code review issue. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 1
packages/ui/src/features/loops/components/LoopDetailView.tsx:86
**Keep Run now single-flight**

The button remains enabled while the asynchronous usage preflight runs, so repeated clicks start concurrent preflights and subsequent run mutations. Track the entire handler as pending to avoid duplicate run attempts and repeated notifications.

Reviews (1): Last reviewed commit: "surface loop billing pauses and gate man..." | Re-trigger Greptile

Comment thread packages/ui/src/features/loops/components/LoopDetailView.tsx Outdated
@charlesvien charlesvien added the Stamphog This will request an autostamp by stamphog on small changes label Jul 24, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The diff surfaces existing usage-limit gating (assertCloudUsageAvailable/useUsageLimitStore, already used by the task composer) into the loop run-now flow rather than adding new billing logic, the sole reviewer concern (non-single-flight Run now button) is already fixed in the current diff via the runNowPending guard/try-finally, and the author has STRONG familiarity with these exact files/lines plus added parameterized test coverage.

  • Author wrote 100% of the modified lines and has 8 merged PRs in these paths (familiarity STRONG).
  • 👍 on the PR from greptile-apps[bot].
Gate mechanics and policy version
Gate Result
prerequisites all clear
deny-list no deny categories matched
size 139L, 3F substantive, 235L/4F incl. docs/generated/snapshots — within ceiling
tier T1-agent / T1c-medium (235L, 4F, single-area, feat)
stamphog 2.0.0b3 .stamphog/policy.yml @ 3b560b4 · reviewed head 2a26171

@charlesvien
charlesvien force-pushed the feat/loops-billing-support branch from 2a26171 to af9f944 Compare July 24, 2026 04:15
@charlesvien
charlesvien merged commit 883dc3f into main Jul 24, 2026
32 checks passed
@charlesvien
charlesvien deleted the feat/loops-billing-support branch July 24, 2026 04:23
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Stamphog This will request an autostamp by stamphog on small changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant