Skip to content

fix: Misc billing, error handling and UX improvements#2014

Merged
charlesvien merged 8 commits intomainfrom
05-04-misc
May 4, 2026
Merged

fix: Misc billing, error handling and UX improvements#2014
charlesvien merged 8 commits intomainfrom
05-04-misc

Conversation

@charlesvien
Copy link
Copy Markdown
Member

@charlesvien charlesvien commented May 4, 2026

Problem

Assorted fixes across billing, API error handling and pre-auth screens.

Changes

  1. Fetch both best seat and org-specific seat to show correct plan per org
  2. Harden API fetcher to handle non-JSON error responses
  3. Show update banner on pre-auth/full-screen layouts
  4. Add billing link to payment error callout
  5. Re-fetch seat after org switch in onboarding
  6. Add VITE_POSTHOG_ACCESS_TOKEN_OVERRIDE env var for dev/testing
  7. Update alpha plan banner copy to clarify free Pro access through June 4, 2026

How did you test this?

Manually

Copy link
Copy Markdown
Member Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@charlesvien charlesvien changed the title Misc fix: Harden API error parsing and improve pre-auth UX May 4, 2026
@charlesvien charlesvien marked this pull request as ready for review May 4, 2026 20:54
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 4, 2026

Prompt To Fix All With AI
Fix the following 3 code review issues. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 3
apps/code/src/renderer/api/fetcher.ts:66-72
In HTTP/2 connections (which are standard for modern HTTPS APIs), `response.statusText` is always an empty string per the Fetch spec, so the fallback produces `{"error":""}` — useless for diagnostics. Cloning the response before calling `.json()` lets the catch handler read the raw body text instead, giving actual content for non-JSON error payloads. The same pattern applies to both catch sites.

```suggestion
        } catch {
          const cloned = response.clone();
          const errorResponse = await response
            .json()
            .catch(() => cloned.text().then((t) => ({ error: t || response.statusText })));
          throw new Error(
            `Failed request: [${response.status}] ${JSON.stringify(errorResponse)}`,
          );
```

### Issue 2 of 3
apps/code/src/renderer/api/fetcher.ts:76-82
Same HTTP/2 `statusText` issue as in the 401 retry path above — the fallback will always yield `{"error":""}`. Cloning the response first preserves the body for a text fallback.

```suggestion
      if (!response.ok) {
        const cloned = response.clone();
        const errorResponse = await response
          .json()
          .catch(() => cloned.text().then((t) => ({ error: t || response.statusText })));
        throw new Error(
          `Failed request: [${response.status}] ${JSON.stringify(errorResponse)}`,
        );
```

### Issue 3 of 3
apps/code/src/renderer/features/settings/components/sections/PlanUsageSettings.tsx:243-244
**Hardcoded expiry date will go stale**

The date "June 4, 2026" is hard-coded in the UI copy. Today is 2026-05-04 — that's approximately 30 days away. Once the date passes, users will see text claiming they have free Pro access "until June 4, 2026" even if the plan has been extended, expired, or changed. This should be driven by a value from the API/config so it can be updated without a new release, or at minimum there should be a plan to update this copy before that date.

Reviews (1): Last reviewed commit: "Show update indicator on pre-auth screen..." | Re-trigger Greptile

Comment thread apps/code/src/renderer/api/fetcher.ts
Comment thread apps/code/src/renderer/api/fetcher.ts
@charlesvien charlesvien changed the title fix: Harden API error parsing and improve pre-auth UX fix: Misc billing, error handling and UX improvements May 4, 2026
@charlesvien charlesvien merged commit 02831fd into main May 4, 2026
16 checks passed
@charlesvien charlesvien deleted the 05-04-misc branch May 4, 2026 23:01
@charlesvien charlesvien added the Create release This will trigger a new release label May 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Create release This will trigger a new release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants