Skip to content

Revert learned node rates (#129) - #130

Merged
feruzm merged 1 commit into
mainfrom
revert/129-node-rate-learning
Nov 20, 2026
Merged

feruzm merged 1 commit into
mainfrom
revert/129-node-rate-learning

Conversation

@feruzm

@feruzm feruzm commented Nov 20, 2026 •

Copy link
Copy Markdown
Member

Reverts #129. Reopens #128.

In production, within ten minutes of the deploy, every node's learned rate fell to the floor (0.5/s) and every node sat parked at the top of the 10/20/40/60s ladder. The share of upstream requests answered 429 rose well above what it was before #129, and fewer calls were answered.

Likely cause: when every node is parked, each call still sends one probe, with no limit across concurrent calls, so a parked node receives a stream of probes. Each probe is sent after the node's last rate decrease, so each of its 429s counts as a new signal: it halves the rate again and climbs the ladder, and the pool stays parked. The simulations ran at much lower concurrency than production and did not show this.

The tree after this revert is identical to main before the merge, the code production ran until the deploy. dotnet test EcencyApi.Tests: 894 passed.

Follow-up on #128: at most one probe in flight per rate-parked node, and a 429 for a call sent into a park does not climb the ladder. Then a simulation at production concurrency before trying again.

Summary by CodeRabbit

  • RPC Reliability
    • RPC calls now try healthy nodes in health order, with at most one deferred probe to a rate-limited node.
    • When all attempted nodes are rate-limited, the client waits according to the shortest remaining server-imposed pause.
    • Node selection no longer uses learned per-node sending rates or separate over-rate routing.

@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

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 20, 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-20T20:55:14.960676Z cc12b43 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 20, 2026 •

Copy link
Copy Markdown

PR Summary by Qodo

Revert learned Hive node rates after production throttling

🐞 Bug fix 🕐 20-40 Minutes

Grey Divider

AI Description

• Reverts learned per-node sending rates after production nodes fell to the rate floor and stayed
 parked.
• Restores pre-#129 Hive failover, 429 parking, and health statistics while retaining one probe per
 call.
• Removes learning-specific tests and adjusts failover tests for the restored parking intervals.
Merge Risk 🟡 Medium

Blast radius 🟡 Medium 💥 2 capabilities

  • 2 affected capabilities within one bounded functional scope: Hive upstream read integration.
  • SSR cache fills call HiveRpcClient for feed, discussion, post, profile, community, and condenser reads.
  • These are distinct delivery outcomes but share the bounded Hive upstream integration and the same routing state; the changed client is the common propagation point.
  • Recovery, explorer, account, and moderation reads are separate application outcomes but all depend on the shared HiveClients.Default/HiveRpcClient read integration.
  • They do not constitute independent functional scopes merely because they have different handlers.
Behavioral complexity 🟡 Medium 🧩 Interacting branches, Coordinated invariants

  • Before: admission combined failure parking, 429 parking, learned token/rate state, over-rate ordering, and in-flight accounting; correctness required those states to agree under concurrency.
  • After: learned-rate state and over-rate branches are removed, and all calls use the simpler park/admit path.
  • New correctness condition: the remaining 429 park, failure park, in-flight count, ordered-node snapshot, and single-probe behavior must still prevent an overloaded or half-open node from receiving an unsafe burst while preserving failover.
  • This is an interaction change, not merely routine reuse of an existing helper.
Potential damage 🟡 Medium 🩹 Recoverable

  • The likely failure is increased upstream throttling, latency, and read errors during overload rather than incorrect data or persistent corruption.
  • SSR may serve a prior cached value or return an upstream/rate-limited outcome; direct callers can retry after the pool recovers.
  • Reverting code restores the prior admission behavior, but any requests already rejected or delayed require normal retry and are not repaired by rollback.
  • Code rollback restores learned admission for future calls.
  • No persistent application state needs repair and no external write compensation is involved.
  • Recovery requires at least one Hive node to become available or rate limits to clear; the source does not establish automatic repair beyond ordinary subsequent calls.
Assessed commit cc12b43
Diagram

graph TD
  Caller["RPC Caller"] --> Client["Hive RPC Client"] --> Tracker["Node Health Tracker"] --> Parked{"Node parked?"}
  Parked -->|no| Nodes["Hive Nodes"] --> Outcome["RPC Outcome"]
  Parked -->|all parked| Probe["Single probe"] --> Nodes
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Patch probe admission without reverting rate learning
  • ➕ Could retain rate-aware routing and its intended capacity benefits.
  • ➖ Would require validating concurrent probes, parking escalation, and fallback behavior under production-level load before deployment.

Recommendation: Prefer the rollback to restore the previously deployed behavior promptly. Reintroduce rate learning only after limiting probes per parked node, preventing 429s from those probes from escalating its park, and testing at production concurrency.

Files changed (3) +44 / -469

Bug fix (2) +41 / -465
HiveRpcClient.csRestore health-based Hive RPC failover without learned rates +16/-138

Restore health-based Hive RPC failover without learned rates

• Removes rate-aware admission, over-rate passes, and learned-rate health statistics. Restores routing through ordered nodes followed by at most one parked-node probe per call, with retry advice based on parked nodes.

dotnet/EcencyApi/Infrastructure/HiveRpcClient.cs

NodeHealthTracker.csRemove per-node rate learning from shared health tracking +25/-327

Remove per-node rate learning from shared health tracking

• Removes token buckets, rate adjustment, over-rate ordering, and rate-specific admission APIs. Restores 429 failure demotion and the existing Retry-After or 10/20/40/60-second parking ladder.

dotnet/EcencyApi/Infrastructure/NodeHealthTracker.cs

Tests (1) +3 / -4
HiveRpcFailoverTests.csAlign failover tests with restored parking behavior +3/-4

Align failover tests with restored parking behavior

• Removes a clock advance tied to learned sending rates and changes three test timestamps so their assertions exercise the restored 429 parking intervals.

dotnet/EcencyApi.Tests/HiveRpcFailoverTests.cs

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

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider

Great, no issues found!

Qodo reviewed your code and found no material issues that require review

Grey Divider

Tip of the day
💡 Did you know, you can turn on the rule miner and Qodo learns your standards from review history

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

@greptile-apps

greptile-apps Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The rollback appears safe to merge, with no actionable findings beyond the explicitly deferred behavior.

Summary

Reverts #129 and restores the exact tree from before learned node rates were merged.

  • Hive calls use health-based node selection instead of learned rate limits.

feruzm acknowledges that concurrent calls can send unlimited probes to parked nodes and keep increasing their parks. The description defers those changes and a production-scale simulation to #128.

Tests were not run during this review.

Reviews (1) · Last reviewed commit: "Revert "Merge pull request #129 from ece..." · Reviewed by Greptile

@feruzm
feruzm merged commit 18e66bd into main Nov 20, 2026
4 of 5 checks passed
@feruzm
feruzm deleted the revert/129-node-rate-learning branch November 20, 2026 20:57
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