RFC-64 M1 4/7: add adaptive capacity primitives - #2015
Conversation
e628fe3 to
695cb97
Compare
d0dcb18 to
fde07fa
Compare
9c848db to
c5b9ec1
Compare
c5b9ec1 to
5685115
Compare
acfee2b to
9896d6b
Compare
4b83ea1 to
e7bbbac
Compare
9896d6b to
b0d93ed
Compare
a6fa200 to
264d92d
Compare
b0d93ed to
34d3cf0
Compare
264d92d to
aa41669
Compare
otReviewAgent
left a comment
There was a problem hiding this comment.
Operational Notice: Review Agent could not complete this review.
Verification reviewer failed: retry_exhausted
otReviewAgent
left a comment
There was a problem hiding this comment.
Operational Notice: Review Agent could not complete this review.
Business logic reviewer failed: retry_exhausted
34d3cf0 to
235c807
Compare
otReviewAgent
left a comment
There was a problem hiding this comment.
Operational Notice: Review Agent could not complete this review.
Business logic reviewer failed: retry_exhausted
aa41669 to
4376835
Compare
| } | ||
|
|
||
| /** Resolve one node-wide policy; the optional live limit is shared by every admission. */ | ||
| export function resolveSyncGlobalBackpressure( |
There was a problem hiding this comment.
🔴 Bug: Adaptive capacity is not wired into production admissions
What's wrong
The changed backpressure API accepts a live capacity resolver, but this diff does not connect the new adaptive controller/sampler to any production call path. As a result, the feature does not actually throttle requester concurrency or Core automatic coverage under CPU, heap, event-loop, or store pressure.
Example
On a core node with heap pressure above criticalHeapRatio, the new controller would halve its current inflight value. In the submitted diff, no production code creates that controller, samples pressure, passes controller.getCurrentInflight() into resolveSyncGlobalBackpressure, calls notifyGlobalSyncBackpressureCapacityChanged, or passes the adaptive coverage batch into the Core coverage scheduler. Admissions therefore continue using the static configured/global default limit and automatic coverage continues at the configured batch size.
Suggested direction
Wire the new adaptive capacity runtime into the existing DKG agent sync lifecycle instead of only exposing helper APIs; production admission and coverage planning need to consume the controller’s current limits.
For Agents
Add a runtime owner in the agent lifecycle/base layer that resolves adaptive bounds, constructs AdaptiveCapacityController and AdaptiveCapacitySampler, periodically samples demand/pressure, calls notifyGlobalSyncBackpressureCapacityChanged() after capacity changes, passes the live currentLimit into the global backpressure policy used by withGlobalSyncBackpressure, and uses getEffectiveCoverageBatch() when planning Core public coverage. Add an integration test proving pressure reduces both requester admissions and automatic coverage breadth.
M1 stack
This is PR 4 of 7 in the RFC-64 M1 stack.
Exact stack provenance
235c8071a098782d0aa454ec2eededd95280376b43768351aee0d4c93e86bddf065197ed6aced496Summary
This PR adds the internal primitives required for adaptive synchronization capacity:
This slice is intentionally dormant.
DKGAgentdoes not instantiate the controller, attach a live admission provider, or alter the live Core coverage batch until PR 5.User and operator impact
There is no synchronization behavior change and no new operator configuration surface in this PR.
withGlobalSyncBackpressureretain the same call shape and behavior.This split lets reviewers validate admission safety, controller policy, sampling, and scheduler seams independently from runtime activation.
Before
sequenceDiagram participant J as Sync job participant A as Global admission participant C as Core coverage planner participant S as Triple store J->>A: Request admission A->>A: Apply static configured limit A-->>J: Start or queue C->>C: Apply fixed configured batch J->>S: Execute sync workAfter this PR
sequenceDiagram participant J as Sync job participant P as Admission policy participant A as Global admission participant C as Core coverage planner participant S as Triple store J->>A: Request admission with existing static policy A->>P: Resolve effective limit P-->>A: Static limit A-->>J: Start or queue unchanged C->>C: Apply fixed configured batch unchanged J->>S: Execute sync work Note over P,C: Dormant live-limit and effective-batch seams are activated only in PR 5Compatibility and safety
syncCorePublicBatchSize: 0still disables automatic Core coverage.Validation
git diff --checkRollout risk
Low. This PR adds internal extension points and policy logic but does not connect them to live agent execution or expose an operator-facing adaptive setting.
Review focus