[PR #418] [CLOSED] fix(scheduler): keep round-robin fair when candidates change #419

Closed
opened 2026-10-29 14:23:12 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/kvcache-ai/AgentENV/pull/418
Author: @guozy18
Created: 10/22/2026
Status: ❌ Closed

Base: main ← Head: sync/round-robin-fairness


📝 Commits (1)

  • 7522262 fix: make scheduler round_robin fair across changing candidate sets

📊 Changes

2 files changed (+210 additions, -6 deletions)

View changed files

📝 services/scheduler/internal/strategy.go (+56 -4)
📝 services/scheduler/internal/strategy_test.go (+154 -2)

📄 Description

What

Choose the least-recently-picked node by identity so temporary filtering, rate limits, or candidate reordering do not skew round-robin selection.

Why

The previous counter modulo candidate-count selects by slice position; changing that slice can repeatedly favor the same nodes.

N/A — focused correction of existing behavior.

Scope and non-goals

The round-robin implementation and its original regression tests.

Design and behavior changes

Serialize selection with a mutex, remember the last selection time per node, break ties by node ID, and expire entries idle for 24 hours with a sweep limited to once per minute.

Compatibility and operations

Scheduling distribution changes when candidate sets change. No API, configuration, persistence, or host-requirement changes. Ordinary code upgrade/revert.

Validation

This branch is based directly on upstream main a97473b and contains one feature commit with no unmerged PR dependencies.

PASS: make -C services test fmt-check vet
PASS: go -C services test ./...
PASS: cargo clippy --locked -p agentenv -p overlaybd --all-targets --all-features -- -D warnings
PASS: complete cache regression group (81 passed, 1 ignored; no timeout exclusions)
PASS: formatting and git diff --check

Go checks ran on macOS; Rust checks ran on Linux as a non-root user. The Go subtree is unchanged by the upstream rebase, so the existing Go test, formatting and vet results apply. Full KVM E2E and performance benchmarks were not run.

Risks and reviewer notes

The original scheduler patch, author and author date are preserved. The original message and existing migration co-author trailer are retained. This introduces per-node in-memory bookkeeping; stale entries are reclaimed. No throughput benchmark was run.

Checklist

  • One coherent change with no unrelated refactoring or formatting.
  • Original author attribution and author date are retained.
  • No private deployment configuration or credentials included.
  • Generated API files are unchanged.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/kvcache-ai/AgentENV/pull/418 **Author:** [@guozy18](https://github.com/guozy18) **Created:** 10/22/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `sync/round-robin-fairness` --- ### 📝 Commits (1) - [`7522262`](https://github.com/kvcache-ai/AgentENV/commit/7522262be6556f466fe8078808dea055a0dccac9) fix: make scheduler round_robin fair across changing candidate sets ### 📊 Changes **2 files changed** (+210 additions, -6 deletions) <details> <summary>View changed files</summary> 📝 `services/scheduler/internal/strategy.go` (+56 -4) 📝 `services/scheduler/internal/strategy_test.go` (+154 -2) </details> ### 📄 Description ## What Choose the least-recently-picked node by identity so temporary filtering, rate limits, or candidate reordering do not skew round-robin selection. ## Why The previous counter modulo candidate-count selects by slice position; changing that slice can repeatedly favor the same nodes. ## Related issue N/A — focused correction of existing behavior. ## Scope and non-goals The round-robin implementation and its original regression tests. ## Design and behavior changes Serialize selection with a mutex, remember the last selection time per node, break ties by node ID, and expire entries idle for 24 hours with a sweep limited to once per minute. ## Compatibility and operations Scheduling distribution changes when candidate sets change. No API, configuration, persistence, or host-requirement changes. Ordinary code upgrade/revert. ## Validation This branch is based directly on upstream main `a97473b` and contains one feature commit with no unmerged PR dependencies. ```text PASS: make -C services test fmt-check vet PASS: go -C services test ./... PASS: cargo clippy --locked -p agentenv -p overlaybd --all-targets --all-features -- -D warnings PASS: complete cache regression group (81 passed, 1 ignored; no timeout exclusions) PASS: formatting and git diff --check ``` Go checks ran on macOS; Rust checks ran on Linux as a non-root user. The Go subtree is unchanged by the upstream rebase, so the existing Go test, formatting and vet results apply. Full KVM E2E and performance benchmarks were not run. ## Risks and reviewer notes The original scheduler patch, author and author date are preserved. The original message and existing migration co-author trailer are retained. This introduces per-node in-memory bookkeeping; stale entries are reclaimed. No throughput benchmark was run. ## Checklist - [x] One coherent change with no unrelated refactoring or formatting. - [x] Original author attribution and author date are retained. - [x] No private deployment configuration or credentials included. - [x] Generated API files are unchanged. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-29 14:23:12 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
kvcache-ai/AgentENV#419
No description provided.