Commit Graph
2 Commits
Author SHA1 Message Date
yetone 24f24abde3 usage: a ClinePass contributor-fallbacks route still shows as a swap (plugins#351)
woyin's Routing rows show cline-pass/deepseek-v4.1-flash-1017 served as
vmc/deepseek-v4p1-flash-1017-contributor-fallbacks. Third-party Cline Pass
tools record that name as a private contributor deployment
(finalProvider "openai-compatible-private"), not DeepSeek's own API. So
the row has to keep saying it was served elsewhere. 6db5e9d59's
ClineServing already does this, because only the exact model maps. This
commit is tests only: they hold the rule, so a looser match (a prefix,
say) can't hide the route later.

- TestSwappedClineServingName: -contributor-fallbacks (with and without
  the -1017 date), -contributor and -fallbacks are swaps.
- TestRouteKeptClineServingNameNotSwapped: a kept row served as
  ...-contributor-fallbacks stays swapped when it is read again.

Run at 616c87256's tree:
- go test ./internal/usage: ok.
- go test ./internal/gateway -run 'Clin|Swap|Served|routedAgain|History': ok.
- go vet on darwin, linux and windows: ok. gofmt -l: clean.

Broken by hand: ClineServing changed to a prefix match. Three usage cases
and the history case went red. Restored afterwards.

Not run: the full suite (tests only, in two packages).
2026-10-24 17:07:35 +08:00
yetone 6db5e9d593 usage: ClinePass's vmc/ name for the model asked is not a swap (zRain on Discord)
zRain (Discord, 10-24) sent Snow CLI through magpie to
cline/cline-pass/deepseek-v4.1-flash-1017 and read the Routing row's
"vmc/deepseek-v4p1-flash-101…" as the upstream, so the DeepSeek pin
(cline plugin 0.1.11) looked ignored. That text is magpie's swap tag
("实际 vmc/…", "likely another model"): ClinePass answers a cline-pass/
model under its virtual model config's name, the version's dot written
"p", and Swapped read deepseek-v4p1-flash as another model than
deepseek-v4.1-flash. hy125245's pinned requests (finalProvider deepseek,
X 10-23) carried the same vmc/ name, so the name says nothing about the
upstream; the upstream is the "上游:…" tag after it, which the swap tag
pushed out of a narrow row.

Changed: usage.ServingName now includes ClineServing: served "vmc/<name>"
for a sent model with a cline-pass/ path, equal once "<d>p<d>" reads as
"<d>.<d>". Scoped to ClinePass: the same vmc/ name for deepseek/… (not
cline-pass/), another model (v4-pro answered as v4p1-flash, v4p1 vs v4p2,
glm-5.3 vs glm-5p3-flash) and another prefix stay swaps. ServingName is
what routedAgain and the ledger's kept rows already re-read, so routes
and Requests rows kept marked swapped read as not swapped too.

Facts checked, not changed:
- The pin reaches ClinePass on every path. The real opencode-cline-auth
  0.1.11 index.mjs, loaded in magpie's plugin host against a fake
  api.cline.bot (scratch wrapper over fetch, not committed), got
  providerOptions {gateway:{only:["deepseek"],has:["vision",
  "implicit-caching"]}} for a Snow-shaped streamed /v1/responses, a
  non-streamed one, /v1/chat/completions and /v1/messages, and the
  route's Upstream was the reply's finalProvider.
- With the fake refusing the pin ("no matching upstream"), the plugin's
  one unpinned retry went out and the route showed the fallback's
  finalProvider as Upstream: a fallback would show as another "上游".
- Vercel's AI Gateway lists deepseek for deepseek-v4.1-flash-1017 with
  vision and implicit-caching, so the has filter doesn't rule it out;
  "vmc" is not one of its providers.
- @magpie-community plugins update by themselves hourly; npm has 0.1.11
  since 10-23 14:18 UTC.

Run at this commit, rebased on origin/main 3e9efe1d5:
- gofmt -l, go vet (darwin), GOOS=linux and GOOS=windows go vet of
  ./internal/usage ./internal/gateway: clean.
- go test -count=1 -timeout 45m ./...: ok, 70 packages, no FAIL (internal/gateway 544.996s)

Broken by hand (ClineServing returning false), each red:
TestSwappedClineServingName, TestKeptRowClineServingNameNotSwapped,
TestRouteKeptClineServingNameNotSwapped; and the scratch real-plugin run
marked all four routes Swapped.

Not tried: a real ClinePass request (no Cline sign-in on this machine),
so whether zRain's four rows had "上游:deepseek" after the vmc/ name is
the reporter's to say; the GUI suite (no GUI file changed).
2026-10-24 16:29:44 +08:00