perf(chat): remove quota and admission round trips - #1345
Conversation
|
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. Note Currently processing new changes in this PR. This may take a few minutes, please wait... ⚙️ Run configuration
📒 Files selected for processing (9)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
tanstack-com | 60a0942 | Oct 05 2026, 07:25 AM |
A live Assistant trace spent 916 ms reserving usage and 555 ms across two admission guards before reaching the model. Reservation now runs the existing lock, fresh role check, quota checks, and atomic accounting protocol inside one PostgreSQL call. Each ordinary admission guard reads current permissions and bot/thread lifecycle together, while retaining both pre- and post-preparation checks and the extra lifecycle check after retry readiness.
The migration uses a SECURITY INVOKER, VOLATILE function and the existing advisory lock keys, so old and new workers remain compatible during deployment. Deployment migrates and verifies the schema before releasing the worker.
Validation: full pnpm test, 278 real PostgreSQL runtime tests, including quota concurrency, revocation while waiting on a lock, admin role revocation, retries, and scope/lifecycle checks. Live phase timings are retained for the post-deployment comparison.
Summary by CodeRabbit