Skip to content

feat(plugin-state): Allow customizing staleness threshold#2138

Open
asharkhan3101 wants to merge 5 commits into
llm-d:mainfrom
asharkhan3101:ashar/customize-staleness-threshold
Open

feat(plugin-state): Allow customizing staleness threshold#2138
asharkhan3101 wants to merge 5 commits into
llm-d:mainfrom
asharkhan3101:ashar/customize-staleness-threshold

Conversation

@asharkhan3101

Copy link
Copy Markdown
Contributor

What type of PR is this?

/kind feature

What this PR does / why we need it: In decode heavy with non-streaming, it is fairly common that a request may take over 5 minutes (default staleness threshold), which causes plugin state to remove those from accounting, when used with inflight flow control this results in prematurely releasing request or token budget which results in EPP admitting more request than configured.

This PR allows us to customize this staleness threshold, it adds a new epp command line argument --plugin-state-staleness-threshold defaulting to 5m.

Which issue(s) this PR fixes: #2137

Fixes #2137

Release note (write NONE if no user-facing change):

Added --plugin-state-staleness-threshold. In non-streaming requests this can evict requests from plugin state too early.

In decode heavy with non-streaming, it is fairly common that a request
may take over 5 minutes (default staleness threshold), which causes
plugin state to remove those from accounting, when used with inflight flow
control this results in prematurly releasing request or token budget
which results in EPP admitting more request than configured.

This PR allows us to customize this staleness threshold, it adds a new epp
command line argument `--plugin-state-staleness-threshold` defaulting to
5m.

Signed-off-by: mohammadkhan <mohammadkhan@digitalocean.com>
Copilot AI review requested due to automatic review settings July 22, 2026 11:32
@asharkhan3101
asharkhan3101 requested a review from a team as a code owner July 22, 2026 11:32
@asharkhan3101
asharkhan3101 requested review from ahg-g and elevran July 22, 2026 11:32
@github-actions github-actions Bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. kind/feature Categorizes issue or PR as related to a new feature. labels Jul 22, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds a configurable staleness threshold for PluginState cleanup so long-running non-streaming requests aren’t prematurely evicted from in-flight accounting, which can otherwise lead to EPP over-admission under request-concurrency flow control.

Changes:

  • Adds a new EPP flag --plugin-state-staleness-threshold (default 5m) and validates it is positive.
  • Plumbs the configured duration into the plugin framework via a process-wide default applied before plugin instantiation.
  • Updates PluginState to store a per-instance threshold and extends tests to cover the new behavior.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.

File Description
pkg/epp/server/options.go Adds the new CLI option, default value, flag wiring, and validation.
pkg/epp/framework/interface/plugin/plugin_state.go Introduces exported default threshold and a configurable process-wide default captured by new PluginState instances.
pkg/epp/framework/interface/plugin/plugin_state_test.go Updates stale-time calculations and adds a new test for the default-threshold override behavior.
cmd/epp/runner/runner.go Applies the configured threshold early in startup before plugins are instantiated.

Comment thread pkg/epp/framework/interface/plugin/plugin_state.go Outdated
Comment thread pkg/epp/framework/interface/plugin/plugin_state.go Outdated
Comment thread pkg/epp/framework/interface/plugin/plugin_state_test.go
Comment thread pkg/epp/framework/interface/plugin/plugin_state_test.go
Comment thread pkg/epp/framework/interface/plugin/plugin_state_test.go
asharkhan3101 and others added 4 commits July 22, 2026 17:07
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Mohammad Ashar Khan <140482588+asharkhan3101@users.noreply.github.com>
Signed-off-by: mohammadkhan <mohammadkhan@digitalocean.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/feature Categorizes issue or PR as related to a new feature. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Plugin state staleness causes over-admission of non streaming decode-heavy requests

2 participants