Repository navigation
feat(sse): retry without thinking when a model rejects it outright - #13868
cryptiklemur wants to merge 5 commits into
Conversation
|
Conceito aprovado, bem contido. Falta teste do branch e um rebase. A premissa confere no tip: Verifiquei o que mais me preocupava e está certo: não há tempestade de retry. O branch é Pendência 1 — zero teste do branch. Pendência 2 — regressão pequena mas real. Em Pendência 3 — prettier vermelho no arquivo de teste (linha em branco dupla antes do primeiro teste novo, e um Seu CI vermelho é herdado, não defeito seu — provei rodando Decisão de produto: o cliente pediu thinking explicitamente e recebe resposta sem thinking, com uma linha de log. É coerente com o resto da cadeia de strip, mas é escolha de produto — vale confirmar. |
…for diegosouzapw#13868 # Conflicts: # open-sse/executors/base.ts
|
thanks for the detailed read, all three are addressed and pushed at 1. test for the branch. added
2. the gemini regression. good catch. the branch now guards on 3. prettier. base drift. merged the product call. you are right that it is a product choice, and my read is that a working answer without thinking beats a raw 400 the client cannot act on. that said, i do not want to decide it for you. happy to gate it behind a per-provider setting (something like |
…has no field to strip Add regression coverage for the 400-recovery retry chain.
… prettier Reuses a single non-mutating field-presence check for the retry/fallthrough decision instead of duplicating the filter, and formats the touched files.
5dd0ad7 to
ff85f88
Compare
|
Re-homed to |
A request that carries a thinking block dies with a 400 when the upstream rejects thinking by
naming the model instead of the offending field.
Ollama does this for Instruct-only models. Qwen3-Coder-30B-A3B-Instruct has no thinking mode,
and a
/v1/messagesrequest withthinkingcomes back as:base.tsalready has a 400-recovery chain, but neither detector can see anything to strip here.findOffendingFieldneeds a literal field name fromKNOWN_OFFENDING_FIELDS, anddetectUnsupportedParamneeds the phraseUnsupported parameter. This body has neither, so theerror goes straight back to the client. Every Claude Code request against a self-hosted
non-thinking model fails.
what changed
providerFieldStrips.tsisUnsupportedThinkingError()plusREASONING_REQUEST_FIELDSbase.tsThe branch drops whichever reasoning field the body actually carries rather than assuming one,
since an OpenAI-compatible target can arrive with
reasoning_effort,reasoning,thinkingorthinkdepending on the translation path.strippedFieldsalready guards against a retry loop,so each field is dropped at most once per request.
how to test
All pass. Prettier and ESLint are clean on the changed lines.
limitations, please read
This is unit-tested, not verified against a live model. The regex is built from a real 400
captured from Ollama 0.34.0, but the Ollama instance was taken down before the patch was
written, so the retry path has not been exercised end to end. Someone with a non-thinking model
loaded should confirm the retry actually succeeds rather than merely firing.
base.tshas 6 pre-existing@typescript-eslint/no-unused-varserrors on lines 36, 50, 51 and522-523. They are untouched and present on
release/v3.8.51, left alone to keep this diff tothe fix.