fix(server): warn on duplicate target model ids - #180
Merged
Conversation
elyasmnvidian
force-pushed
the
emehtabuddin/fix-duplicate-target-diagnostic
branch
from
July 29, 2026 18:11
27ad0ce to
ec76568
Compare
elyasmnvidian
marked this pull request as ready for review
July 29, 2026 18:11
WalkthroughChanges
Target configuration validation
Estimated code review effort: 3 (Moderate) | ~20 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Comment |
grahamking
reviewed
Jul 29, 2026
elyasmnvidian
force-pushed
the
emehtabuddin/fix-duplicate-target-diagnostic
branch
from
July 30, 2026 06:21
ec76568 to
8d679ec
Compare
elyasmnvidian
force-pushed
the
emehtabuddin/fix-duplicate-target-diagnostic
branch
from
July 30, 2026 16:58
8d679ec to
2444823
Compare
grahamking
reviewed
Jul 31, 2026
elyasmnvidian
force-pushed
the
emehtabuddin/fix-duplicate-target-diagnostic
branch
2 times, most recently
from
August 3, 2026 20:26
9ddce18 to
aa4a094
Compare
Signed-off-by: Elyas Mehtabuddin <emehtabuddin@nvidia.com>
elyasmnvidian
force-pushed
the
emehtabuddin/fix-duplicate-target-diagnostic
branch
from
August 4, 2026 01:05
aa4a094 to
a9eaa18
Compare
grahamking
approved these changes
Aug 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two targets accidentally share one model id on one llm client:
An llm client keeps its models in a map keyed by id, so two targets with the same id on one client end up as one entry: the client keeps one target and drops the other. Both routes still start, and nothing reports the dropped target:
The fix
switchyard-servernow checks each(llm client, model id)pair while it reads the config. When two targets on one client reuse an id, it logs a warning that names the target, the id, and the client, then keeps starting:The same id on two different llm clients is fine and stays quiet — each client keeps its own model, so nothing is dropped. That is how you serve one model through two providers or two API keys.
What it does and does not do
The warning makes the dropped target visible at startup instead of silent. It does not stop the server: both routes still start, and the surviving target is what both serve.
One case to know: if the two targets differ only by
extra_body(say twoservice_tiervalues), the client still keeps one and drops the other'sextra_body. The check works from a set of(llm client, model id)pairs, so it can't compare the two targets — it warns the same for a harmless duplicate and for one that drops real config. Read the warning as "a target was dropped; make sure that is what you meant." To serve two tiers of one model, give each its own llm client (samebase_url, different client name).Evidence
No perf table — this change adds a startup warning, it does not change speed.
Compatibility
No breaking change: every config that started before still starts. A config with two same-id targets on one client now prints a warning where it used to say nothing.
How tested
cargo test -p switchyard-serverpasses (23 config tests, 17 server tests). Two config tests cover the behavior:accepts_duplicate_target_model_ids_on_one_client— two targets, same id and client; the build warns and still succeeds, and both routes resolve.accepts_same_model_id_on_different_llm_clients— same id on two clients; the build succeeds with no warning.cargo clippy -p switchyard-server --all-targets -- -D warningsandcargo fmt --all --checkare clean.Reproducer: