feat: support with-replacement sampling for weighted random failover#704
feat: support with-replacement sampling for weighted random failover#704fergusfinn merged 2 commits intomainfrom
Conversation
|
🚅 Deployed to the control-layer-pr-704 environment in industrious-light
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 00972b9460
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
Pull request overview
Adds support for with_replacement sampling and max_attempts to composite-model fallback configuration, propagating the new settings from DB schema through the Rust API/sync layer to the dashboard UI, and updating the onwards dependency to consume the new fields.
Changes:
- Add DB columns for
fallback_with_replacementandfallback_max_attemptsand wire them through Rust DB models/handlers and API models. - Sync the new fallback settings into onwards pool specs (requires onwards
0.13.0). - Expose new controls in the dashboard for weighted-random routing when failover is enabled.
Reviewed changes
Copilot reviewed 18 out of 19 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| dwctl/src/sync/onwards_config.rs | Loads new fallback fields from DB and maps them into onwards fallback config. |
| dwctl/src/sync/endpoint_sync.rs | Updates test fixtures to include new fallback fields. |
| dwctl/src/sample_files/mod.rs | Updates sample/test config fixtures with new fallback fields. |
| dwctl/src/request_logging/batcher.rs | Updates integration test fixtures with new fallback fields. |
| dwctl/src/metrics/cache_info.rs | Updates test fixtures with new fallback fields. |
| dwctl/src/db/models/deployments.rs | Extends fallback config + create/update request/response structs to include new fields. |
| dwctl/src/db/handlers/deployments.rs | Extends SQL INSERT/SELECT/UPDATE paths to persist and load new fields. |
| dwctl/src/api/models/deployments/mod.rs | Extends API create/update/response models to include new fallback settings. |
| dwctl/migrations/065_add_fallback_with_replacement.sql | Adds new columns on deployed_models for the fallback settings. |
| dwctl/Cargo.toml | Bumps onwards dependency to 0.13.0. |
| dashboard/src/components/modals/CreateVirtualModelModal/CreateVirtualModelModal.tsx | Adds create-form controls for with-replacement and max-attempts. |
| dashboard/src/components/features/models/ModelInfo/ProvidersTab.tsx | Adds edit-routing controls for with-replacement and max-attempts. |
| dashboard/src/api/control-layer/types.ts | Extends dashboard API types with the new fallback fields. |
| Cargo.lock | Locks updated dependency graph after onwards bump. |
| .sqlx/query-*.json | Updates SQLx offline metadata for updated queries/columns. |
dashboard/src/components/modals/CreateVirtualModelModal/CreateVirtualModelModal.tsx
Outdated
Show resolved
Hide resolved
dashboard/src/components/modals/CreateVirtualModelModal/CreateVirtualModelModal.tsx
Outdated
Show resolved
Hide resolved
dashboard/src/components/features/models/ModelInfo/ProvidersTab.tsx
Outdated
Show resolved
Hide resolved
… random failover Integrates onwards 0.13.0 which adds configurable with/without-replacement sampling for the WeightedRandom load balancing strategy. When enabled, high-weight providers can be retried multiple times during failover, which is useful when transient errors are expected. A max_attempts cap controls how many retries are attempted (defaults to provider count). Changes span the full stack: database migration, Rust API/DB models, onwards sync, and dashboard UI (both create and edit modals).
- Guard i32→usize cast for max_attempts with try_from and >= 1 filter to prevent negative values wrapping into huge retry budgets - Fix migration comment to accurately describe defaults (FALSE, not NULL) - Only show with-replacement controls when fallback is also enabled - Replace parseInt with Number() + isFinite guard for max attempts input to handle intermediate input states safely
ef79b86 to
8eaa6fb
Compare
🤖 I have created a release *beep* *boop* --- ## [7.5.0](v7.4.1...v7.5.0) (2026-02-17) ### Features * support with-replacement sampling for weighted random failover ([#704](#704)) ([3c4fb9b](3c4fb9b)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
Summary
with_replacementandmax_attemptstoFallbackConfig065) withfallback_with_replacement(bool, default false) andfallback_max_attempts(nullable int) columns ondeployed_modelsTest plan
just lint rustandjust lint tspasscargo sqlx prepare --checkpasses