Skip to content

feat: support with-replacement sampling for weighted random failover#704

Merged
fergusfinn merged 2 commits intomainfrom
feat/with-replacement-failover
Feb 17, 2026
Merged

feat: support with-replacement sampling for weighted random failover#704
fergusfinn merged 2 commits intomainfrom
feat/with-replacement-failover

Conversation

@fergusfinn
Copy link
Contributor

Summary

  • Bumps onwards to 0.13.0 which adds with_replacement and max_attempts to FallbackConfig
  • Adds DB migration (065) with fallback_with_replacement (bool, default false) and fallback_max_attempts (nullable int) columns on deployed_models
  • Wires the new fields through the full stack: DB models/handlers, API models, onwards sync, and dashboard UI
  • Dashboard shows the new controls only for weighted random strategy when fallback is enabled

Test plan

  • All 862 Rust tests pass
  • All 384 TypeScript tests pass
  • just lint rust and just lint ts pass
  • cargo sqlx prepare --check passes
  • Manual test: create a virtual model with "sample with replacement" enabled and verify it persists
  • Manual test: edit routing config to toggle with-replacement and set max attempts

Copilot AI review requested due to automatic review settings February 16, 2026 13:19
@railway-app railway-app bot temporarily deployed to industrious-light / control-layer-pr-704 February 16, 2026 13:19 Destroyed
@railway-app
Copy link

railway-app bot commented Feb 16, 2026

🚅 Deployed to the control-layer-pr-704 environment in industrious-light

Service Status Web Updated (UTC)
control-layer 🕒 Building (View Logs) Web Feb 17, 2026 at 11:43 am

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 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".

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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_replacement and fallback_max_attempts and 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.

@railway-app railway-app bot temporarily deployed to industrious-light / control-layer-pr-704 February 16, 2026 13:25 Destroyed
… 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
@fergusfinn fergusfinn force-pushed the feat/with-replacement-failover branch from ef79b86 to 8eaa6fb Compare February 17, 2026 11:43
@railway-app railway-app bot temporarily deployed to industrious-light / control-layer-pr-704 February 17, 2026 11:43 Destroyed
@fergusfinn fergusfinn merged commit 3c4fb9b into main Feb 17, 2026
5 of 6 checks passed
fergusfinn pushed a commit that referenced this pull request Feb 17, 2026
🤖 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).
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