4794de398ea8337d223a91e207181c56fcf4ad76
3
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
eba7187368 |
gateway, provider, cli, gui: a group can route By weight, each member's share set beside it (#1910, DD on Discord)
DD asked for weighted round robin as a group routing, next to In turn.
A provider's keys could already route by weight (#841). Groups could not.
What changes:
- provider: Group.Weights maps a member's spelling to its weight, 1 to
1000. A member left out, or set to 0, weighs 1. SaveGroup accepts
routing "weight". It also cleans weights the way it cleans fast and
off: it strips :fast, drops weights of members that are gone and of
members weighing 1, and refuses a weight below 0 or above 1000.
Weights follow a member when it is renamed (RenameMember, Rename,
RenameGroup) and survive Share/Import.
- gateway: planLevel treats each member of a weight-routed group as one
unit: a model with its keys in its provider's order, or a nested group
routed its own way. weightedUnits orders the units by smooth WRR on a
round per group ("group/<id>"), sharing wrrPick with the keys. The
round's pick goes first and the rest stay in member order for
failover. A unit whose head is resting leaves the round. When a
conversation is kept on another member (session/turn/cache/strict),
the charge moves to that member (wrrSeat, wrrMove).
- cli: routing=weight (also weighted, wrr). weight=<model>=<n>[,...]
sets weights and keeps the rest; weight= on its own clears them. The
group view shows "· weight N" for each member.
- tui: By weight is in the group routing list.
- gui: the group editor offers By weight. Each member then shows
"Weight N · S%", its share among the members that are on. Clicking it
edits the number in place: Enter or blur keeps it, Escape cancels,
and a value outside 1 to 1000 shows a warning. The trace header uses
group wording for a weight-routed group. Strings are added in zh,
zh-TW, ja and de.
- docs: reference.md, gateway-routing.md, and site start pages in en,
zh and ja.
Run:
- go test -tags nogui ./internal/provider ./internal/cli ./internal/tui:
ok.
- ./internal/gateway: ok in 988s with -timeout 45m. The first run hit
the default 10m timeout at load average ~170. The test running at
that moment had been running for 2s; it was not a hang.
- go vet -tags nogui on those packages, for darwin, GOOS=linux and
GOOS=windows: clean. gofmt -l: clean.
- New group-member-weight.test.cjs: 8/8 in Chromium and WebKit, en and
zh at 1100, en and de at 420. The WebKit de 420 case also passed six
runs at once.
- gui-zh-tw, gui-ja, gui-de, i18n-keys, routing-*, group-*,
panel-routing*, settings-groups and agent-model-groups: all green
except two.
- routing-steady (WebKit) is #1804. It is red 2/3 alone on origin/main
|
||
|
|
908c910931 |
gateway, gui: Stays: Strict keeps a conversation on the account or key that answered it, even past its cap, and passes its error on rather than moving it (#1797)
miniers asked that a conversation never move to another account: a
move changes the account a vendor sees mid-conversation and loses its
prompt cache. Session affinity keeps the account while it can answer,
then moves on.
The new affinity mode "strict" (Stays: Strict) does what session does
for a new conversation. Once one has an account, strictKeep asks that
account alone (its other models too) and no other account, key or
provider:
- one resting or spent is still asked, and its error (429, 402, 5xx)
goes to the agent rather than to the next candidate;
- one over a user cap is asked past it (plan's capped candidates,
capHeldOnly);
- one held for credits answers 429 naming Stays: Strict rather than
moving;
- one removed, turned off, barred or not allowed for the key counts as
gone, and the conversation is routed as usual.
A last try that fails verification is not rested for a strict
conversation that had nowhere else to go.
Set in the provider editor and the Routing page's pool row (GUI, all
five languages), `magpie groups ... stays=strict` (strict-session,
never-move), and the TUI ("stays strictly"). Documented in
gateway-routing.md, reference.md and the site's start pages (en, zh,
ja).
Run:
- go test -tags nogui ./internal/gateway (-timeout 30m under load ~150),
./internal/provider ./internal/tui ./internal/cli: ok. The three
TestStrictAffinity* tests fail on the code before this commit (200
where 429 was expected, acct-2 answering).
- GUI: stays-strict.test.cjs, chromium and webkit, 900 and 560px, en,
zh, zh-TW, ja, de: 30 of 30. On the assets before this commit it
fails 15 of 15 in chromium. routing-*.test.cjs pass but for
routing-steady's webkit 1.69px shift, which fails on the old assets
too: filed as #1804.
- gofmt -l, go vet (darwin, linux, windows), full go test ./... before
the push.
Not tried: a real agent conversation held on a real rate-limited
account.
Known and left: planLevel doesn't merge a nested group's sub.held, as
before this commit.
|
||
|
|
23e764d0e0 |
cli: magpie's commands move from the root into internal/cli; the root keeps only main.go
The root held 89 .go files (30 commands, 59 tests). They move as they are to internal/cli (package cli), with git mv so history follows them. The only code change is main() becoming cli.Main(version): the root's new main.go keeps `var version` in package main, so -ldflags "-X main.version=…" in the Makefile, the Dockerfile and magpie-releases, and every workflow, work unchanged. go-winres's rsrc_windows_*.syso still land next to package main in the root. Tests that read testdata by a root-relative path now go up one level (../plugin/testdata/fake, ../sessions/testdata). Five subsystem doc links point at internal/cli/. Run: - go build ./..., gofmt -l, go vet on darwin, linux and windows (nogui) - builds with tags production, dev, "production nogui"; windows -H windowsgui; linux CGO_ENABLED=0 - make release-cli TARGETS="darwin/arm64 linux/amd64 windows/amd64 android/arm64" VERSION=9.9.9-tidy: all four built, binary prints "magpie 9.9.9-tidy" - docker build --build-arg VERSION=7.7.7-tidy: container prints "magpie 7.7.7-tidy" - go test ./internal/cli (default and nogui): 152 tests, the same count as the root on main - go test ./...: all packages pass (agent, gateway, library, provider timed out at 10m under other sessions' load and passed rerun alone with -timeout 40m; none of them changed) - the built binary in a sandbox HOME: version, help, ls, providers, claude, and an unknown command's error |