BobSong-dev opened a new issue, #7957:
URL: https://github.com/apache/shenyu/issues/7957

   ## Background
   P1-13 in the mentor-approved OSPP plan; parent #7949. Per-process resource 
admission is not a distributed tenant/subject business quota across gateway 
replicas.
   
   ## Existing capabilities and reuse
   Reuse trusted identity and deny-first tools authorization, Redis and 
existing rate-limiter infrastructure, current deadlines, P1-07 resource bounds, 
P1-12 decisions and existing audit/metrics. Review #7702 / PR #7848 
atomic/idempotent accounting patterns where applicable, but MCP invocation 
counts are not LLM tokens.
   
   ## Implementation scope
   - Implement tenant/subject invocation-count windows first; explicitly scoped 
tool/server dimensions and multilevel concurrency are added only where required 
by the chosen policy, without allowing cross-tenant keys.
   - Provide atomic distributed admission, deterministic window expiry and 
separate count-debit versus concurrency-release semantics.
   - Use unique bounded concurrency leases, renewal where necessary, crash 
expiry and idempotent release. Define failed admissions, cancellation, retry 
and unknown upstream outcome accounting.
   - Validate trusted configuration; define Redis failure behavior explicitly 
and preserve underlying authentication/authorization/resource limits.
   - Ship shadow/enforce using P1-12, isolated shadow state, audit decisions 
and bounded metrics in the initial feature.
   
   ## Non-goals
   A second rate-limiter platform, elapsed-time billing/quota, LLM token/cost 
budgets (P1-14), or replaying side-effecting tools. Existing deadlines remain 
the execution-time boundary.
   
   ## Acceptance criteria
   - [ ] Two or more gateways cannot admit beyond the configured shared 
count/concurrency policy through races.
   - [ ] Count consumption and permit release are independently correct; 
duplicate completion cannot refund counts or release another request's lease.
   - [ ] Crashed holders/expired windows recover within documented bounds; 
renewal cannot resurrect removed policies or released leases.
   - [ ] Redis outage, config updates and cancellation have explicit outcomes; 
state/key cardinality and shadow retention are bounded.
   - [ ] Shadow does not debit production counters; enforce rejects at the 
actual execution boundary with matching audit/metrics.
   
   ## Tests
   Real Redis multi-instance concurrent admission, window boundaries, 
renewal/release races, process-loss/expiry and Redis outage/recovery; 
authenticated tenant isolation, config invalidation, shadow/enforce transitions 
and actual MCP side-effect counts. Avoid timing-only assertions where 
controllable clocks/barriers are possible.
   
   ## Dependencies
   P0-02/P0-03, P1-07 and P1-12; P1-06 audit vocabulary. Reliable atomic 
admission lessons should be reused by P1-14, not a hard requirement to create 
another accounting store.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to