wherever a ref is read back from an agent's settings
An agent on a routing group is shown, on the Providers page, on each of
that group's providers — the row's middle holds one button per agent, and
`uses` is what the Routing page's "n agents routed through it" counts.
A group whose model has a 1M window is written into Claude Code's
settings with the mark Claude Code itself puts on it
(`group/auto-deepseek-v4-1-flash[1m]`), and GroupFor takes the mark off
for the gateway; the rest did not. So the group was not found, and an
agent Claude Code had on it was listed on none of the group's providers,
while every request it made went through them.
Four places read such a ref back:
- provider.GroupFinder, which the Providers page asks (agentUses)
- agent.sameModel, which moves an agent whose group is gone to the same
model from a provider still serving it — the mark left on made the
comparison against AutoGroupOf find nothing, and the agent stayed on a
group nobody serves
- agent.groupNamed, which says whether two values of a field reach the
same group, one of them read back from the agent's own settings
- the CLI's groupUses, which lists "← agent" beside a group: the marked
id was filed under one no group has, and Claude Code was on no row
Each takes the mark off, as GroupFor does. A group's own members are not
touched: those are the group's structure, never a ref from an agent's
settings, and a [1m] there is a model's, not the group's.
group_uses_test covers the page (a group found with and without the mark,
and the row naming the agent on the group's provider); applied_test covers
groupNamed; reseat_test covers the move (the marked group ref finds the
same model elsewhere, and a group that is nobody else's still gives
nothing); groups_cli_test covers the CLI, with Claude Code's settings.json
as the reporter's reads. Each fails without its fix. go build, go vet
pass; go test ./internal/agent/ passes, and the failures that remain are
the ones a clean origin/main has too (Aside's symlinks, ~/.codex
dependence, VSCode's launchers, a flaky Zed case).
Co-authored-by: wizzy-yang <wizzy-yang@users.noreply.github.com>
* routing: Least used puts first the account with the most of its week left per hour until it renews — it ranked by the share used alone, so with two subscriptions, one 80% through its week and renewing in an hour, the other fresh and renewing in five days, every new conversation went to the fresh one and the first's remaining 20% was lost at its reset. Allowance.Pace: over the windows that count the model and run a day or longer (the five hours are a rate cap, not a budget; Kiro's month counts), (100 − used) / hours to reset — a week not started or not known runs its whole span from now, one whose reset has passed is full again, of several (Opus's own beside the general) the tightest; an account whose vendor tells the five hours alone (Claude's own usage command) counts as a week not started with their share used, so those go by what they have used, as they did. weigh's LeastUsed case: one at 98% or more last whatever its week, by how far; then pace, highest first, in bands alike within a tenth drawn from the top before sorting (a pairwise tenth isn't an order: three paces a twelfth apart go round in a circle); within a band the tokens sent lately, then their order, for the cache; an account not known counts as a fresh week (before, "used 0" put it first), a key follows the subscriptions. Renewing the same hour, pace is most-left-first, as before. Smart untouched. The trace carries pace; the Routing tab's story, the provider and group editors' hints and the docs' routing table (en, zh) say what the option goes by now. TestAllowancePace, TestLeastUsedPace (fails on the old weigh: "imminent renewal first: ab"). go vet ./internal/..., go build -tags nogui (darwin, GOOS=linux), GOOS=windows go build, go test -tags nogui ./internal/provider/ ./internal/gui/ pass; ./internal/gateway/ passes but TestPluginModelListThroughAccountProxy, which fails on main too (a concurrent Body.Read panic in its fixture).
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
* routing: weekly pace is its own option, "pace"; Least used keeps its meaning (yetone, #517 review) — a user who had picked Least used was being switched to another strategy under the same name. Weekly pace: the account with the most of its week left per hour until it renews goes first, the one with the most to lose at its reset; Least used is most-left-first again, Smart untouched; the CLI takes routing=pace (weekly-pace), the TUI cycles to it, the group and provider editors, the Routing tab, README and the docs' routing tables (en, zh) list it. Review points: the tiers are Smart's — one at 90% or more of any window that counts the model, the five hours too, waits behind the healthy ones, by share, one all but used up behind those (an account 95% through its five hours with a healthy week ranked ahead of a fresh one until 98%, and the allowance is read about once a minute, so it was sent into 429s); among the healthy, one not known that tells what it has left as it answers (a Claude account) goes first while it isn't known, as in Smart, else it would never answer and never be known; a window that says no span (a plugin may not) is a budget for as long as its reset says, else a week, where it fell among the five hours and made the week not started; the hours until a reset are never fewer than one, or a window thirty seconds from renewing paced at 6000; the trace carries due, the reset of the window the pace went by, and the Routing tab's story says the week's share left over the hours until that, not the first reset it finds; Routing's comment in provider.go and README's routing= line name the option. The bands of pace alike are drawn among the healthy known accounts alone: one running low would otherwise set a band's top and part two alike behind it. TestWeeklyPace (the tiers and their 90% edge, the probe and its end, the bands drawn without the low, keys by tokens and after subscriptions, the trace's pace and due, Least used unchanged), TestAllowancePace (due, the span-less budget at 48 h and at 90 min, a day the shortest budget, the hour floor, normalize keeps pace). go vet ./internal/... ., go build -tags nogui (darwin, GOOS=linux), GOOS=windows go build, go test -tags nogui ./internal/provider/ ./internal/gui/ ./internal/tui/ . pass, the two new tests 25 times over; ./internal/gateway/ passes but TestPluginModelListThroughAccountProxy, which fails on main too.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
---------
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>