3 Commits
Author SHA1 Message Date
kevin 6d5893d400 fix(rules): reject nan/inf and overflowing token lengths (#877)
* fix(rules): reject nan/inf and overflowing token lengths

ParseTokens used ParseFloat and cast straight to int. Values like
"nan", "inf" and "1e20" therefore became a huge negative (or other
nonsensical) token threshold instead of an error.

* fix(rules): reject tokens at the float64 MaxInt boundary

float64(MaxInt) rounds to 2^63, so n > float64(MaxInt) let the
boundary through and int(2^63) becomes MinInt on amd64.
2026-10-05 16:31:07 +08:00
yetone bc720c8d87 group: a rule can be for a kind of message — intent="writing or fixing tests": as a user's turn begins, the group's classifier (any model magpie has, best a small fast one) is asked once which of the intents that may match the message is, and the turn stays with the answer through its tool rounds; it isn't asked when no intent rule could decide, the same message isn't asked about twice, and when it fails or is slow (8s) no intent matches and it rests 30s. The trace says what it was asked and said; Routing's rule editor has "asks for" and the classifier picker, and magpie group rule add … intent=… classifier=… / magpie group rule classifier from the terminal. A sub-millisecond reply no longer shows as NaN s in the trace 2026-09-26 11:09:13 +08:00
yetone 696c8e70e7 group: rules send a kind of turn to a chosen model — a group's Rules (Routing view, or magpie group rule add|rm|mv) put one of its models first for a turn that is long (tokens ≥ N), carries an image, asks for reasoning (on or at least a level) or comes from certain agents; the first that matches decides as the turn begins and the turn stays there through its tool rounds, moving only if it outgrows its model's context, the others staying behind it for failover; a subagent keeps a place of its own so a rule can send it elsewhere while its agent stays; the trace says which rule sent a turn where. Turn affinity also now sees past the system message Claude Code puts after tool results, which made each of its tool rounds look like a new turn 2026-09-26 03:53:33 +08:00