Skip to content

Say when the hour's AI drafts are used up, in plain words - #572

Merged
richshaw merged 12 commits into
mainfrom
claude/pensive-thompson-quytut
Oct 27, 2026
Merged

richshaw merged 12 commits into
mainfrom
claude/pensive-thompson-quytut

Conversation

@richshaw

@richshaw richshaw commented Oct 24, 2026 •

Copy link
Copy Markdown
Owner

Part of #570, the first of six stacked PRs. It's independent of the rest and safe to merge on its own.

The problem

  • When an organizer used up the hour's Magic Compose drafts, the page showed the shared rate limit's text: "too many requests — wait 700s and retry".
  • A 429 from the AI provider showed its own technical message.
  • The privacy page said the site "sends nothing to an AI vendor" by itself. That isn't true when the operator turns on AI drafting: the organizer's description goes to the provider.

The fix

  • Hourly limit. The page reads the error's details.bucket and details.retryAfterSeconds and says "You've used this hour's AI drafts. Try again in 12 minutes, or fill it in by hand." "fill it in by hand" links to the manual form. It says "1 minute", not "1 minutes", and drops the server's "wait Ns and retry".
  • Provider busy. The provider's own 429 (the route's llmErrorCode: 'rate_limited') reads "The AI service is busy. Try again in a minute." When the provider asks for longer, it names the wait ("Try again in 10 minutes."), so the page doesn't invite a retry that spends another draft on a refusal. Any other rate limit keeps its own message.
  • Server unchanged. consumeRateLimit and the API's error are as before. The wording lives in src/components/magic-compose/draft-errors.ts.
  • Bucket name. The page reads it from src/lib/magic-compose/limits.ts, which has no imports. rate-limit.ts keeps its own copy, written out, and a test keeps the two equal.
  • Privacy.
    • The sentence names AI drafting as the exception.
    • Third parties now says what an organizer types into AI drafting goes to the AI provider as typed, so to leave out anything they wouldn't want the provider to see.
    • Nothing else about them, their signups or the people on them goes with it, and filling the signup in by hand avoids it.
    • Last updated: 27 October 2026, for this PR and the two after it that change the page.

Tests

  • draft-errors.test.ts covers:
    • minutes rounding up, and a missing wait;
    • the provider's 429, short and long;
    • another bucket's rate limit;
    • other errors.
  • MagicComposeRoot.test.tsx renders the page with a stubbed fetch:
    • the hourly message and its link, without the server's suggestion;
    • "1 minute";
    • the busy provider;
    • the description kept after an error.
  • pnpm lint && pnpm typecheck && pnpm knip && pnpm test pass.

Tophat

This branch on its own, against a local fake OpenAI-compatible endpoint:

  • a full description still drafts and opens the builder;
  • the provider's 429 with Retry-After 600 reads "Try again in 10 minutes", and with 30 "Try again in a minute";
  • with the quota used up, the hourly message appears and its link opens the manual form;
  • the privacy page reads correctly.

Running the page found one bug, fixed in 0783930: the privacy sentence ran the site name into the next word ("OpenSignup (local)sends").

Reviews

A second review (/code-review), fixed in 98bdac7:

  • the provider 429 was recognised by a missing bucket, and ignored the provider's wait;
  • the privacy text claimed "nothing about participants" goes to the provider, though the description goes as typed;
  • the bucket test couldn't fail.

The owner's tophat, fixed in a049c58: the privacy page's "Last updated" hadn't moved.

Left as is:

  • "fill it in by hand" doesn't carry the description to the manual form (the existing "Skip, fill in by hand" link doesn't either, and the description stays on screen);
  • the minutes are fixed when the error arrives;
  • the manual form's path is written out in a third place.

Size

/app/signups/new stays within its 114 kB budget here. main (through #683) is merged in.

The stack

Each PR is based on the one before. Nothing asks questions until #577; merge #576, #577 and #688 together.

  1. Say when the hour's AI drafts are used up, in plain words #572 (this PR): friendly limit messages, privacy sentence
  2. Let Magic Compose answer with questions, and draft from the answers #573: the questions answer shape and the follow-up request (server)
  3. Record when Magic Compose asks questions, and how they were answered #575: activity events for the questions round
  4. Show Magic Compose's questions, and say what a draft needs #576: the questions screen
  5. Ask a few questions when a Magic Compose description doesn't say what people sign up for #577: the prompt that asks, evals, quota
  6. Show Magic Compose's questions in the drafting screen, as a step #688: the questions shown inside the drafting screen, as a step

🤖 Generated with Claude Code

https://claude.ai/code/session_01UW9ZpEu4MWkeqTv2Qe14ks

The Magic Compose page showed the shared rate limit's message, "too many
requests — wait 700s and retry". It now reads the error's bucket and wait:
"You've used this hour's AI drafts. Try again in 12 minutes, or fill it in
by hand.", with a link to the manual form. A 429 from the AI provider has
no bucket and reads "The AI service is busy. Try again in a minute."

consumeRateLimit and the API's error stay as they are. The bucket name
moves to src/lib/magic-compose/limits.ts, which has no imports, so the
page can read it without pulling server code into its JavaScript.

Part of #570.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UW9ZpEu4MWkeqTv2Qe14ks
… AI provider

The page said the site sends nothing to an AI vendor by itself, which
isn't true when the operator turns on AI drafting: Magic Compose sends the
organizer's description to the provider the operator configured. That
sentence now names the exception, and Third parties says what goes, what
doesn't, and that filling the signup in by hand avoids it.

Part of #570.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UW9ZpEu4MWkeqTv2Qe14ks
Second review of this PR:

- The provider's own 429 is now recognised by the route's
  llmErrorCode rather than by a missing bucket, so any other rate limit
  keeps its own message. When the provider asks for more than a minute,
  the page says how long ("Try again in 10 minutes."), rather than
  inviting a retry that spends another draft on a refusal.
- The rate-limit module keeps the bucket name written out instead of
  importing it from Magic Compose; the test that compares the two can
  now fail.
- The privacy page said nothing about participants goes to the AI
  provider. What the organizer types goes as typed, so it now says to
  leave out what they wouldn't want the provider to see, and that
  nothing else about them, their signups or the people on them goes
  with it.

Part of #570.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UW9ZpEu4MWkeqTv2Qe14ks
The sentence about AI drafting ended a line with {INSTANCE_NAME}, and
JSX drops the line break after an expression, so the page read
"OpenSignup sends" run together ("…(local)sends nothing"). Found by
running the page.

Part of #570.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UW9ZpEu4MWkeqTv2Qe14ks
Brings in #525 and #526.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UW9ZpEu4MWkeqTv2Qe14ks
Brings in #568.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UW9ZpEu4MWkeqTv2Qe14ks
Brings in #579, #613 and #614.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UW9ZpEu4MWkeqTv2Qe14ks
Brings in #571, #574, #578, #580, #581 and the dependency bumps (#552,
#616, #617). The only conflict was the CHANGELOG's new lines; all are
kept.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UW9ZpEu4MWkeqTv2Qe14ks
Brings in #600, #601, #602, #604, #605, #643, #648, #649 and #650.
No conflicts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UW9ZpEu4MWkeqTv2Qe14ks
Brings in #646, #663 and #671. No conflicts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UW9ZpEu4MWkeqTv2Qe14ks
@richshaw

Copy link
Copy Markdown
Owner Author

Tophat: each PR on its own, and the privacy page

I ran each head of this stack alone locally with pnpm dev, Gemini Flash through OpenRouter, and a local proxy for canned replies. Nothing broke on any of them:

Head "Bake sale" A canned questions reply Hourly limit
#572 9636605 3 TBD rows old shape error 10, friendly message
#573 f5483f8 3 TBD rows "AI drafting failed (HTTP 200)", expected on its own 10
#575 cb47605 3 TBD rows same, and magic_compose.asked is written 10

Checked on #572:

  • A full description drafts.
  • With 10 drafts used, the 11th gets "You've used this hour's AI drafts. Try again in N minutes, or fill it in by hand.", and the link opens the manual form.
  • A provider 429 with Retry-After 600 reads "Try again in 10 minutes"; with 30 it reads "in a minute". The description stays in the box.
  • The privacy page's AI drafting sentences read right.

Checked on #573's API alone: a questions reply gives 200 with { questions }, answers give a draft, and two asks give asked_again.

One fix

Bump the privacy page's "Last updated". #572, #573 and #575 all edit src/app/(legal)/privacy/page.tsx. The date stays 24 October 2026, which main already shows, so a reader can't tell the page changed. CLAUDE.md asks for the bump in the same PR. Setting it to the merge date in whichever of the three lands last covers all three.


Generated by Claude Code

This stack changes what the privacy page says about AI drafting here
and in the two PRs after it, but the page still showed 24 October,
the date main already had, so a reader couldn't tell it changed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UW9ZpEu4MWkeqTv2Qe14ks
Brings in #664, #665, #667, #669, #672, #674, #675, #680, #681 and
#683. The only conflict was the CHANGELOG's new lines; all are kept.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UW9ZpEu4MWkeqTv2Qe14ks

Copy link
Copy Markdown
Owner Author

Thanks for running each head on its own.

Fixed: the privacy page's "Last updated" now reads 27 October 2026 (a049c58). I set it here, in the first of the three PRs that change the page, so it's right whichever one lands first; the merges carry it up to #573 and #575. If the stack lands on a later day, the date can move to the merge day then.

main (through #683) is merged into every PR in the stack, and lint, typecheck, knip, the unit tests, the DB tests and the page budgets pass on each head.


Generated by Claude Code

@richshaw
richshaw merged commit 631e56e into main Oct 27, 2026
5 checks passed
@richshaw
richshaw deleted the claude/pensive-thompson-quytut branch October 27, 2026 03:04
richshaw pushed a commit that referenced this pull request Oct 27, 2026
From a review of this PR:

- scripts/email-preview.ts parsed the request target with `new URL()`,
  which throws on `//[` and took the server down. It now splits on `?`.
  It also listens on every interface again, as react-email's preview
  did, so a phone or a browser outside a container can open it.
- The magic-link sample had no `code`, a variant production never
  sends, so the code block was neither previewed nor checked. It now
  has one, and the render check looks for it.
- Each sample now carries the strings its render must contain, so
  adding a template is one edit in scripts/lib/email-samples.ts.
- worker-render.test.ts checks that `email:dev` uses the worker's tsx
  flags, which is what its "renders as the worker sends it" relies on.
- The global `next` override goes. It only kept react-email 3's own
  Next.js in line, and pnpm applies overrides to direct dependencies
  too, so it would have overruled a hand-made bump of `next`. The
  lockfile still resolves next 15.5.28.

Also merges main (Magic Compose questions, #572-#688).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013GLSJgi5BBQ8kdiDBG6Cbq
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