Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Adds an optional per-user throttling mechanism to the LISA Serve REST API, wired from deployment configuration into the FastAPI container via environment variables, with accompanying unit tests.
Changes:
- Introduces an in-memory token-bucket rate limiting middleware for the Serve REST API.
- Wires new rate-limit configuration fields through the Zod config schema into the FastAPI container environment.
- Adds middleware/unit tests and a local validation app file under
test/rest-api/.
Reviewed changes
Copilot reviewed 7 out of 8 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| lib/serve/rest-api/src/middleware/rate_limit_middleware.py | New token-bucket rate limiter with per-user keying and optional overrides. |
| lib/serve/rest-api/src/middleware/init.py | Exports the new rate_limit_middleware. |
| lib/serve/rest-api/src/main.py | Registers the new rate-limit middleware in the FastAPI middleware chain. |
| lib/schema/configSchema.ts | Adds rateLimit* config fields to REST API config schema. |
| lib/api-base/fastApiContainer.ts | Passes rate-limit config into container env vars (RATE_LIMIT_*). |
| test/rest-api/test_rate_limit_middleware.py | Adds unit tests for bucket logic, identity extraction, overrides, and pruning. |
| test/rest-api/test_rate_limit_local_server.py | Adds a minimal FastAPI app intended for local end-to-end validation. |
| package-lock.json | Large lockfile metadata churn unrelated to the stated PR purpose. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
bedanley
reviewed
Apr 21, 2026
bedanley
previously approved these changes
Apr 21, 2026
bedanley
approved these changes
Apr 21, 2026
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Adding optional throttling to LISA Serve
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.