feat: ✨ Session budget enforcement plugin - #723
Draft
evaline-ju wants to merge 5 commits into
Draft
Conversation
Implements per-session lifetime budgets on tokens, inference calls, and wall-clock duration. Uses Redis for cross-pod durable counters with a local in-memory cache for zero-latency evaluation on the request path. Fail-open by default when Redis is unavailable. Includes unit tests, e2e tests (forward proxy round-trip, accumulate and deny, multi-session isolation, Redis failure/recovery, pod restart), storage interface with driver registry, Redis driver, and user-facing plugin documentation. Assisted-By: Claude (Anthropic AI) <noreply@anthropic.com> Signed-off-by: Evaline Ju <69598118+evaline-ju@users.noreply.github.com>
Signed-off-by: Evaline Ju <69598118+evaline-ju@users.noreply.github.com>
Signed-off-by: Evaline Ju <69598118+evaline-ju@users.noreply.github.com>
Signed-off-by: Evaline Ju <69598118+evaline-ju@users.noreply.github.com>
Signed-off-by: Evaline Ju <69598118+evaline-ju@users.noreply.github.com>
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
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 |
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.
Summary
include_plugin_tokenbudget) token-budget plugin for per-session lifetime enforcement for tokens, calls, and wall-clock duration, working with streaming SSE responses and buffered responsestoken-exchangeplugin, Cortex as a sidecar will not be able to surface these errors clearly through agents themselvesRelated issue(s)
Closes #708
Testing Instructions
helm install valkey bitnami/valkey -n <ns>) or any Redis-compatible storecd authbridge && docker build -f cmd/authbridge-proxy/Dockerfile \ --build-arg GO_BUILD_TAGS="include_plugin_tokenbudget" \ -t authbridge:latest .and load into clusterauthbridge-runtime-config(or seedocs/token-budget-plugin.md), roll pod or wait for hot-reloadon_exceed: "observe", send agent requests past limit, these requests should succeed and info can be seen in logs/through abctlon_exceed: "deny", edit the authbridge configmapAssisted-By: Claude (Anthropic AI)