Skip to content

fix(api): refuse creating a routing combo without any model - #11162

Merged
diegosouzapw merged 1 commit into
cheaper-inference:release/v3.8.50from
maxmad64bis:fix/combo-create-min1
Aug 23, 2026
Merged

diegosouzapw merged 1 commit into
cheaper-inference:release/v3.8.50from
maxmad64bis:fix/combo-create-min1

Conversation

@maxmad64bis

Copy link
Copy Markdown
Contributor

Summary

  • Creating a routing combo without any model is now refused at the boundary: createComboSchema requires a non-empty models list, so POST /api/combos returns 400 for a missing or empty list.
  • omniroute combo create requires --models <provider/model,...> and/or repeated --model, instead of silently writing models: [].
  • docs/openapi.yaml: ComboCreate aligned with the actual request contract (required: [name, models], union string | structured entry, phantom properties model/nodes removed).

Related Issues

Validation

  • Change type: routing / CLI
  • Focused tests: node --import tsx/esm --test tests/unit/combo-empty-models.test.ts tests/unit/combo-context-length.test.ts tests/unit/combo-bracket-names.test.ts tests/unit/cli-combo-create-models-10954.test.ts (and the full tests/unit/combo-* / combos-* set) — all green
  • npm run lint — no new findings from this PR's files (pre-existing failures elsewhere are unchanged; see Reviewer Notes)
  • Reconciled with the current active release base; focused checks rerun afterward
  • Production-code changes include updated automated tests in this PR

Manual loop on a live server: POST /api/combos without models → 400; with one model → 201; combo create without --models → stderr message naming the flags, exit code 1.

Tests Added Or Updated

  • tests/unit/combo-empty-models.test.ts — invariant inverted: creating without a model is refused at the boundary (was: asserted allowed).
  • tests/unit/cli-combo-create-models-10954.test.ts — new regression: the guard fires before reaching either transport (HTTP body or local-db fallback).
  • tests/unit/combo-context-length.test.ts, tests/unit/combo-bracket-names.test.ts — fixtures updated for the now-required models (8 call sites total).

Coverage Notes

Production change is confined to src/shared/validation/schemas/combo.ts (one line + comment) and bin/cli/commands/combo.mjs (guard). Covered by tests/unit/combo-empty-models.test.ts and tests/unit/cli-combo-create-models-10954.test.ts respectively. No coverage moved down in touched files.

Reviewer Notes

Third-party report cheaper-inference#10954 framed always-empty creation as a bug and
cheaper-inference#11011 made populated creation the normal CLI path (--models/--model),
so an empty draft has no remaining legitimate route. This closes the
remaining hole on both transports: POST /api/combos now returns 400 for
a missing or empty models list, and omniroute combo create requires
--models/--model instead of silently writing models: []. Consistent
with the existing fail-closed behavior for empty pools (cheaper-inference#8494, cheaper-inference#6546):
the dashboard already refused empty combos client-side, six downstream
consumers reject the empty object, and /api/combos/duplicate already
returns 400 for it. JSON migration is unaffected (it validates through
the combo invariants, not this schema).
@maxmad64bis
maxmad64bis force-pushed the fix/combo-create-min1 branch from f3af782 to 2b69e43 Compare August 22, 2026 20:06
@diegosouzapw
diegosouzapw merged commit b384455 into cheaper-inference:release/v3.8.50 Aug 23, 2026
9 of 16 checks passed
jonlwheat2-gif added a commit to jonlwheat2-gif/OmniRoute that referenced this pull request Aug 23, 2026
…cheaper-inference#11203)

Rebuilt on the current base (79c5bdf) after the owner's cheaper-inference#10964 fixed
the first 7 failures (combos, HarImport, aihorde SSRF, config-generator
128K, quota 403, openrouter allExpired, pt-BR keys). This carries the
remaining base-red failures:

- guide-settings-route.test.ts: v2 providers.omniroute dual-write
  assertion — cheaper-inference#10964 updated the model-limit blocks but missed the
  stale content.providers === undefined assert (line 130)
- t40-opencode-cli-tools-integration.test.ts: v2 schema assert
- clinepass-provider.test.ts: z-ai/glm-5.2 vendor prefix (cheaper-inference#6108)
- provider-alias-uniqueness.test.ts: Hack Club AI removal (cheaper-inference#11118)
- eslint-suppressions.json: prune 2 stale entries
- cli-combo-command.test.ts: pass models to combo create (cheaper-inference#11162,
  reported by reviewer as cheaper-inference#11203) — verified 5/5 on Linux (Docker)
diegosouzapw pushed a commit that referenced this pull request Aug 23, 2026
Validated on the combined batch board over tip 8a42aee: static gates clean (changelog, file-size 159 frozen, complexity 2621<=2774, cognitive 1181<=1223, dead-code 408<=416), typecheck:core clean, 107 focused tests green.

This drains the remaining #9985 tail — the v2 dual-write assertions (guide-settings/t40), the zai→z-ai stale id, the hackclub leftovers, and the #11162 cli-combo models (#11203). Note: guide-settings also trips this devbox's container guard (/.dockerenv present), an environment artifact unrelated to CI. Base is green again. Thank you @jonlwheat2-gif!
@maxmad64bis
maxmad64bis deleted the fix/combo-create-min1 branch September 24, 2026 21:13
muhamadgalihsaputra pushed a commit to niyatna/NiyatnaRoute that referenced this pull request Sep 27, 2026
…inference#11162)

Validated on the combined batch board over tip 4813c32: static gates clean (changelog, file-size, complexity 2624<=2774, cognitive 1182<=1223, dead-code 411<=416), typecheck:core clean, focused tests green.

Combo without models is now refused at the schema boundary (API 400), the CLI flags it, and openapi.yaml matches the real contract (phantom props removed). combo-* suites + cli-combo-create-models green on the board. Closes cheaper-inference#10954. Thank you @maxmad64bis!
muhamadgalihsaputra pushed a commit to niyatna/NiyatnaRoute that referenced this pull request Sep 27, 2026
…cheaper-inference#11203) (cheaper-inference#11201)

Validated on the combined batch board over tip 76f9b2f: static gates clean (changelog, file-size 159 frozen, complexity 2621<=2774, cognitive 1181<=1223, dead-code 408<=416), typecheck:core clean, 107 focused tests green.

This drains the remaining cheaper-inference#9985 tail — the v2 dual-write assertions (guide-settings/t40), the zai→z-ai stale id, the hackclub leftovers, and the cheaper-inference#11162 cli-combo models (cheaper-inference#11203). Note: guide-settings also trips this devbox's container guard (/.dockerenv present), an environment artifact unrelated to CI. Base is green again. Thank you @jonlwheat2-gif!
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.

fix(cli): combo create cannot accept models and always creates an empty combo

2 participants