Files
magpie/docs
yetone ff16f6c552 gateway: a remote magpie's providers are each a vendor of their own to a conversation (fremontdango)
fremontdango on Discord ran two magpies. On the local one, a routing
group held one model from two providers of the remote magpie
(office/first/m, office/second/m). Its conversations were kept as if the
two were one vendor, because both are the one remote-magpie key here
(candidate.who()). The same group made on the remote behaved
differently:
- strict: when the first provider ran out, the conversation failed over
  to the second, though strict means it never moves
- session/auto: with the first gone, the "same account, other model"
  match kept the conversation on the second as "session", though nothing
  of it was cached there
- the second's refusal of the first's sealed reasoning was recorded
  against the whole remote, so the first's own seals were then taken out
  of requests to it
- a native compaction one sealed went to the other too

There is now a vendor identity for these: candidate.vendor() and
sameVendor(who, model). Behind a remote magpie it is the key plus the
remote's provider, the model id's first part (remoteUpstream). A remote
group is one vendor by its whole id, and a model named without a
provider is the key alone. It is used by:
- affine's widest match
- strictOnly and strictKeep
- unanswered
- refused/withoutRefused
- checkpointReaders (native compaction)
- Codex leadFirst
Lanes, requests a minute and leastHeld's per-model seat stay on who(),
the limits the user set on the key here. Sticks and compaction writers
are stored as before (who plus model), so the sticks saved on disk still
match after the update. Only the local magpie (the one with the group)
needs this version.

Run:
- go test -tags nogui -count=1 -timeout 45m ./internal/gateway: ok
  (559s) at 040a4ec29. After rebasing onto ab546a4ee (busy.go,
  draw.go, gateway.go changed upstream): vet, gofmt and -run
  'TestRemote|Strict|Affinity|Stick|NativeCompaction|Refused|Lead|Busy|Draw':
  ok
- go vet (darwin, GOOS=linux, GOOS=windows, -tags nogui)
  ./internal/gateway, and gofmt -l: clean
- Two sandbox magpies, each under its own HOME/XDG dirs: the remote on
  127.0.0.1:47611 with providers first and second (model m1, one fake
  upstream on :47613 that answers 429 to first's key once a flag file
  exists), and the local on :47612 with a Remote magpie provider and a
  strict, ordered group of office/first/m1 and office/second/m1. Turn 1
  of a session went to first. With the flag set, turn 2:
  - local on origin/main: 200 from office/second/m1 (moved)
  - local on this change: 429 "Office: First: usage limit reached"
    (kept), and a new session went to second

Broken by hand: sameVendor reduced to c.who() == who made
TestRemoteMagpieStrictKeepsTheRemotesProvider fail (went to second) and
TestRemoteMagpieOtherProviderIsNotTheSameAccount fail (traced
"session", want "gone").

Not tried: the sealed-reasoning and native-compaction paths through a
real remote. They use the same sameVendor/vendor, and the package tests
for them pass. Three layers (local, middle, remote): the middle's
provider is the vendor here, and the middle keeps its own providers
apart.
2026-10-27 16:05:23 +08:00
..