Skip to content

Revert the node window cap (#132) - #133

Merged
feruzm merged 1 commit into
mainfrom
revert/132-node-window-cap
Nov 25, 2026
Merged

feruzm merged 1 commit into
mainfrom
revert/132-node-window-cap

Conversation

@feruzm

@feruzm feruzm commented Nov 25, 2026

Copy link
Copy Markdown
Member

Reverts #132. Under production load the node pool answered nearly every upstream call 429 after it shipped, and successful calls dropped sharply. This restores the previous routing while the cause is found offline. Reopens #128.

Under production load the node pool answered nearly every call 429 after
the window cap shipped, so this restores the previous routing while the
cause is found. Reopens #128.
@qodo-code-review

Copy link
Copy Markdown

ⓘ Qodo reviews are paused because your trial has ended. Ask your workspace admin to add credits to resume reviews. Manage billing

@coderabbitai

coderabbitai Bot commented Nov 25, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 8 seconds.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: d53ffff7-932a-4d1b-9e31-b544e025133a
Commits

Reviewing files that changed from the base of the PR and between 7fe81c5 and b7de315.

Files selected for processing: 6

  • CLAUDE.md
  • dotnet/EcencyApi.Tests/HiveRpcFailoverTests.cs
  • dotnet/EcencyApi.Tests/NodeWindowCapTests.cs
  • dotnet/EcencyApi.Tests/SsrRpcTests.cs
  • dotnet/EcencyApi/Infrastructure/HiveRpcClient.cs
  • dotnet/EcencyApi/Infrastructure/NodeHealthTracker.cs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-25T22:43:53.372114Z b7de315 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@qodo-free-for-open-source-projects

qodo-free-for-open-source-projects Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

PR Summary by Qodo

Revert the node window cap to restore RPC routing

🐞 Bug fix 🕐 20-40 Minutes

Grey Divider

AI Description

• Reverts the learned node window cap after production traffic encountered widespread upstream 429s.
• Restores park-based failover and removes window-cap statistics and tests while the cause is
 investigated.
Merge Risk 🔴 High

Blast radius 🔴 High 💥 3 capabilities

  • 3 affected capabilities span independent functional scopes: Hive upstream read integration, Hive-Engine upstream integration, SSR operational observability.
  • The changed admission decision is consumed by HiveRpcClient to select Hive nodes for the service's end-to-end read operations.
  • NodeHealthTracker is an implementation boundary, not an independent capability; the affected outcome is whether Hive-backed reads are served or fail over.
  • Hive-Engine uses the same NodeHealthTracker rate-limit state but is a distinct upstream integration with separate /contracts and history API read outcomes.
  • Its consumers and upstream endpoints are independent of Hive JSON-RPC reads, so this is an independent functional scope rather than another technical hop.
  • The changed rate-limit state controls which Hive node receives later reads; the affected user-visible behavior is Hive-backed read availability, not the internal tracker itself.
  • The Engine client independently consumes the shared rate-limit tracker and has separate upstream read consumers, so over-parking can affect Engine-backed reads without requiring a Hive RPC call path.
  • This is a distinct operational outcome: authorized stats consumers receive a changed health payload.
  • It is independent of serving Hive or Engine read results, although it reports the same underlying tracker.
Behavioral complexity 🔴 High 🧩 Interacting branches, Concurrent ordering

  • Before: admission considered both 429 parking and a learned rolling-window count, and concurrent calls could be refused at the cap while one last-resort probe remained possible.
  • After: admission considers the failure park and 429 park but has no window count or AtCap state.
  • New correctness condition: concurrent calls and post-park calls must remain safe without exceeding any upstream rolling capacity, while failover ordering and the single-probe behavior continue to operate.
  • This materially removes an interaction between admission, rolling state, and concurrent requests; it is not merely reuse of an existing helper.
Potential damage 🟡 Medium 🩹 Temporary loss

  • For Hive reads, a faulty loss of capacity admission can produce repeated upstream throttling and failover exhaustion, temporarily preventing reads until an upstream window clears or capacity is restored.
  • Reverting the code restores the former in-process guard; no persistent application state is modified.
  • Engine reads share the changed tracker rate-limit semantics, but the removed admission cap is not directly used by EngineRpcClient, so its direct exposure is narrower than Hive's.
  • Usually recoverable by upstream window recovery, node capacity restoration, or code rollback.
  • A pool-wide throttle can still cause temporary read unavailability during the recovery interval; no persistent-state repair or external compensation is indicated.
Assessed commit b7de315
Diagram

graph TD
  Caller["RPC caller"] --> Router["Hive RPC client"] --> Tracker["Node health tracker"] --> Parked{"Node parked?"} -->|No| Node["Upstream node"] --> Result["Response or failover"]
  Parked -->|Yes| Probe["Deferred probe"] --> Node
  Node -->|429 feedback| Tracker
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Disable the cap behind a feature flag
  • ➕ Allows controlled re-enablement after diagnosis without another deployment.
  • ➖ Leaves the implicated admission logic in the production path and adds operational complexity.

Recommendation: The full revert is the safer immediate response to the reported production regression. Investigate the cap offline before reintroducing it; note that this revert also restores escalation-streak increments for 429s with Retry-After.

Files changed (5) +24 / -387

Bug fix (2) +23 / -238
HiveRpcClient.csRestore park-only RPC admission and probe selection +11/-41

Restore park-only RPC admission and probe selection

• Removes cap-aware admission, fallback-send accounting, and window statistics. Deferred probes and retry advice again use the 429 park duration; unknown-method fallbacks can be sent without a cap check.

dotnet/EcencyApi/Infrastructure/HiveRpcClient.cs

NodeHealthTracker.csRemove learned window caps from node health +12/-197

Remove learned window caps from node health

• Deletes rolling send counts, cap learning, send tickets, and at-cap admission. Retains health-based admission and 429 parking, while restoring escalation-streak increments even when Retry-After is supplied.

dotnet/EcencyApi/Infrastructure/NodeHealthTracker.cs

Tests (2) +0 / -148
HiveRpcFailoverTests.csRemove window-cap failover and fallback tests +0/-129

Remove window-cap failover and fallback tests

• Removes integration tests for learned caps, counted fallback sends, refunds, and last-resort requests past the cap. Existing failover tests remain.

dotnet/EcencyApi.Tests/HiveRpcFailoverTests.cs

SsrRpcTests.csRemove window-cap assertions from SSR statistics tests +0/-19

Remove window-cap assertions from SSR statistics tests

• Stops asserting the removed window-cap and window-send fields on the SSR statistics response.

dotnet/EcencyApi.Tests/SsrRpcTests.cs

Documentation (1) +1 / -1
CLAUDE.mdRemove window-cap behavior from failover guidance +1/-1

Remove window-cap behavior from failover guidance

• Describes the restored health, parking, and latency-based routing without claiming that nodes enforce a learned rolling-window cap.

CLAUDE.md

@qodo-free-for-open-source-projects

qodo-free-for-open-source-projects Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (1) 🎨 UX issues (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)

Grey Divider


Remediation recommended

1. Retry-After 429s still climb the park escalation 📎 Requirement gap ≡ Correctness
Description
RecordRateLimited uses retryAfterMs for the current park but increments h.RateLimitStreak on
every 429, including those with Retry-After. If a header-less 429 follows header-bearing 429s
before the 120-second streak reset, Hive or Engine can park the node for an escalated fallback
duration instead of the initial 10 seconds.
Code

dotnet/EcencyApi/Infrastructure/NodeHealthTracker.cs[R240-243]

+            var parkMs = retryAfterMs
+                         ?? Math.Min(RateLimitBaseMs << Math.Min(h.RateLimitStreak, 3), RateLimitMaxMs);
+            h.RateLimitedUntilMs = now + parkMs;
+            h.RateLimitStreak++;
Evidence
In NodeHealthTracker.cs lines 240–243, the retry duration is selected before RateLimitStreak is
incremented unconditionally; the removed implementation incremented it only when no header was
present. The revert also removes RetryAfter_ParksForItsValue_AndDoesNotAdvanceTheEscalation at
NodeWindowCapTests.cs lines 322–336. Ticket #128 identified header-bearing 429s advancing the
streak as a separate bug, while the stated reason for this revert was the window-cap routing
regression. Hive and Engine both forward upstream retry durations to this tracker.

Keep Retry-After parking separate from escalation
dotnet/EcencyApi/Infrastructure/NodeHealthTracker.cs[240-243]
dotnet/EcencyApi/Infrastructure/NodeHealthTracker.cs[226-246]
dotnet/EcencyApi/Infrastructure/NodeHealthTracker.cs[235-244]
dotnet/EcencyApi/Infrastructure/HiveRpcClient.cs[400-408]
dotnet/EcencyApi/Infrastructure/EngineRpcClient.cs[55-60]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`RecordRateLimited` parks a node for its explicit `Retry-After` duration but also advances the fallback escalation streak. A later header-less 429 can therefore receive an escalated park instead of the initial 10-second step.
## Fix Focus Areas
- dotnet/EcencyApi/Infrastructure/NodeHealthTracker.cs[235-244]
- dotnet/EcencyApi/Infrastructure/NodeHealthTracker.cs[39-41]
- dotnet/EcencyApi.Tests/NodeWindowCapTests.cs[322-336]
## Recommended Fix
Branch on `retryAfterMs` in `RecordRateLimited`: when present, set `h.RateLimitedUntilMs` from that duration without changing `h.RateLimitStreak`; when absent, compute and apply the fallback ladder park, then increment the streak. Preserve the existing reset after 120 seconds without a throttle, and restore the comment stating that only header-less 429s advance escalation. Restore `RetryAfter_ParksForItsValue_AndDoesNotAdvanceTheEscalation` or an equivalent test without the window-cap pieces: verify a 3-second park for `Retry-After: 3` and a 10-second park for a header-less 429 following three header-bearing 429s.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Tip of the day
💡 Did you know, you can copy the agent prompt from any finding and feed it to your IDE agent

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

@feruzm
feruzm merged commit 53dfe0f into main Nov 25, 2026
5 checks passed
@feruzm
feruzm deleted the revert/132-node-window-cap branch November 25, 2026 22:45
@greptile-apps

greptile-apps Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

Confidence Score: 5/5 · The revert appears safe to merge.RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The revert appears safe to merge.

Summary

Reverts the learned per-node window cap and restores the previous RPC routing.

  • Hive RPC nodes no longer stop at a rolling call cap.

Reviews (1) · Last reviewed commit: "Revert the node window cap (#132)" · Reviewed by Greptile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant