fix(decision): take a distribution-less answer as a committed choice
Merged
OK
13d ago+73+73+01234567890123456789-12-12-01234567890123456789
- AI Gateway reruns an uncertain decision on a fallback model when
providerOptions.gateway.modelscarries awhen: { confidenceBelow }entry (Vercel changelog, 2026-10-06). The executor already forwardsproviderOptionsuntouched, so a decision-model fallback worked by accident. - A language-model fallback returns
{ type: 'choice', choice }with noprobabilitiesand no confidence.selected()inpackages/decision/src/decide.tsthrewMODEL_OUTPUT_INVALIDon it, so the escalated step died. - A distribution-less answer now reads as a committed choice: probability 1, confidence 0.
minProbabilitylets it through,minConfidenceblocks it, matching the documented "0 when the provider reports none". Score answers get the same treatment. - Docs show the gateway fallback on the executor and name the gate interaction.
providerOptions: {
gateway: { models: [{ model: 'openai/gpt-6-luna-decisions', when: { confidenceBelow: 0.6 } }] },
},
Verified
Ran it locally: yes
- Live AI Gateway, Jev primary,
confidenceBelow: 0.99to force the fallback, one choice and one score question, through the package's owndecide().
| fallback | main | this branch |
|---|---|---|
openai/gpt-5-nano (language model) | MODEL_OUTPUT_INVALID The decision model returned an answer without a choice distribution. | intent {choice:"billing", probability:1, confidence:0}, quality {choice:"2", probability:1, score:2, confidence:0} |
openai/gpt-6-luna-decisions (decision model) | intent {choice:"billing", probability:0.89, confidence:0.83} | unchanged |
- With the threshold below Jev's confidence the gateway returns the primary result unchanged and nothing in the executor differs from main.
tests/cli.test.tsfails on this branch and onHEADalike withCONFIG_LOAD_FAILED, unrelated to this change.