Skip to content

fix(cli): combo create cannot accept models — add --models option (#10954) - #11011

Merged
diegosouzapw merged 2 commits into
release/v3.8.50from
fix/10954-combo-create-models
Aug 21, 2026
Merged

diegosouzapw merged 2 commits into
release/v3.8.50from
fix/10954-combo-create-models

Conversation

@diegosouzapw

Copy link
Copy Markdown
Owner

Closes #10954

Root cause

bin/cli/commands/combo.mjs:

  • the combo create subcommand only ever registered --strategy;
  • the HTTP body (POST /api/combos, line ~292) and the local-db fallback
    (db.combos.createCombo, line ~308) both hardcoded models: [].

Every combo created via omniroute combo create came out empty regardless
of operator intent — there was no CLI flag to specify models at all.

Fix

  • Added --models <spec> (comma-separated provider/model entries, or a
    JSON array of structured ComboStep-shaped entries) and a repeatable
    --model <spec> option to combo create.
  • New bin/cli/commands/comboModels.mjs module parses and validates these
    options. The CLI ships as plain .mjs with relative-only imports (no
    @/ path aliases, no TS transpilation at runtime), so importing the real
    Zod schema from src/shared/validation/schemas/combo.ts directly is not
    viable — this module instead validates the same minimal shape by hand
    (string entries, { kind?: "model", model, providerId?, provider? }, or
    { kind: "combo-ref", comboName }), matching comboModelEntry /
    createComboSchema.models.
  • runComboCreateCommand now propagates the parsed models array into
    both the HTTP body and the local-db fallback instead of the hardcoded
    [].

Tests (TDD, Hard Rule #18)

tests/unit/cli-combo-create-models-10954.test.ts:

  • RED on the untouched code: --models/--model are unrecognized options
    — Commander (exitOverride) throws unknown option '--models'.
  • GREEN after the fix: Commander parses both options; comboModels
    parser unit tests (CSV, JSON array, invalid-shape rejection, merge of
    --models + repeated --model); end-to-end through
    runComboCreateCommand for both the local-db fallback (models land in
    getComboByName(...).models, normalized by the repository layer) and
    the HTTP path (the POST /api/combos body carries the parsed models).

Sibling suites re-run clean: cli-combo-command.test.ts,
cli-combo-suggest-commands.test.ts, cli-route-unavailable-fallback-10081.test.ts.

Gates run locally

  • node --import tsx/esm --test tests/unit/cli-combo-create-models-10954.test.ts tests/unit/cli-combo-command.test.ts tests/unit/cli-combo-suggest-commands.test.ts tests/unit/cli-route-unavailable-fallback-10081.test.ts — 22/22 green
  • node scripts/check/check-file-size.mjs — OK
  • node scripts/check/check-complexity.mjs — OK (2615 violations vs baseline 2774)
  • node scripts/check/check-cognitive-complexity.mjs — OK (1175 violations vs baseline 1223)
  • npm run typecheck:core — clean
  • npx eslint bin/cli/commands/combo.mjs bin/cli/commands/comboModels.mjs tests/unit/cli-combo-create-models-10954.test.ts --suppressions-location config/quality/eslint-suppressions.json — clean (no new any)
  • node scripts/check/check-changelog-integrity.mjs — OK

⚠️ base-red inherited: #9985 — public-creds(copilot-m365-web), docs-sync(PROVIDER_REFERENCE)

@diegosouzapw
diegosouzapw force-pushed the fix/10954-combo-create-models branch from f3d412f to 519cec9 Compare August 21, 2026 16:51
@diegosouzapw
diegosouzapw merged commit 48addd5 into release/v3.8.50 Aug 21, 2026
18 of 36 checks passed
Sa3id23 pushed a commit to Sa3id23/OmniRoute that referenced this pull request Aug 21, 2026
…egosouzapw#10954) (diegosouzapw#11011)

⭐5 — Fix(diegosouzapw#10954): `combo create` via CLI sempre criava combos vazios (models: [] hardcoded, sem flag). Adiciona --models/--model com parser próprio (CLI .mjs sem alias @/). TDD RED→GREEN, 22/22 testes verdes. UNSTABLE é o base-red inherited diegosouzapw#9985.
maxmad64bis pushed a commit to maxmad64bis/OmniRoute that referenced this pull request Aug 22, 2026
Third-party report diegosouzapw#10954 framed always-empty creation as a bug and
diegosouzapw#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 (diegosouzapw#8494, diegosouzapw#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).
@diegosouzapw
diegosouzapw deleted the fix/10954-combo-create-models branch August 23, 2026 21:45
muhamadgalihsaputra pushed a commit to niyatna/NiyatnaRoute that referenced this pull request Sep 27, 2026
…egosouzapw#10954) (diegosouzapw#11011)

⭐5 — Fix(diegosouzapw#10954): `combo create` via CLI sempre criava combos vazios (models: [] hardcoded, sem flag). Adiciona --models/--model com parser próprio (CLI .mjs sem alias @/). TDD RED→GREEN, 22/22 testes verdes. UNSTABLE é o base-red inherited diegosouzapw#9985.
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