Commit Graph
1 Commits
Author SHA1 Message Date
yetone 7cc393bcc1 gateway: a relay reading thinking off as effort none, refused naming its levels, is asked with thinking left to the model (#1465)
MengXiangxi's Claude Code auto mode on a Sub2API's gpt-6.1-sol blocked
every action: "Sub2API: gpt-6.1-sol does not support reasoning effort
"none"; use low, medium, high, xhigh or max" (400).

Cause: Claude Code's classifier (and every side query magpie turns
thinking off for, thinkingOffUnlessAsked) goes to Sub2API's Messages API
as it was sent, with thinking {type: disabled}. Sub2API's
anthropicReasoningEffort reads disabled as effort "none", and
ValidateGPT61SolReasoningEffort turns none away for gpt-6.1-sol
(Wei-Shaw/sub2api, backend/internal/pkg/openai/constants.go). magpie's
Anthropic retry for a refused thinking-off knew only the alwaysThinks,
mandatoryReasoning and thinkingOffRefused wordings, so this 400 went to
Claude Code. The refusal is about the model on that relay, not the
account: the same request with thinking left out is taken.

Change:
- refusesThinkingOff (anthropic.go) is the one list of thinking-off
  refusals, now also one turning a quoted "none" away while naming the
  levels taken (effortLevelsNamed && noneQuoted). Both routes use it: a
  relayed Messages request (passthrough) and a request translated to an
  Anthropic endpoint (forwardTranslated, thinkingBackOn).
- The relayed route now remembers the refusal (markUnfit(offRefused),
  the mark the translated route and passthrough effort fitting already
  read) and sends that model's later requests with thinking left to the
  model at once, so the classifier, which asks on every action, doesn't
  pay a 400 round trip each time.
- Chat/Responses routes already retried this wording through
  effortLevelsNamed (reasoning_effort none -> lowest level); unchanged.
- docs/subsystems/gateway-routing.md says so.

Tests: TestSub2APIThinkingOffRefused (the reporter's literal message;
the classifier relayed is refused once, asked again, then sent without
thinking at once, title asks included; a 400 for another level stays the
agent's), TestRefusesThinkingOff, and the Sub2API wording added to
TestTranslatedThinkingOffRefused. Broke the fix by hand twice (the new
clause off; the remembered send off) and watched each go red.

Run: gofmt -l internal/ (clean); go vet ./internal/gateway on darwin,
GOOS=linux -tags nogui, GOOS=windows; go test -tags nogui
./internal/gateway -count=1 -timeout 40m: ok in 669s (load ~40 from
other sessions; an earlier run hit the default 10m timeout under that
load). Not tried against a real Sub2API.
2026-10-13 10:06:12 +08:00