Skip to content

Add Throttling to LISA Serve#974

Merged
estohlmann merged 4 commits intodevelopfrom
feature/lisa-serve-throttling
Apr 21, 2026
Merged

Add Throttling to LISA Serve#974
estohlmann merged 4 commits intodevelopfrom
feature/lisa-serve-throttling

Conversation

@estohlmann
Copy link
Copy Markdown
Member

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.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread test/rest-api/test_rate_limit_middleware.py Outdated
Comment thread lib/serve/rest-api/src/middleware/rate_limit_middleware.py Outdated
Comment thread lib/serve/rest-api/src/middleware/rate_limit_middleware.py
Comment thread lib/serve/rest-api/src/main.py
Comment thread test/rest-api/test_rate_limit_middleware.py Outdated
Comment thread lib/serve/rest-api/src/middleware/rate_limit_middleware.py Outdated
Comment thread lib/serve/rest-api/src/middleware/rate_limit_middleware.py
Comment thread test/rest-api/test_rate_limit_local_server.py Outdated
Comment thread lib/serve/rest-api/src/middleware/rate_limit_middleware.py
bedanley
bedanley previously approved these changes Apr 21, 2026
@estohlmann estohlmann merged commit 17a064b into develop Apr 21, 2026
8 of 9 checks passed
@estohlmann estohlmann deleted the feature/lisa-serve-throttling branch April 21, 2026 16:51
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.

3 participants