duanckham has a personal and a company GPT account, one tool and one
gateway, and wants a group's GPT models to spend only the company
account (or only his own). A second gateway key doesn't fit: his tool
talks to one gateway, and a local agent needs no key at all.
Group.Accounts holds a group to some accounts or keys of the providers
it names, in a gateway key's form and by the key's rule (#905,
Identity.AllowsAccount). The asked group narrows the request's
identity (access.Identity.HeldToGroup: the strict intersection with
the key's own list; "<provider>/\x00" when they share none), so every
gate a key's accounts go through holds the group's too: chat,
responses, messages, count_tokens, embeddings, images and video,
streamed or not. A group reached inside another, as a member or a
fallback, is held in planLevel (hold, Member.Via): its candidates on
an excluded account are Held rows with Weighed.HeldBy, which the
Routing trace tells. Fallback stays within the group's entries; with
every allowed account resting or out the group's usual error comes
back, and a key and a group that share no account get a 403 naming
the group, nothing asked upstream. SaveGroup resolves each entry
(ResolveAccount, shared with the key's CleanAccounts); share and
import drop them. A group without accounts is as before.
GUI: the group editor's Accounts section, a row per member provider
with two or more accounts, "Any of its accounts" until some are ticked
in the app menu (openPicker multi). Every save sends accounts, since a
save replaces the group. Strings in all five languages.
Gateway keys stay as they are: Gateway › "Gateway keys are for other
computers … added here once Share on local network is on" already says
where, and this case needs none.
Run (mote, through mote-run), at cafed0067 on origin/main 9d08993c8:
- gofmt -l internal/: clean. go vet of access, gateway, provider,
gui; GOOS=linux -tags nogui and GOOS=windows go vet ./internal/...:
ok.
- go test -count=1 ./internal/access ./internal/provider
./internal/gateway ./internal/gui: access, provider, gateway ok; gui
red only on TestMainWindowCorners/macOS_26_SDK, red on main too
(#3949, mote's macOS 27).
- node --test group-*.test.cjs routing-group-*.test.cjs
routing-save*.test.cjs i18n-keys.test.cjs: 433/434. The one red is
group-found-skip "webkit de 390px: a provider left out of found
groups" (the clicks moved the page), filed as #4617 from main; the
file alone passes 20/20 here and on main 94f6f6092.
group-accounts.test.cjs is 30/30 (Chromium and WebKit; en, zh,
zh-TW, ja, de; 1100 and 420px; no scroll on the clicks, no sideways
scroll, the save carries accounts).
- Earlier, at base 5a0c79ed9: go test -timeout 45m ./... all ok but
TestVisionBridgePassesLines and TestSettingsSaveKeepsWhatItDoesNot-
Send (fixed on main by 0b783b1dd and b646a9127; both pass after the
rebase) and TestMainWindowCorners (#3949).
- The whole GUI suite was cut short twice (a wiped scratchpad, then a
mote reboot). Its runs at load ~140-220 had about 35 reds, none in a
file this change touches (account-mask, balance-fix, lan-*, the
#4617 test among them); not chased here.
- Sandbox HOME on mote, the built binary (`magpie serve`, MAGPIE_ADDR
on a free port) with a fake upstream answering with the key it got:
group/work and Work -> sk-work (3 of 3), group/mine and relay/m ->
sk-mine.
- Rebased again onto 8826a15ea (no file in common): go vet of gui,
provider, gateway; go test -run 'TestGroupAccounts|TestHeldToGroup|
TestCleanAccounts|Budget|TestGroup' of gateway, access, provider,
gui: ok; group-accounts and i18n-keys GUI files: 34/34.
- Rebased onto ec104b862 (trace.go and gateway-routing.md in common,
merged clean): gofmt clean; go vet of gateway for darwin, windows,
linux nogui; go test -count=1 ./internal/gateway: ok (640s).
- Rebased onto 2b52302dc, then da275848b (no file in common): go vet ./internal/...,
the TestGroupAccounts/TestHeldToGroup/Budget tests, group-accounts
and i18n-keys GUI files: ok, 34/34.
Broken by hand, each red, then restored:
- serve's heldByGroup: three TestGroupAccounts* tests red (sk-mine spent).
- count_tokens' heldByGroupAt: the count_tokens route red.
- planLevel's hold: the nested "outer" group red.
- the editor save without accounts: group-accounts.test.cjs red.
Not tried: a real Codex or OpenAI account (the fake upstream stands
in); a CLI `magpie group set accounts=` (no CLI for it yet); a
provider's own fallback naming a held group has no test of its own
(planFallbackGroup passes the group as hold, the same path as nested).