A group reached through a parent group runs its own classifier when it is
effort=auto, even after the parent's classifier already picked the turn's
reasoning: the request goes out at the parent's pick (the outermost pick
stands, gateway.go), so the group in it pays for an answer the turn throws
away. On one reporter's day the group in it answered 27 of 28 such turns,
2-8 s each, and 14 of the 28 parent picks discarded the answer.
ruleFor now takes the pick a group above it already made: with one standing,
the classifier is not asked for the effort again. The intents, when the
group's rules have them, are still asked — they are the group's own routing.
The trace says why nothing was asked. The fallback keeps working: the group
in it is asked as before whenever the group above gave no pick.
Generated-by: GLM-5.3-Flash (ZCode)
What changed: Classified keeps the classifier's answer as it said it
(said): the number a chat model answered with, 0 for none, or the choice
a decision model named, "none of these" included. readIntent gives the
number back, readJev keeps the choice, and the trace's rule.classified
carries the said on. An answer that named no rule's intent — a chat
classifier's 0, a decision model's own none-of-the-kinds option, a kind
named under the sure-enough bar — all read "said none" in the trace
before, so a group's fallback kind ("not any of the above") that never
matched looked the same as an answer no rule could take.
The matching itself is as it was: a classifier that answers the
fallback kind's number still routes by that rule, which a test now
holds (it passes unchanged); the said is only what the trace tells.
Run: go test -tags nogui ./internal/gateway (pass; without the change
TestClassifiedSaysTheClassifiersAnswer fails "the classifier said 0,
the trace says \"\"" and TestClassifiedSaysWhatJevChose fails "Jev
chose \"none of these\", the trace says \"\""); gofmt -l prints
nothing; go vet and GOOS=linux/windows go vet on the package pass;
go build on darwin, linux (-tags nogui) and windows pass.
Generated-by: GLM-5.3-Flash (ZCode)
"classifier的模型调用可以加上不带思考的参数么?提速效果比较好". A routing
group's classifier (and its effort question) asked its model for the
least level on its list, and nothing at all when the list was unknown,
so a relay's reasoning model thought at its vendor's default before
answering a number.
Now classifyEffort asks for none, reasoning off, and each wire fits it
with the code that already fits a client's none:
- Chat/Responses: a model with none gets none; one without gets its
lowest (fitFor: low, minimal), as before; one whose levels aren't
known gets none (as auto mode's classifier does, fitAutoModeClassifier).
- Anthropic: thinking {"type":"disabled"}; Opus 5.5, which refuses it,
still has it left out (thinkingOffAsTaken).
- Gemini API / Code Assist 2.5: thinkingConfig.thinkingBudget is the
off budget (0 for Flash and Flash-Lite, 128 for Pro, as Vertex already
did) where a Chat none went as low's 4096. Gemini 3 is unchanged (low).
- A model the user marked as taking no reasoning ask (Reasonless) is
sent none at all; a routing group as classifier is left as before.
- An upstream that turns the effort away (unknown reasoning_effort
field, or the level) is asked again without it and remembered
(askLeast), so the classifier keeps answering.
The Image recognition model keeps its old least-level rule
(leastEffort); only the classifier changed.
Run (mote-run, this tree on origin/main 90518de26, rebased onto
d83823d26, which touches internal/agent only):
- go test ./internal/gateway -run 'TestClassifierAsksThinkingOff|
TestClassifierThinkingAsEachVendorTakes|TestVisionEffortUnchangedByClassifier|
TestIntent|Classif|TestAdaptiveOnly|Vertex|Gemini|Think|Decide|Effort': ok
- go test ./internal/gateway -run 'CodeAssist|Codeassist|Antigravity|
GeminiCLI|Gemini|AIStudio|Auto|Rule|Group|Vision|Search|Reason|Off': ok
- go vet ./internal/gateway on darwin, linux, windows; gofmt -l clean.
Broken by hand: classifyEffort back to the least level and the 2.5
off budget turned off: TestClassifierAsksThinkingOff (anthropic, gemini
2.5 flash, unknown chat), TestIntentClassifierEffort and the 2.5 Pro case
go red. Before askLeast, the "effort turned away" case was red (the
classifier failed on a relay refusing reasoning_effort).
Not tried: a real vendor account; the whole internal/gateway package
and full suite (running after the push). On Anthropic, the old body for
claude-sonnet-4-5 had no thinking at max_tokens 2048, so that model
wasn't thinking before either; the change there is the explicit
disabled.
A routing group's intent classifier (askChat) and System One (askJev)
were each given a fixed 8s. A slow subscription classifier can now be
given longer in Settings > Models > Replies > Intent classifier timeout.
settings.json's classifyTimeout takes 1..60 seconds; 0 or missing keeps
8s. save() refuses below 0 or above 60, and ClassifyWait clamps a value
edited by hand (below 1 gives 8s, above 60 gives 60s). A settings file
that can't be read gives Shared()'s defaults, so 8s, never no timeout.
Both askChat and askJev read it per call. The GUI row is the app's own
segmented control (8, 15, 30, 60, plus a value set by hand), and other
saves carry the value on (prefsKeep, api.go). zh, zh-TW, ja and de
strings; the routing reference and the en, zh, ja docs say it.
Ported from reyoung's classify-timeout-2934 (author kept). On top:
- askJev's defer reworded any error once ctx had expired, so a refusal
(decideRefused) or an answerError read as the wait ran out lost the
type askDecideTries rests an account by. Now only errNoAnswer, which
systemOne returns when postDecide failed with ctx done, is reworded
to "<provider> gave no answer in <wait>".
- ja intent.html: a stray space in "遅いモデルだと 設定した".
- app.js: the Image generation timeout row and the new row share
waitRow (~350 bytes less). TestCoreScriptBudget was red (app.js
1,337,982 > 1,337,000); budgets raised to the exact sizes, app.js
1,337,633 and core 1,529,393, no room added.
Run (macOS, Go env pinned, sandbox HOME):
- Full go test -tags nogui -timeout 45m ./... at 766cf1cf9: 68 packages
ok; internal/gui red on TestCoreScriptBudget only, fixed above.
- At ed008ca9f and again after rebasing on 65e80405b: internal/gateway,
internal/settings, internal/gui ok; gofmt -l clean; go vet (darwin),
GOOS=linux go vet -tags nogui, GOOS=windows go vet all ok.
- Whole GUI suite at ed008ca9f, chromium and webkit, 4 wide at load
~30: 11,930 tests, 52 red, none in the files this change reaches
(classify-timeout-setting, image-timeout, i18n-keys all pass). The
red files rerun alone: 44 red in 10 files, the same 44 on origin/main
65e80405b. All have issues (#2228, #2399, #2150, #2448, #2276, #3091,
#2549, #2163, #3099, #3104) except library-mcp-health-wsl's ja case,
filed as #3350.
Broken by hand, each red then restored:
- classifyTimeout fixed at 8: TestClassifierTimeoutSetting and
TestJevGivenTheClassifierTimeout red.
- askJev fixed at 8: TestJevGivenTheClassifierTimeout red.
- save()'s bound removed: TestClassifyTimeoutKeptAndBounded (-1
accepted) and TestSettingsClassifyTimeout (61 gives 200) red.
- ClassifyWait's clamp removed: red (600 waits 10m0s).
- api.go's keep removed: TestSettingsClassifyTimeout red.
- prefsKeep's classifyTimeout removed: the GUI test's "sent on with
other saves" red in chromium and webkit.
Not tried: a real slow classifier or account; Linux and Windows at
run time; the native Linux desktop build; a test that pins the askJev
refusal-at-deadline race (it is timing-only, so no deterministic red
was written for it).
A follow-up like "继续", "yes" or "fix that" was classified alone, so it routed
as a trivial turn. The decision classifier (Jev's state and the chat-model
classifier's prompt) now also gets previous_user_message and
previous_assistant_reply, when present.
- Taken from the same parsed request as the classified message, after the
gateway masks it, so the new fields are masked the same way. The answer
cache key includes them.
- The reply is the text of the latest assistant message after the previous
user message. Never thinking, tool calls, tool results or system prompts;
a tool-only reply gives nothing.
- Caps: the message keeps 3000+1000. The previous user message is cut to
its first 750 and last 250; the reply keeps its last 1000. Together at
most half the message's cap.
- The intent, level and effort instructions name the keys only when they
are present, as context, not the thing being judged.
Tests: TestTurnBeforeEachProtocol, TestTurnBeforeCuts,
TestJevIsToldWhatCameBefore, TestChatClassifierIsToldWhatCameBefore,
TestClassifyKeepsAnAnswerPerTurnBefore, TestJevSeesTheTurnBefore. Each was
broken by hand and went red (10 breaks: reply taking thinking or tool
arguments or a tool result, searched past the user message, no caps,
jevState dropping the keys, priorAsk naming both always, writePrior not
called, rules.go not setting prev, a cache key without the turn before,
privacy off in the end-to-end test).
Run at 85eef5d87 + this: gofmt -l clean; go vet ./..., GOOS=windows go vet
./..., GOOS=linux go vet -tags nogui ./... ok; go test -p 3 -tags nogui
-timeout 45m ./... 65 packages ok; internal/agent timed out at 45m under
load ~350 (origin/main alone: 2305s), alone with -timeout 90m ok, 936s
(#2544). Rebased on 89521b03d; full suite at bf2018807 (89521b03d + both commits): go test -p 3 -tags nogui -timeout 45m ./... under a sandbox HOME: 65 packages ok, gateway among them; internal/agent hit the 45m timeout (#2544, as on main under load ~330). gofmt -l clean; go vet -tags nogui, GOOS=windows go vet of internal/gateway ok.
When every group member skips redaction, unredactedRoute handed Jev the
unmasked body, now with the turn before as well; the next commit masks
what Jev is told.
kensenzhao saw a subscription's allowance spent by requests the agent
didn't make: a routing group's classifier, set to a subscription's model,
asks it as every turn begins, and those calls looked like the agent's own.
What changed
- usage.Group has an own share (calls, tokens, cost) of the calls magpie
made by itself, filled for models, keys and accounts. Record.ByMagpie
is the test: agent "magpie", or one of its own User-Agents
(magpie-router/1, magpie-search/1, magpie-vision/1) where the agents
aren't loaded. The calls still count in the group's totals, as they
went to the same key or account. A group with none sends no "own".
- The classifier's calls are Kind "routing": callKind marks RouterAgent's
requests, and the decision model's record (Jev / System One) is written
with it. A "Routing classifier" purpose names them in the ledger.
- Usage page: magpie's row among the agents and its ledger rows carry a
"magpie's own" mark; an account's, key's or model's row adds "{n} by
magpie itself"; an account's card says how many of the period's
requests were magpie's own, drawn again once the summary arrives after
the allowances.
- Routing page: /api/groups marks a model a subscription account serves
(modelRef.Sub, servedRef). Beside a classifier on such a model, or a
group whose first member is one, the editor says every turn starts
with a request to that subscription, two when it picks both intent and
effort in words. A classifier on a key or a free model says nothing.
- New strings in zh, zh-TW, ja and de. The mark is a muted chip with an
even border all round (no left stripe).
Tests
- TestSummaryCountsMagpiesOwnCallsApart, TestByMagpie (usage).
- TestIntentRoutesATurn and TestJevPicksTheIntent (gateway) now check
the classifier's records are Kind routing and magpie's own, and the
agent's records are not.
- TestServedRefSaysASubscription (gui).
- own-requests.test.cjs: Chromium and WebKit, 1100 and 390 wide,
en/zh/zh-TW/ja/de, the API faked; no click scroll, no sideways page.
- Broken by hand, each turned its test red: addOwn counting nothing;
callKind's routing case removed; decide.go's Kind blanked; the ledger
mark, the agents' mark, the "{n} by magpie itself" line, the card's
line, its redraw after the summary, the Routing hint, its group case
and modelRef.Sub each removed.
Run: gofmt -l; go vet on darwin, linux -tags nogui and windows; go test
for usage, access, catalog, gui (-tags nogui) and gateway in full; the
GUI tests above, the ledger, routing-intent and translation tests.
Not done: the warmups (warmClaude/askClaude) write no usage record at
all, so they can't be marked; that is left as it was. Not tried with a
real subscription classifier against a live account.
What: in ruleFor, when the classifier errs (an error, no answer within
classifyTimeout, an answer that isn't a number, or resting classifyRest
after a failure) and the conversation's turn before had an intent that
is still one of this turn's (Classified.After), the turn keeps it:
Classified.Intent is that intent, the new Classified.Fallback
(json "fallback") is "previous", and Error is kept. With no intent
before, nothing changes: no rule with an intent matches. The Routing
page's classWhy says "… but couldn't — {err} — so the turn keeps
“{intent}”, as turn {prev} was.", in zh, zh-TW, ja and de too.
Why: #1826 section 3: two timeouts in a row (20:54:43, 20:55:20) sent
turns of a known 复杂 conversation to the group's cheap first member.
Not done: persisting turnRules beside the sticks (the issue's idea 3).
After a restart a turn under way still waits for the next turn, with the
stick holding it meanwhile; with the previous commit the stick's key no
longer changes mid-conversation, which was how the reporter lost both.
Run: TestIntentClassifierFailsKeepsThePreviousIntent (down, then resting,
then a conversation with nothing to keep) fails with the fallback line
taken out and passes now; routing-intent-fallback.test.cjs (Chromium and
WebKit, en/zh/zh-TW/ja/de, 1100px and 390px with no sideways scroll)
30/30, and 10 of 15 red on Chromium with the old routing.js;
routing-intent-entry, routing-effort, panel-routing, routing-folder,
i18n-keys and gui-de pass; go test ./internal/gateway -count=1 green
(295s); go test -tags nogui ./internal/gui green; gofmt -l clean; go vet
on darwin (gateway), GOOS=linux -tags nogui ./... and GOOS=windows ./...
clean.
Not tried: a real classifier timing out in a live session.