Skip to content

feat(grpc-router): use per-model retry config from WorkerRegistry - #933

Merged
CatherineSue merged 1 commit into
mainfrom
feat/grpc-router-retry-from-registry
Mar 26, 2026
Merged

CatherineSue merged 1 commit into
mainfrom
feat/grpc-router-retry-from-registry

Conversation

@CatherineSue

@CatherineSue CatherineSue commented Mar 26, 2026 •

Copy link
Copy Markdown
Member

Description

Part of the per-worker resilience refactor series: #799 → #803 → #821 → #836 → #875 → #881 → this PR.

Problem

gRPC router uses a single global retry_config for all requests, ignoring per-model retry config set by workers.

Solution

Look up per-model retry config from WorkerRegistry at request time for all 3 endpoints (chat, generate, messages), falling back to the router-level default.

Independent of #881 (HTTP router migration).

Changes

  • 3 call sites in grpc/router.rs updated to read from WorkerRegistry

Test Plan

  • cargo test -p smg --lib — all 450 tests pass
  • Pre-commit hooks pass (rustfmt, clippy, codespell, DCO)
Checklist
  • cargo +nightly fmt passes
  • cargo clippy --all-targets --all-features -- -D warnings passes
  • (Optional) Documentation updated
  • (Optional) Please join us on Slack #sig-smg to discuss, review, and merge PRs

Summary by CodeRabbit

Refactor

  • Retry configuration is now selected on a per-model basis for chat, generate, and messages routes instead of using a single router-level setting.

Summary by CodeRabbit

gRPC router now looks up per-model retry config from WorkerRegistry
at request time for all 3 endpoints (chat, generate, messages),
falling back to the router-level default if no worker group override
exists.

Signed-off-by: Chang Su <chang.s.su@oracle.com>
@coderabbitai

coderabbitai Bot commented Mar 26, 2026 •

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 01001d64-8349-48d6-b7f1-1b4c49196318

📥 Commits

Reviewing files that changed from the base of the PR and between 7310a1d and 60eff9a.

📒 Files selected for processing (1)
  • model_gateway/src/routers/grpc/router.rs

📝 Walkthrough

Walkthrough

The gRPC router now implements per-model retry configuration selection across chat, generate, and messages routes. For each request, it queries the worker registry for model-specific retry configuration, uses it if available, otherwise falls back to the router's default configuration, and passes the resolved config to the retry executor.

Changes

Cohort / File(s) Summary
gRPC Router Retry Config Selection
model_gateway/src/routers/grpc/router.rs
Added per-model retry config resolution by querying worker_registry.get_retry_config(model_id) in chat, generate, and messages routes; routes now conditionally use model-specific retry config or fall back to self.retry_config.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested labels

model-gateway

Suggested reviewers

  • key4ng
  • slin1237

Poem

🐰 A rabbit hops through retry schemes so fine,
Per-model configs? Now that's divine!
When one path fails, another shall do,
Flexible retries, tried and true! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the main change: implementing per-model retry configuration lookup from WorkerRegistry in the gRPC router, which is the primary focus of the changeset.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/grpc-router-retry-from-registry

Comment @coderabbitai help to get the list of available commands and usage tips.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces per-model retry configurations within the gRPC router, enabling the system to prioritize model-specific settings over global defaults. The logic for resolving the effective retry configuration is duplicated across several methods. It is recommended to extract this logic into a private helper method, possibly utilizing std::borrow::Cow to efficiently handle both owned and borrowed configuration data.

Comment thread model_gateway/src/routers/grpc/router.rs
@github-actions github-actions Bot added grpc gRPC client and router changes model-gateway Model gateway crate changes labels Mar 26, 2026
@CatherineSue
CatherineSue merged commit f04d3ee into main Mar 26, 2026
38 checks passed
@CatherineSue
CatherineSue deleted the feat/grpc-router-retry-from-registry branch March 26, 2026 21:10
smfirmin pushed a commit to smfirmin/smg that referenced this pull request Apr 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

grpc gRPC client and router changes model-gateway Model gateway crate changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant