← Back to Pull requests

refactor(thunderagent): simplify plugin parameters and sample config #4174

Closed
unknown closed this pull request without merging on Nov 12, 2026 01:12 UTC
View on GitHub
unknown unknown commented on Nov 11, 2026 05:38 UTC
Author

What type of PR is this?
/kind cleanup

What this PR does / why we need it:

Simplifies the thunder-agent (Alpha) plugin parameters and trims its sample configuration (test/e2e/artifacts/config/thunderagent-config.yaml):

  • Replaces the six plugin parameters with four clearer fields and uses metav1.Duration strings ("30s", "5m", "30m") for durations:

  • - fallbackCapacityTokens (default 4194304): fallback per-pod KV capacity in tokens when the endpoint does not report cache size metrics.
    - usableCapacityRatio (default 1.0): share of each pod's KV capacity available to sessions, in (0, 1].
    - idleGracePeriod (default "30s"): how long an idle session keeps its space before another session can pause it ("0s" reclaims idle sessions immediately).
    - forceAdmitTimeout (default "5m"): maximum queue wait before a request is admitted even when no pod has free space ("0s" turns this off).
  • Removes evictionTtlSeconds and evictionSweepSeconds from user config and manages idle session cleanup internally (10s sweep interval, 2 max(forceAdmitTimeout, 5m) retention).

  • Uses native time.Duration values on the admission path instead of float64 millisecond conversions.

  • Removes default values and loader-synthesized boilerplate (name: thunder, max-score-picker, single-profile-handler, and schedulingProfiles) from test/e2e/artifacts/config/thunderagent-config.yaml, and updates pkg/epp/framework/plugins/thunderagent/README.md.
  • Test plan

  • Reject removed parameter names, invalid or null duration values, and NaN or out-of-range ratios in plugin factory and config validation

  • Set internal session retention TTL to 2 max(forceAdmitTimeout, 5m)

  • Reclaim idle sessions immediately when idleGracePeriod is 0s, disable forced admission when forceAdmitTimeout is 0s, and handle sub-second forceAdmitTimeout durations

  • Synthesize the default scheduling profile with thunder-agent and wire the single instance across scorer, saturation detector, and fairness policy when loading the trimmed sample config
  • Which issue(s) this PR fixes:
    Fixes #4171

    Release note _(write NONE if no user-facing change)_:
    ``release-note
    thunder-agent (Alpha): replace
    capacityTokens, utilThreshold, idleLeaseSeconds, headWaitStarvationMs, evictionTtlSeconds, and evictionSweepSeconds with fallbackCapacityTokens, usableCapacityRatio, idleGracePeriod, and forceAdmitTimeout (Go duration strings), raise default forced-admission timeout to 5m, and handle idle session cleanup internally.
    ``

    Diff: 326 lines (+244 / -82) across 4 files Reviewer: ahg-g Review duration: 1174m
    All Vouch review confidence checks passed
    Residual risk 0.30 = Change Risk (0.70) × (1 − Review Confidence (0.57)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.70 · 326 lines diff across 4 files
    0.70
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    56%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.346
    Shallow Review Depth shallow_review_depth
    0.289
    Sensitive Paths sensitive_paths
    0.070
    Ai Authored ai_authored
    0.050
    Real PR Conversation Timeline
    1 comments
    "Review active on #4174"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 56.8% reviewed sensitive_module
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 70.2% (HIGH) · Higher = larger blast radius
    70.2%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 56.8% · Lower = rushed or shallow review
    56.8%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 30.4% · Safe to merge
    30.4%