Commit Graph
3 Commits
Author SHA1 Message Date
yetone f6ed2c99bc effort: a vendor's light and extra_high are low and xhigh, in dsh, Pi and the gateway
nianshou5 (Discord) runs Trae's DeepSeek V4.1 Flash through the Our Free
Model plugin (github:mu-zi-lee/magpie-our-free-model). Its variants are
Trae's own names, light, high and extra_high, and dsh offered only
default and high: dshModelLevels (and Pi's piThinkingLevels) matched a
model's efforts to pi-ai's level names only, so light and extra_high
were dropped. The gateway dropped them too: effortOf read "light" as no
effort, and NearestEffort fitted an agent's low or xhigh to the plugin's
high.

catalog.EffortAliases names light as low and extra_high as xhigh
(EffortLevel). NearestEffort places a model's levels by the level they
name and returns the model's own word; the gateway's effortOf reads an
alias as its level. dsh's reasoningEfforts and Pi's thinkingLevelMap map
dsh's low/xhigh to the model's own word (modelEffort), which llm-pi-ai
sends on the wire as written (resolveModelReasoning in dsh-llm-pi-ai
reads each value as "the spelling dispatch sends"). Levels a user kept
are untouched: only the names a model lists are mapped.

Tests: TestDshOffersTraeNamedLevels (agent), TestNearestEffortTakesVendorWords
(catalog), TestPluginThinkingOff's new fake-trae subtests (gateway, a
real plugin host with the fake plugin listing light/high/extra_high).
Broken by hand: modelEffort without the alias, dsh levels [high] (the
report's picker); NearestEffort without EffortLevel, low/xhigh sent as
high; effortOf without the alias, light/extra_high sent as nothing.

Run on mote at this tree (base e4ccf67b1): go build, GOOS=linux and
GOOS=windows go vet -tags nogui ./... ok; go test -tags nogui -timeout 45m
./... : 73 packages ok, three red that are red the same on origin/main
7f32f0ec9 run alone: internal/agent TestWSLColdPlaceOpensNothing (#3924),
internal/tui TestTUIFetchesSubscriptionModels (#3919), internal/provider
synctest crash in TestUnreadLoginsWriteErrorsKeepCredentials (#3632), so
the rest of internal/provider didn't run. No GUI file changed.
Rebased on 7f32f0ec9 (one agent file changed there): go build ./...,
internal/catalog whole and gateway/agent -run Effort|Dsh|Pi|ThinkingOff|Level
ok at this head.

Not tried: a real dsh session against the user's plugin (no Our Free
Model account here); dsh's parsing of a non-pi-ai wire value was read
from its source, not run.
2026-10-28 04:34:45 +08:00
yetone 56418ac5cb gateway: a client's reasoning effort "off" is magpie's none (plugins#334)
A raw reasoning_effort "off" to the gateway wasn't read as off: no check
knew the word, so a Command Code DeepSeek (plugin 0.1.15) was asked with
no off level and still thought, while "none" turned thinking off
(CHENJIAMIAN on plugins#334).

serve now reads a Chat or Responses body's effort spelled "off"
(reasoning_effort, or reasoning.effort; any case, spaces trimmed) as
"none" before anything else reads the body (offAsNone), so every route,
retry and check downstream (bodyEffort, agentEffort, ThinkOff, the IR's
effortOf, fitEffort) sees magpie's own none. A model asked "<model>:off"
is asked as "<model>:none" (askedAt). What goes upstream is then what
"none" gives today: a model with an off level gets its provider's own
spelling of it (the Command Code plugin's "off"), and one without one
goes at its least level (fitEffort). A literal "off" is never forwarded.
saysOff scans for the word without parsing, so only a body naming it is
decoded; the rest of the body (numbers included) is kept as it came.
Anthropic's output_config.effort and Gemini's thinking level are left
alone: neither API has an "off" level. docs/subsystems/gateway-routing.md
says so.

Run at 85534cd07 (origin/main fetched) plus this change; the package run
below was at 68fb6b6d8 plus this change, rebased onto 85534cd07 with no
conflict (the four commits in between touch agent, sessions, provider's
partners, README and site only):
- gofmt -l internal/gateway: clean.
- go vet ./internal/gateway ./internal/provider (darwin), GOOS=linux
  -tags nogui, GOOS=windows: ok (at 85534cd07+this). go build ./... for
  darwin, linux -tags nogui, windows: ok.
- go test -tags nogui -timeout 45m ./internal/gateway/...
  ./internal/provider/... ./internal/catalog/...: ok (gateway 366s,
  provider 93s, catalog 5s). Not the full ./... suite: another session's
  go test -race -count=20 on internal/gateway and a go test on
  internal/agent and internal/sessions were running on the machine.
- After the rebase: TestPluginThinkingOff, TestOffAsNone, TestAskedAtOff
  and TestLoop* (which reads gateway-routing.md): ok.

Broken by hand: with the offAsNone call in serve and askedAt's :off
branch taken out, TestPluginThinkingOff's chat off, chat OFF spaced,
responses off and suffix off rows fail ("reasoning_effort sent [<nil>],
want none") and "no off, off" fails (sent [<nil>], want low);
TestAskedAtOff fails (askedAt("group/g:off") = "group/g:off", "").
The "chat low" and "chat none" rows pass either way.

Not tried: no real Command Code account; the plugin's off behaviour rests
on the reporter's measurements. The Codex backend path's direct relay to
ChatGPT (Codex's own models, not through serve) is unchanged; Codex never
sends "off".
2026-10-23 16:30:58 +08:00
yetone 9e13f18fb9 gateway, provider: a request turning reasoning off stops Factory's DeepSeek V4.1 Flash, Kimi K3 and GLM-5.2 thinking (#899, tedestar) — they offered only low/high/max (GLM-5.2 high/max), so an agent's none (or Claude Code's thinking disabled) was asked for low, or nothing, and Fireworks thought anyway. droid 0.231.0 lists off for them and sends reasoning_effort "none"; through OpenRouter pinned to Fireworks, none came back with 0 reasoning tokens on DeepSeek V4.1 Flash (2 completion tokens; 19 at the default, 16 reasoning at low) and Kimi K3 (8; 71 at the default), and on Baseten's GLM-5.2 (2; 114 at the default), while GLM-5.3 and GLM-5.3-Flash turn none away ("Reasoning is mandatory for this endpoint and cannot be disabled") and stay at low, their least (Qwen3.8 Max and MiniMax have no off in droid either). The three now have none among their levels, in the built-in and in @magpie-community/opencode-factory-auth 0.1.17, which the mover's min is raised to; and a translated request that turned reasoning off (Effort reads it as low) is asked for none on a model with none among its levels, whatever the provider, else as before (a refusal still falls back to the lowest level on). No Factory account was at hand to send through Factory itself. TestFactoryThinkingOff (the built-in: chat, Responses and Anthropic's disabled; GLM-5.3 still low) and TestPluginThinkingOff (the plugin host, a model whose variants have none and one without) are new and fail without the change. go vet, go build (darwin, GOOS=linux nogui, GOOS=windows) and go test -tags nogui ./... under a temp HOME pass (TestSavedButSignedOutClaudeServed timed out once under load and passes alone). 2026-10-05 20:09:00 +08:00