Conversation
Add usage based rate limiting.
- Store weekly usage in `user_fairies.weeklyUsage` as JSONB
(`{"2025-W01": 12.34}`)
- Check rate limit before streaming actions (429 if exceeded)
- Record actual cost after each generation completes
- ISO week-based tracking
- Admins bypass limits - we still store their usage so that we can have
a rough estimate of how much things cost
- We talk directly to User durable object that is defined in sync worker
(using `script_name` to link these things together)
- Also fixes fairy auth.
### Change type
- [x] `other`
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> Implements weekly, cost-based fairy usage tracking and rate limiting
across workers with DO-to-DO checks, updates client error messaging, and
adds schema/migration support.
>
> - **Backend (sync-worker)**:
> - Add `user_fairies.weeklyUsage` JSONB with migration
`026_fairy_usage_tracking.sql` and schema typing.
> - TLUser DO: new endpoints `GET /app/:userId/fairy/has-access`, `POST
/fairy/check-rate-limit`, `POST /fairy/record-usage` (ISO-week based;
atomic JSONB updates).
> - Admin: ensure `weeklyUsage: {}` on upsert.
> - **Fairy worker**:
> - Introduce `INTERNAL_BASE_URL` and bind `TL_USER` DO; env/wrangler
bindings updated (all envs + preview via deploy script).
> - Before streaming: check rate limit via TLUser DO; on finish: record
actual cost; propagate user headers (`X-User-Id`, `X-Is-Admin`).
> - Add robust SSE error/abort handling and CORS headers mutability fix.
> - **Client/UI**:
> - Show specific toasts for weekly fairy limit
(`fairy_rate_limit_title`/`fairy_rate_limit_exceeded`); add i18n
strings.
> - Agent fetch: fail fast on non-OK responses with server error
payload; suppress console noise for rate-limit errors.
> - **Auth**:
> - `hasFairyAccess` now queries TLUser DO instead of hardcoded
allowlist.
> - **Deploy/Config**:
> - Preview deploy script injects `TL_USER` DO binding for fairy worker.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
f201ed0. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
…cution (#7223) Speed up e2e tests by implementing page reuse within test suites and enabling fully parallel test execution. **Key changes:** - Add `setupOrReset` helper that navigates on first run, then uses fast editor reset on subsequent runs - Add `hardResetEditor` and `hardResetWithShapes` utilities for fast state reset via the editor API - Enable `fullyParallel: true` in playwright config since clipboard tests are already skipped - Replace `sleep()` calls with proper `waitForSelector` assertions in timing-sensitive tests - Replace keyboard-based cleanup with faster API calls in shape tests - Replace `waitForTimeout(6000)` with `waitForSelector` in licensing tests ### Change type - [x] `improvement` ### Test plan 1. Run `yarn e2e` and verify all tests pass 2. Compare test execution time (should be notably faster) - [ ] Unit tests - [x] End to end tests ### Release notes - Improved e2e test performance with page reuse and parallel execution <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Enables page reuse with fast editor resets, runs tests fully in parallel, updates specs to avoid sleeps in favor of reliable waits/API calls, adjusts e2e scripts, and adds new macOS FPS baselines. > > - **E2E infrastructure**: > - **Helpers**: Add `setupOrReset`, `hardResetEditor`, and `hardResetWithShapes` in `e2e/shared-e2e.ts` for page reuse and fast state resets. > - **Parallelization**: Set `fullyParallel: true` in `e2e/playwright.config.ts`. > - **Cleanup & waits**: Replace `waitForTimeout`/`sleep` with selector-based waits; use editor API for faster cleanup/reset (e.g., in shape/tool tests); reuse a single `Page` in context-menu tests. > - **Scripts**: Simplify `e2e` script paths in `apps/examples/package.json`. > - **Tests**: > - Update multiple specs to use `setupOrReset`/`hardReset*` and reliable assertions (`test-*.spec.ts[x]`). > - Licensing tests now wait for `.tl-canvas` instead of fixed 6s delays. > - **Performance baselines**: > - Add `darwin-1280x720` and `darwin-393x727` entries and refresh `lastUpdated` in `e2e/baselines/fps-baselines.json`. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit d89919d. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
Enhances the typecheck script to provide clearer error summaries when type checking fails in non-watch mode. ### Change type - [x] `improvement` ### Test plan The changes improve developer experience when type checking fails: 1. Run `yarn typecheck` with type errors present 2. Observe the clear error summary with extracted TypeScript errors 3. Verify that watch mode (`yarn typecheck --watch`) still works as before 4. Confirm that successful type checks complete without extra output Manual testing verified the improved error display format. ### Release notes - Improved typecheck script error reporting with clearer summaries <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Typecheck script now captures non-watch output to summarize TypeScript errors, preserves watch behavior, and adds robust error handling. > > - **Tooling**: > - **`internal/scripts/typecheck.ts`**: > - Non-watch: run `tsc` via `execFile`, stream output, extract TS error lines, and print a concise failure summary; exit with proper code. > - Watch: keep `execFileSync` with inherited stdio; detect `--watch` and pass through related flags. > - Minor: type `tsconfigFiles`, resolve on success, and add top-level `main().catch` for unexpected errors. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 3522012. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY --> Co-authored-by: Claude <noreply@anthropic.com>
Adds a reset button to the FairyHUD header that allows users to reset
the chat conversation with a fairy.
The reset button appears in the header when:
- The panel is showing fairy chat
- A fairy is currently shown
- Only one or no fairies are selected
The button uses the existing `reset()` method on the fairy agent and
displays a counter-clockwise rotate icon.
### Change type
- [x] `improvement`
### Test plan
1. Open a fairy chat
2. Have a conversation with the fairy
3. Click the reset button in the header
4. Verify the chat is reset and starts fresh
- [ ] Unit tests
- [ ] End to end tests
### Release notes
- Added a reset button to the fairy chat header to quickly restart
conversations
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> Migrates fairy HUD/menus to Tldraw UI dropdowns with a new Manage
submenu and accessibility tweaks, updates i18n strings and releases doc
to v4.2.0, adds a lint-staged wrapper, and refines related styles.
>
> - **UI (fairies)**:
> - Replace Radix dropdowns with `TldrawUiDropdownMenu*` in `FairyHUD`,
`FairyDropdownContent`, `FairyTaskListDropdownContent` and sync open
state via `editor.menus`.
> - Restructure `FairyMenuContent` with a `Manage` submenu; disable
reset when no history; keep group disband flow.
> - Improve accessibility of sidebar plus control (div with role/button
+ keyboard handlers) in `FairySidebarButton`.
> - Adjust `FairyDebugDialog` structure (remove wrapper) and use Tldraw
UI for view selection.
> - **Styles**:
> - Tweak chat input/history padding and header spacing; set dialog body
sizing; adjust z-index and `--tl-layer-canvas-in-front`.
> - **i18n**:
> - Update labels/messages (e.g., `Visit`, `Speak to {name}…`, `Manage`,
`Summon all`, `Sleep all`, `Clear all`, `Hard reset`, `Fairy's name`);
remove unused strings; sync compiled locales.
> - **Docs**:
> - Update releases page to current `[v4.2.0]` with notes and move prior
versions to "Previous releases".
> - **Tooling**:
> - Add `internal/scripts/lint-staged.ts` wrapper for clearer
lint-staged error reporting.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
8bbb78b. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.4)
Can you help keep this open source service alive? 💖 Please sponsor : )